[test] add pytest with first test cases from coordinates_pixel_conversion.py
Browse files- .dockerignore +1 -0
- .gitignore +1 -0
- tests/__init__.py +0 -0
- tests/io/__init__.py +0 -0
- tests/io/test_coordinates_pixel_conversion.py +57 -0
.dockerignore
CHANGED
@@ -6,3 +6,4 @@ tmp/
|
|
6 |
.env*
|
7 |
__pycache__
|
8 |
.DS_Store
|
|
|
|
6 |
.env*
|
7 |
__pycache__
|
8 |
.DS_Store
|
9 |
+
.pytest_cache
|
.gitignore
CHANGED
@@ -6,3 +6,4 @@ tmp/
|
|
6 |
.env*
|
7 |
*.onnx
|
8 |
.DS_Store
|
|
|
|
6 |
.env*
|
7 |
*.onnx
|
8 |
.DS_Store
|
9 |
+
.pytest_cache
|
tests/__init__.py
ADDED
File without changes
|
tests/io/__init__.py
ADDED
File without changes
|
tests/io/test_coordinates_pixel_conversion.py
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from unittest import TestCase
|
2 |
+
|
3 |
+
|
4 |
+
class Test(TestCase):
|
5 |
+
def test_get_latlng2pixel_projection(self):
|
6 |
+
from src.io.coordinates_pixel_conversion import get_latlng2pixel_projection
|
7 |
+
|
8 |
+
# europa
|
9 |
+
output = get_latlng2pixel_projection({"lat": 55.82499925397549, "lng": 30.55813798557972})
|
10 |
+
assert output == {"x": 149.73023145641224, "y": 79.93873304907419}
|
11 |
+
|
12 |
+
# nord america
|
13 |
+
output = get_latlng2pixel_projection({"lat": 55.73904872165355, "lng": -88.38855385872797})
|
14 |
+
assert output == {"x": 65.14591725601566, "y": 80.04742192145312}
|
15 |
+
|
16 |
+
# sud america
|
17 |
+
output = get_latlng2pixel_projection({"lat": -28.07197941598981, "lng": -81.47485480086976})
|
18 |
+
assert output == {"x": 70.06232547493705, "y": 148.8124992861222}
|
19 |
+
|
20 |
+
# tasmania
|
21 |
+
output = get_latlng2pixel_projection({"lat": -42.10127784960304, "lng": 147.42782020699818})
|
22 |
+
assert output == {"x": 232.8375610360876, "y": 161.06542832667049}
|
23 |
+
|
24 |
+
def test_get_point_latlng_to_pixel_coordinates(self):
|
25 |
+
from src.io.coordinates_pixel_conversion import get_point_latlng_to_pixel_coordinates
|
26 |
+
|
27 |
+
# europa
|
28 |
+
output = get_point_latlng_to_pixel_coordinates(
|
29 |
+
latlng={"lat": 38.26837671763853, "lng": 13.640947603420843},
|
30 |
+
zoom=10
|
31 |
+
)
|
32 |
+
assert output == {"x": 141005, "y": 100867}
|
33 |
+
|
34 |
+
# nord america
|
35 |
+
output = get_point_latlng_to_pixel_coordinates(
|
36 |
+
latlng={"lat": 49.582282020151446, "lng": -114.91703409765535},
|
37 |
+
zoom=7
|
38 |
+
)
|
39 |
+
assert output == {"x": 5923, "y": 11171}
|
40 |
+
|
41 |
+
# sud america
|
42 |
+
output = get_point_latlng_to_pixel_coordinates(
|
43 |
+
latlng={"lat": -32.52828619080139, "lng": -73.03714474717113}, zoom=7
|
44 |
+
)
|
45 |
+
assert output == {"x": 9735, "y": 19517}
|
46 |
+
|
47 |
+
# tasmania
|
48 |
+
output = get_point_latlng_to_pixel_coordinates(
|
49 |
+
latlng={"lat": -52.32191088594772, "lng": 65.30273437500001}, zoom=4
|
50 |
+
)
|
51 |
+
assert output == {"x": 2791, "y": 2749}
|
52 |
+
|
53 |
+
# def test_get_latlng_to_pixel_coordinates(self):
|
54 |
+
# self.fail()
|
55 |
+
#
|
56 |
+
# def test_pixel_coordinate(self):
|
57 |
+
# self.fail()
|