Mercurial > hg > tvii
comparison tests/test_read.py @ 74:e21021ca3907
add tests for reader
| author | Jeff Hammel <k0scist@gmail.com> |
|---|---|
| date | Sun, 17 Dec 2017 13:28:58 -0800 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 73:16b3a11db8d2 | 74:e21021ca3907 |
|---|---|
| 1 #!/usr/bin/env python | |
| 2 | |
| 3 """ | |
| 4 we need a simple data reader; let's test it! | |
| 5 """ | |
| 6 | |
| 7 # See also and to combine with: | |
| 8 # http://k0s.org/hg/numerics/file/tip/numerics/read.py | |
| 9 | |
| 10 import os | |
| 11 import unittest | |
| 12 from tvii.read import read | |
| 13 | |
| 14 here = os.path.dirname(os.path.abspath(__file__)) | |
| 15 data = os.path.join(here, 'data') | |
| 16 | |
| 17 class TestReadData(unittest.TestCase): | |
| 18 | |
| 19 def test_csv_vs_tsv(self): | |
| 20 """really, not tsv; its actually space separated""" | |
| 21 | |
| 22 csv_file = os.path.join(data, 'linear.csv') | |
| 23 csv_array = read(csv_file) | |
| 24 | |
| 25 tsv_file = os.path.join(data, 'linear.tsv') | |
| 26 tsv_array = read(tsv_file) | |
| 27 | |
| 28 assert tsv_array == csv_array | |
| 29 | |
| 30 | |
| 31 if __name__ == '__main__': | |
| 32 main() |
