Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jalaziz committed Sep 7, 2021
1 parent 84da467 commit 731afde
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
from drf_spectacular.generators import SchemaGenerator
from tests import assert_schema

try:
functools_cached_property = functools.cached_property # type: ignore
except ImportError:
# functools.cached_property is only available in Python 3.8+.
# We re-use Django's cached_property when it's not avaiable to
# keep tests unified across Python versions.
functools_cached_property = cached_property

fs = FileSystemStorage(location=tempfile.gettempdir())


Expand Down Expand Up @@ -113,7 +121,7 @@ def field_model_property_float(self) -> float:
def field_model_cached_property_float(self) -> float:
return 1.337

@functools.cached_property # type: ignore
@functools_cached_property
def field_model_py_cached_property_float(self) -> float:
return 1.337

Expand All @@ -139,7 +147,7 @@ def sub_object(self) -> SubObject:
def sub_object_cached(self) -> SubObject:
return SubObject(self)

@functools.cached_property # type: ignore
@functools_cached_property
def sub_object_py_cached(self) -> SubObject:
return SubObject(self)

Expand Down

0 comments on commit 731afde

Please sign in to comment.