view tests/test_read.py @ 87:9d5a5e9f5c3b

add kmeans + dataset
author Jeff Hammel <k0scist@gmail.com>
date Sun, 17 Dec 2017 14:05:57 -0800
parents e21021ca3907
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()