Spaces:
Running
Running
rmm
commited on
Commit
·
859e75b
1
Parent(s):
d87ef07
test: added tests for GPS metadata extraction
Browse files- tests/test_input_handling.py +21 -2
tests/test_input_handling.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
import pytest
|
2 |
from pathlib import Path
|
3 |
|
4 |
-
from input_handling import is_valid_email, is_valid_number
|
|
|
5 |
|
6 |
# generate tests for is_valid_email
|
7 |
# - test with valid email
|
@@ -133,4 +134,22 @@ def test_get_image_datetime():
|
|
133 |
# missng datetime -> expect None
|
134 |
f3 = test_data_pth / 'cakes_no_exif_datetime.jpg'
|
135 |
assert get_image_datetime(f3) == None
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import pytest
|
2 |
from pathlib import Path
|
3 |
|
4 |
+
from input_handling import is_valid_email, is_valid_number
|
5 |
+
from input_handling import get_image_datetime, get_image_latlon
|
6 |
|
7 |
# generate tests for is_valid_email
|
8 |
# - test with valid email
|
|
|
134 |
# missng datetime -> expect None
|
135 |
f3 = test_data_pth / 'cakes_no_exif_datetime.jpg'
|
136 |
assert get_image_datetime(f3) == None
|
137 |
+
|
138 |
+
|
139 |
+
def test_get_image_latlon():
|
140 |
+
# this image has lat, lon, and datetime
|
141 |
+
f1 = test_data_pth / 'cakes.jpg'
|
142 |
+
assert get_image_latlon(f1) == (46.51860277777778, 6.562075)
|
143 |
+
|
144 |
+
# missing GPS loc
|
145 |
+
f2 = test_data_pth / 'cakes_no_exif_gps.jpg'
|
146 |
+
assert get_image_latlon(f2) == None
|
147 |
+
|
148 |
+
# missng datetime -> expect gps not affected
|
149 |
+
f3 = test_data_pth / 'cakes_no_exif_datetime.jpg'
|
150 |
+
assert get_image_latlon(f3) == (46.51860277777778, 6.562075)
|
151 |
+
|
152 |
+
# tests for get_image_latlon with empty file
|
153 |
+
def test_get_image_latlon_empty():
|
154 |
+
assert get_image_latlon("") == None
|
155 |
+
|