MCPcopy Index your code
hub / github.com/dask/dask / test_tokenize_method

Function test_tokenize_method

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

Source from the content-addressed store, hash-verified

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…