()
| 737 | |
| 738 | |
| 739 | def 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 | |
| 763 | def test_tokenize_callable_class(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…