-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_eegh.py
More file actions
50 lines (34 loc) · 1.59 KB
/
Copy pathtest_eegh.py
File metadata and controls
50 lines (34 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from eegprep.functions.adminfunc.eegh import eegh
def test_eegh_records_only_non_empty_commands():
history = []
assert eegh(" EEG = pop_reref(EEG); ", history) == "EEG = pop_reref(EEG);"
assert eegh("", history) == ""
assert eegh(None, history) == "1. EEG = pop_reref(EEG);"
assert history == ["EEG = pop_reref(EEG);"]
def test_eegh_displays_finds_removes_and_clears_newest_first():
history = []
eegh("EEG = pop_loadset('sample.set');", history)
eegh("EEG = pop_resample(EEG, 64);", history)
eegh("EEG = pop_reref(EEG, []);", history)
assert eegh(None, history).splitlines() == [
"1. EEG = pop_reref(EEG, []);",
"2. EEG = pop_resample(EEG, 64);",
"3. EEG = pop_loadset('sample.set');",
]
assert eegh(2, history) == "EEG = pop_resample(EEG, 64);"
assert eegh(-1, history) == ""
assert history == ["EEG = pop_loadset('sample.set');", "EEG = pop_resample(EEG, 64);"]
assert eegh(0, history) == ""
assert history == []
def test_eegh_command_appends_to_eeg_history():
eeg = {"history": "EEG = pop_loadset('sample.set');"}
assert eegh("EEG = pop_resample(EEG, 64);", eeg) == "EEG = pop_resample(EEG, 64);"
assert eeg["history"].splitlines() == [
"EEG = pop_loadset('sample.set');",
"EEG = pop_resample(EEG, 64);",
]
def test_eegh_eeg_history_dedup_compares_last_line_exactly():
eeg = {"history": "AEEG = pop_reref(EEG);"}
eegh("EEG = pop_reref(EEG);", eeg)
eegh("EEG = pop_reref(EEG);", eeg)
assert eeg["history"].splitlines() == ["AEEG = pop_reref(EEG);", "EEG = pop_reref(EEG);"]