view tests/test_deteremine_distances.py @ 0:5dba84370182

initial commit; half-working prototype
author Jeff Hammel <k0scist@gmail.com>
date Sat, 24 Jun 2017 12:03:39 -0700
parents
children
line wrap: on
line source

#!/usr/bin/env python

"""
test converstion: geoids intermediary to distances
"""

import json
import os
import unittest
from globalneighbors.determine_distances import geoids2distances

here = os.path.dirname(os.path.abspath(__file__))
data = os.path.join(here, 'data')

class DetermineDistncesTest(unittest.TestCase):

    # full dataset:  test with caution
    full_tsv = os.path.join(data, 'cities1000.txt')
    full_tsv_lines = 149092

    # neighbors within +/- 1 degree lat or lon from each other
    twodegrees = os.path.join(data, '2degrees.json')

    def test_2degrees(self):
        """test cities within 2 degrees lat, lon of each other"""

        # ensure our fixtures exist
        assert os.path.exists(self.full_tsv)
        assert os.path.exists(self.twodegrees)

        # read neighbors file
        with open(self.twodegrees) as f:
            twodegrees = json.loads(f.read())


if __name__ == '__main__':
    unittest.main()