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

Function test_nested_tokenize_seen

dask/tests/test_tokenize.py:843–862  ·  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

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

Callers

nothing calls this directly

Calls 2

check_tokenizeFunction · 0.85
CClass · 0.70

Tested by

no test coverage detected