# HG changeset patch # User Jeff Hammel # Date 1513546138 28800 # Node ID e21021ca3907136d80504c67818957a950cd8a5a # Parent 16b3a11db8d25153510871f34ecfdc693a984ab3 add tests for reader diff -r 16b3a11db8d2 -r e21021ca3907 tests/test_read.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_read.py Sun Dec 17 13:28:58 2017 -0800 @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +""" +we need a simple data reader; let's test it! +""" + +# See also and to combine with: +# http://k0s.org/hg/numerics/file/tip/numerics/read.py + +import os +import unittest +from tvii.read import read + +here = os.path.dirname(os.path.abspath(__file__)) +data = os.path.join(here, 'data') + +class TestReadData(unittest.TestCase): + + def test_csv_vs_tsv(self): + """really, not tsv; its actually space separated""" + + csv_file = os.path.join(data, 'linear.csv') + csv_array = read(csv_file) + + tsv_file = os.path.join(data, 'linear.tsv') + tsv_array = read(tsv_file) + + assert tsv_array == csv_array + + +if __name__ == '__main__': + main()