MCPcopy Create free account
hub / github.com/dask/dask / test_nested_tokenize_seen

Function test_nested_tokenize_seen

dask/tests/test_tokenize.py:844–863  ·  view source on GitHub ↗

Test that calling tokenize() recursively doesn't alter the output due to memoization of already-seen objects

()

Source from the content-addressed store, hash-verified

842
843
844def test_nested_tokenize_seen():
845 """Test that calling tokenize() recursively doesn't alter the output due to
846 memoization of already-seen objects
847 """
848 o = [1, 2, 3]
849
850 class C:
851 def __init__(self, x):
852 self.x = x
853 self.tok = None
854
855 def __dask_tokenize__(self):
856 if not self.tok:
857 self.tok = tokenize(self.x)
858 return self.tok
859
860 c1, c2 = C(o), C(o)
861 check_tokenize(o, c1, o)
862 assert c1.tok
863 assert check_tokenize(c1) == check_tokenize(c2)
864
865
866def test_tokenize_dict():

Callers

nothing calls this directly

Calls 2

check_tokenizeFunction · 0.85
CClass · 0.70

Tested by

no test coverage detected