|
@@ -0,0 +1,68 @@
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+import pytest
|
|
|
|
+
|
|
|
|
+from location_guessing_game_telegram_bot import _Photo
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@pytest.mark.parametrize(
|
|
|
|
+ ("index", "expected_vars"),
|
|
|
|
+ (
|
|
|
|
+ (
|
|
|
|
+ 0,
|
|
|
|
+ {
|
|
|
|
+ "description_url": "https://commons.wikimedia.org/wiki"
|
|
|
|
+ "/File:H%C3%BCtteltalkopf_(Venedigergruppe)_from_Tristkopf.jpg",
|
|
|
|
+ "latitude": 47.288805,
|
|
|
|
+ "longitude": 12.144116,
|
|
|
|
+ "photo_url": "https://upload.wikimedia.org/wikipedia/commons/a/ab"
|
|
|
|
+ "/H%C3%BCtteltalkopf_%28Venedigergruppe%29_from_Tristkopf.jpg",
|
|
|
|
+ },
|
|
|
|
+ ),
|
|
|
|
+ (
|
|
|
|
+ 1,
|
|
|
|
+ {
|
|
|
|
+ "description_url": "https://commons.wikimedia.org/wiki"
|
|
|
|
+ "/File:Gro%C3%9Fvenediger3.JPG",
|
|
|
|
+ "latitude": 47.24854167,
|
|
|
|
+ "longitude": 12.25381667,
|
|
|
|
+ "photo_url": "https://upload.wikimedia.org/wikipedia/commons/6/65"
|
|
|
|
+ "/Gro%C3%9Fvenediger3.JPG",
|
|
|
|
+ },
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+)
|
|
|
|
+def test_from_wikimap_export(wikimap_export, index, expected_vars):
|
|
|
|
+
|
|
|
|
+ assert vars(_Photo.from_wikimap_export(wikimap_export[index])) == expected_vars
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def test___str__():
|
|
|
|
+ assert (
|
|
|
|
+ str(
|
|
|
|
+ _Photo(
|
|
|
|
+ photo_url="https://upload.wikimedia.org/wikipedia/commons/6/65"
|
|
|
|
+ "/Gro%C3%9Fvenediger3.JPG",
|
|
|
|
+ description_url="https://commons.wikimedia.org/wiki"
|
|
|
|
+ "/File:Gro%C3%9Fvenediger3.JPG",
|
|
|
|
+ latitude=47.24854167,
|
|
|
|
+ longitude=12.25381667,
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ == "photo https://commons.wikimedia.org/wiki/File:Gro%C3%9Fvenediger3.JPG"
|
|
|
|
+ )
|