MCPcopy Create free account
hub / github.com/tinygrad/tinygrad / test_hash_matches_python_impl

Method test_hash_matches_python_impl

test/unit/test_tinyfs.py:73–78  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

71 np.testing.assert_array_equal(loaded.numpy(), arr)
72
73 def test_hash_matches_python_impl(self):
74 arr = np.arange(256, dtype=np.uint8)
75 h = Tensor(arr).fs_store().realize()
76 # the hash from fs_store should match the pure-Python hash_file reference
77 padded = arr.tobytes().ljust(Tensor.CHUNK_SIZE, b'\0')
78 self.assertEqual(h.data().tobytes(), hash_file(padded))
79
80if __name__ == "__main__":
81 unittest.main()

Callers

nothing calls this directly

Calls 6

TensorClass · 0.90
hash_fileFunction · 0.90
arangeMethod · 0.80
realizeMethod · 0.80
fs_storeMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected