diff --git a/test/test_locator_latlong_to_locator.py b/test/test_locator_latlong_to_locator.py index 0b5dd25..a9734ef 100644 --- a/test/test_locator_latlong_to_locator.py +++ b/test/test_locator_latlong_to_locator.py @@ -23,6 +23,10 @@ class Test_latlong_to_locator(): assert latlong_to_locator(48.51760, 9.40345, precision=8) == "JN48QM84" assert latlong_to_locator(39.222916, -86.45416, 8) == "EM69SF53" + def test_latlong_to_locator_10chars_precision(self): + assert latlong_to_locator(45.83568, 68.52518, precision=10) == "MN45GU30AN" + assert latlong_to_locator(51.12492, 16.94183, 10) == "JO81LC39AX" + def test_latlong_to_locator_invalid_characters(self): # throws ValueError in Python2 and TypeError in Python3 diff --git a/test/test_locator_locator_to_latlong.py b/test/test_locator_locator_to_latlong.py index a5cf1d2..a35ad55 100644 --- a/test/test_locator_locator_to_latlong.py +++ b/test/test_locator_locator_to_latlong.py @@ -30,8 +30,7 @@ class Test_locator_to_latlong(): assert abs(latitude - 48.52083) < 0.00001 assert abs(longitude - 9.37500) < 0.00001 - def test_locator_to_latlong_8chars(self): - + def test_locator_to_latlong_8chars_precision(self): latitude, longitude = locator_to_latlong("JN48QM84") assert abs(latitude - 48.51875) < 0.00001 assert abs(longitude - 9.40416) < 0.00001 @@ -40,6 +39,15 @@ class Test_locator_to_latlong(): assert abs(latitude - 39.222916) < 0.00001 assert abs(longitude + 86.45416) < 0.00001 + def test_locator_to_latlong_10chars_precision(self): + latitude, longitude = locator_to_latlong("JO81LC39AX") + assert abs(latitude - 51.124913) < 0.000001 + assert abs(longitude - 16.941840) < 0.000001 + + latitude, longitude = locator_to_latlong("MN45GU30AN") + assert abs(latitude - 45.835677) < 0.000001 + assert abs(longitude - 68.525173) < 0.000001 + def test_locator_to_latlong_consistency_checks_6chars_lower_left_corner(self): latitude_4, longitude_4 = locator_to_latlong("JN48", center=False) @@ -97,6 +105,9 @@ class Test_locator_to_latlong(): with pytest.raises(ValueError): latitude, longitude = locator_to_latlong("JN8QM1") + with pytest.raises(ValueError): + latitude, longitude = locator_to_latlong("JN8QM1AA") + def test_locator_to_latlong_invalid_characters(self): with pytest.raises(ValueError):