Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add extra config to make Unit model hashable #187

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion tests/models/test_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_unit_model_caching(self):

self.assertEqual(unit.__hash__(), unit.__hash__())

@functools.lru_cache
@functools.lru_cache(maxsize=128)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't that the default anyway? I don't think that python 3.7 should fail because of this. https://docs.python.org/3.7/library/functools.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wonder about that, but it actually fails with the error message:

TypeError: Expected maxsize to be an integer or None

btw, the python examples all give the maxsize explicitly.

def cache_unit(unit: Unit):
return Unit(name=unit.name)

Expand Down