MCPcopy
hub / github.com/mne-tools/mne-python / test_hashfunc

Function test_hashfunc

mne/utils/tests/test_numerics.py:78–96  ·  view source on GitHub ↗

Test md5/sha1 hash calculations.

(tmp_path)

Source from the content-addressed store, hash-verified

76
77
78def test_hashfunc(tmp_path):
79 """Test md5/sha1 hash calculations."""
80 fname1 = tmp_path / "foo"
81 fname2 = tmp_path / "bar"
82 with open(fname1, "wb") as fid:
83 fid.write(b"abcd")
84 with open(fname2, "wb") as fid:
85 fid.write(b"efgh")
86
87 for hash_type in ("md5", "sha1"):
88 hash1 = hashfunc(fname1, hash_type=hash_type)
89 hash1_ = hashfunc(fname1, 1, hash_type=hash_type)
90
91 hash2 = hashfunc(fname2, hash_type=hash_type)
92 hash2_ = hashfunc(fname2, 1024, hash_type=hash_type)
93
94 assert hash1 == hash1_
95 assert hash2 == hash2_
96 assert hash1 != hash2
97
98
99def test_sum_squared():

Callers

nothing calls this directly

Calls 2

hashfuncFunction · 0.90
writeMethod · 0.80

Tested by

no test coverage detected