view 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 source

#!/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()