From 9aeebe47ce1233d724b140f809b7199729b1921b Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Sat, 3 Oct 2020 17:27:48 +0300 Subject: Render display lat/lng --- iss/tests/test_utils.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'iss/tests/test_utils.py') diff --git a/iss/tests/test_utils.py b/iss/tests/test_utils.py index 17dadf8..f51c10e 100644 --- a/iss/tests/test_utils.py +++ b/iss/tests/test_utils.py @@ -1,6 +1,11 @@ import pytest -from ..utils import deg_to_cardinal, seconds_to_minutes, normalize_lat_lng +from ..utils import ( + deg_to_cardinal, + seconds_to_minutes, + normalize_lat_lng, + display_lat_lng, +) def test_seconds_to_minutes(): @@ -39,6 +44,17 @@ def test_fail_normalize_lat_lng(): normalize_lat_lng(lat, lng) +def test_display_lat_lng(): + cases = [ + (12.345, 67.890, "12.345°N", "67.89°E"), + (12.345, -67.890, "12.345°N", "67.89°W"), + (-12.345, -67.890, "12.345°S", "67.89°W"), + (-12.345, 67.890, "12.345°S", "67.89°E"), + ] + for lat, lng, dlat, dlng in cases: + assert display_lat_lng(lat, lng) == (dlat, dlng) + + def test_deg_to_cardinal(): cases = [ (0, "N"), -- cgit v1.3.1