def test_hash_evoked(): """Test evoked hashing""" ave = read_evokeds(fname, 0) ave_2 = read_evokeds(fname, 0) assert_equal(hash(ave), hash(ave_2)) # do NOT use assert_equal here, failing output is terrible assert_true(pickle.dumps(ave) == pickle.dumps(ave_2)) ave_2.data[0, 0] -= 1 assert_not_equal(hash(ave), hash(ave_2))
def test_hash_evoked(): """Test evoked hashing.""" ave = read_evokeds(fname, 0) ave_2 = read_evokeds(fname, 0) assert_equal(hash(ave), hash(ave_2)) # do NOT use assert_equal here, failing output is terrible assert_true(pickle.dumps(ave) == pickle.dumps(ave_2)) ave_2.data[0, 0] -= 1 assert_not_equal(hash(ave), hash(ave_2))
def test_hash_raw(): """Test hashing raw objects """ raw = read_raw_fif(fif_fname) assert_raises(RuntimeError, raw.__hash__) raw = Raw(fif_fname, preload=True).crop(0, 0.5) raw_2 = Raw(fif_fname, preload=True).crop(0, 0.5) assert_equal(hash(raw), hash(raw_2)) # do NOT use assert_equal here, failing output is terrible assert_true(pickle.dumps(raw) == pickle.dumps(raw_2)) raw_2._data[0, 0] -= 1 assert_not_equal(hash(raw), hash(raw_2))
def test_epochs_hash(): """Test epoch hashing """ epochs = Epochs(raw, events, event_id, tmin, tmax) assert_raises(RuntimeError, epochs.__hash__) epochs = Epochs(raw, events, event_id, tmin, tmax, preload=True) assert_equal(hash(epochs), hash(epochs)) epochs_2 = Epochs(raw, events, event_id, tmin, tmax, preload=True) assert_equal(hash(epochs), hash(epochs_2)) # do NOT use assert_equal here, failing output is terrible assert_true(pickle.dumps(epochs) == pickle.dumps(epochs_2)) epochs_2._data[0, 0, 0] -= 1 assert_not_equal(hash(epochs), hash(epochs_2))