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

Function test_normalize_object_unserializable

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

Source from the content-addressed store, hash-verified

302
303
304def test_normalize_object_unserializable():
305 class C:
306 def __reduce__(self):
307 assert False
308
309 c = C()
310
311 with dask.config.set({"tokenize.ensure-deterministic": False}):
312 # Not idempotent
313 assert tokenize(c) != tokenize(c)
314 # You can call normalize_token directly
315 assert normalize_token(c) != normalize_token(c)
316
317 with dask.config.set({"tokenize.ensure-deterministic": True}):
318 with pytest.raises(
319 TokenizationError, match="cannot be deterministically hashed"
320 ):
321 tokenize(c)
322
323 # Test env override
324 assert tokenize(c, ensure_deterministic=False) != tokenize(
325 c, ensure_deterministic=False
326 )
327 with pytest.raises(TokenizationError, match="cannot be deterministically hashed"):
328 tokenize(c, ensure_deterministic=True)
329
330
331def test_tokenize_partial_func_args_kwargs_consistent():

Callers

nothing calls this directly

Calls 3

tokenizeFunction · 0.90
setMethod · 0.80
CClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…