Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
koyo922 committed Jul 6, 2019
1 parent 2f24b39 commit 0649da3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
16 changes: 7 additions & 9 deletions docs/getting-started.md
Expand Up @@ -121,20 +121,18 @@ aggregate a tsv/csv file

```bash
cat <<'EOF' > infile.tsv
わ わ 笑 14614975
わら わ 笑 1000
で で で 11270299
で で で 1000
が が が 11097238
21 male 永强 1
22 male 永强 2
20 female 刘英 3
20 female 刘英 4
EOF

# aggregation by first 3 columns, summing the last column
aggtsv --infile infile.tsv --sep $'\t' \
-k 0 1 2 -r 3 -a sum
わ わ 笑 14614975
わら わ 笑 1000
で で で 11271299
が が が 11097238
21 male 永强 1
22 male 永强 2
20 female 刘英 7
```

patch a tsv file via one or more reference files
Expand Down
21 changes: 9 additions & 12 deletions tests/test_tsv.py
Expand Up @@ -49,11 +49,10 @@ def test_agg_tsv(tmp_path, capsys):
path = (tmp_path / 'evalset').as_posix()
with file_wrapper(path, 'wt') as f:
f.write(r"""
わ わ 笑 14614975
わら わ 笑 1000
で で で 11270299
で で で 1000
が が が 11097238
21 male 永强 1
22 male 永强 2
20 female 刘英 3
20 female 刘英 4
""".lstrip('\n'))

# 1. 按照前三列聚合,sum最后一列
Expand All @@ -62,10 +61,9 @@ def test_agg_tsv(tmp_path, capsys):
'-a', 'sum'])
captured = capsys.readouterr()
assert r"""
わ わ 笑 14614975
わら わ 笑 1000
で で で 11271299
が が が 11097238
21 male 永强 1
22 male 永强 2
20 female 刘英 7
""".lstrip('\n') == captured.out

# 2. 按照2~3列聚合,sum最后一列
Expand All @@ -74,7 +72,6 @@ def test_agg_tsv(tmp_path, capsys):
'-a', 'sum'])
captured = capsys.readouterr()
assert r"""
わ 笑 14615975
で で 11271299
が が 11097238
male 永强 3
female 刘英 7
""".lstrip('\n') == captured.out

0 comments on commit 0649da3

Please sign in to comment.