diff 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
line wrap: on
line diff
--- /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()