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

Function test_tokenize_dense_sparse_array

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

Source from the content-addressed store, hash-verified

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