Commit 8727fb3b authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

TEST: fix removeSubjects tests

parent cc5e1dfe
......@@ -25,8 +25,6 @@ def test_removeSubjects():
df = pd.DataFrame(data, columns=colnames).set_index('eid')
data = data[:, 1:]
# Options in order of precedence:
#
# - exclude: list of subjects to *exclude*
# - include: list of subjects to *include*
# - exprs: list of expressions specifying *inclusion*
......@@ -60,7 +58,7 @@ def test_removeSubjects():
# include + expr
mask = data[:, 0] > 5
mask[:100] = 1
mask[100:] = 0
got = importing.removeSubjects(
df, cols, subjects=np.arange(1, 101), subjectExprs=['v1 > 5'])
assert np.all(got.index == (np.where(mask)[0] + 1))
......@@ -75,12 +73,12 @@ def test_removeSubjects():
assert np.all(got == data[mask, :])
# include + expr + exclude
mask = data[:, 0] > 5
mask[:75] = 1
mask[75:200] = 0
mask = data[:, 0] > 5
mask[300:] = 0
mask[75:200] = 0
got = importing.removeSubjects(
df, cols,
subjects=np.arange(1, 151),
subjects=np.arange(1, 301),
exclude=np.arange(76, 201),
subjectExprs=['v1 > 5'])
assert np.all(got.index == (np.where(mask)[0] + 1))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment