-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test package cached properties (#1977)
* Wrote a test case for cached_properties of the 'package' module Signed-off-by: Harmouch101 <[email protected]> * vi test_cache_utils.py Signed-off-by: Harmouch101 <[email protected]> * add newsfragment Co-authored-by: Marc Garreau <[email protected]>
- Loading branch information
Showing
7 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Test ethpm caching + bump Sphinx version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import random | ||
|
||
from ethpm._utils.cache import ( | ||
cached_property, | ||
) | ||
|
||
|
||
def test_cached_property(): | ||
class FOO: | ||
def __int__(self): | ||
pass | ||
|
||
@cached_property | ||
def generate_number(self): | ||
return random.random() | ||
|
||
foo = FOO() | ||
foo_number = foo.generate_number | ||
foo_cached_number = foo.generate_number | ||
assert foo_number == foo_cached_number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters