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

Function test_tokenize_method

dask/tests/test_tokenize.py:740–761  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

738
739
740def test_tokenize_method():
741 class Foo:
742 def __init__(self, x):
743 self.x = x
744
745 def __dask_tokenize__(self):
746 return self.x
747
748 def hello(self):
749 return "Hello world"
750
751 a, b = Foo(1), Foo(2)
752 assert check_tokenize(a) != check_tokenize(b)
753
754 assert check_tokenize(a.hello) != check_tokenize(b.hello)
755
756 # dispatch takes precedence
757 before = check_tokenize(a)
758 normalize_token.register(Foo, lambda self: self.x + 1)
759 after = check_tokenize(a)
760 assert before != after
761 del normalize_token._lookup[Foo]
762
763
764def test_tokenize_callable_class():

Callers

nothing calls this directly

Calls 3

check_tokenizeFunction · 0.85
FooClass · 0.70
registerMethod · 0.45

Tested by

no test coverage detected