Skip to content

Commit 99ae839

Browse files
authored
Update openlocationcode_test.py
1 parent c40e7b0 commit 99ae839

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

python/openlocationcode_test.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_shortcodes(self):
3636
class TestShorten(unittest.TestCase):
3737
def setUp(self):
3838
self.testdata = []
39-
headermap = {0: 'fullcode', 1: 'lat', 2: 'lng', 3: 'shortcode'}
39+
headermap = {0: 'fullcode', 1: 'lat', 2: 'lng', 3: 'shortcode', 4:'testtype'}
4040
tests_fn = 'test_data/shortCodeTests.csv'
4141
with open(tests_fn, "r") as fin:
4242
for line in fin:
@@ -50,7 +50,10 @@ def setUp(self):
5050

5151
def test_full2short(self):
5252
for td in self.testdata:
53-
self.assertEqual(td['shortcode'], olc.shorten(td['fullcode'], td['lat'], td['lng']), td)
53+
if td['testdata'] == 'B' or td['testdata'] == 'S':
54+
self.assertEqual(td['shortcode'], olc.shorten(td['fullcode'], td['lat'], td['lng']), td)
55+
if td['testdata'] == 'B' or td['testdata'] == 'R':
56+
self.assertEqual(td['fullcode'], olc.recoverNearest(td['shortcode'], td['lat'], td['lng']), td)
5457

5558

5659
class TestEncoding(unittest.TestCase):

0 commit comments

Comments
 (0)