Commit e399aaa4 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

TEST: New --column test

parent 05a679b8
......@@ -1535,6 +1535,33 @@ def test_main_column_patterns_and_variables():
assert np.all(got.columns == ['col1', '1-0.0', '3-0.0'])
@patch_logging
def test_main_columns_from_file():
data = tw.dedent("""
eid,a,b,c,d1,d2,e
1,10,100,1000,10000,100000,1000000
2,20,200,2000,20000,200000,2000000
3,30,300,3000,30000,300000,3000000
4,40,400,4000,40000,400000,4000000
5,50,500,5000,50000,500000,5000000
""").strip()
with tempdir():
with open('data.txt', 'wt') as f:
f.write(data)
with open('cols.txt', 'wt') as f:
f.write('a\nb\n')
main.main(shlex.split(
'-nb -co cols.txt -co "d*" -co e out.txt data.txt'))
got = pd.read_csv('out.txt', index_col=0, delimiter='\t')
exp = pd.read_csv('data.txt', index_col=0).drop(columns=['c'])
assert got.equals(exp)
@patch_logging
def test_main_variables_and_visits():
......
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