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

Function test_tokenize_dense_sparse_array

dask/tests/test_tokenize.py:1060–1082  ·  view source on GitHub ↗
(cls_name)

Source from the content-addressed store, hash-verified

1058@pytest.mark.skipif("not sp")
1059@pytest.mark.parametrize("cls_name", ("dok",))
1060def test_tokenize_dense_sparse_array(cls_name):
1061 rng = np.random.RandomState(1234)
1062
1063 a = sp.rand(10, 100, random_state=rng).asformat(cls_name)
1064 b = a.copy()
1065
1066 assert check_tokenize(a) == check_tokenize(b)
1067
1068 # modifying the data values
1069 if hasattr(b, "data"):
1070 b.data[:10] = 1
1071 elif cls_name == "dok":
1072 b[3, 3] = 1
1073 else:
1074 raise ValueError
1075 check_tokenize(b)
1076 assert check_tokenize(a) != check_tokenize(b)
1077
1078 # modifying the data indices
1079 b = a.copy().asformat("coo")
1080 b.row[:10] = np.arange(10)
1081 b = b.asformat(cls_name)
1082 assert check_tokenize(a) != check_tokenize(b)
1083
1084
1085def test_tokenize_circular_recursion():

Callers

nothing calls this directly

Calls 4

check_tokenizeFunction · 0.85
RandomStateMethod · 0.45
copyMethod · 0.45
arangeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…