-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Move and refactor test_map.py - Bump Python dependency to 3.9 - Use latest flake8 revision
- Loading branch information
Showing
8 changed files
with
236 additions
and
469 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.7 | ||
3.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from typing import Dict, List, Any | ||
|
||
import pytest | ||
|
||
from flask_googlemaps import Map | ||
|
||
|
||
@pytest.fixture | ||
def map_properties() -> Dict[str, Any]: | ||
return dict(identifier="gmap", | ||
varname="gmap", | ||
lat=37.4419, | ||
lng=-122.1419) | ||
|
||
|
||
@pytest.fixture | ||
def markers() -> List[Dict]: | ||
return [ | ||
{ | ||
"content": {"icon_url": "http://maps.google.com/" | ||
"mapfiles/ms/icons/green-dot.png"}, | ||
"latitude": 37.4419, | ||
"longitude": -122.1419, | ||
"infobox": "<b>Hello World</b>", | ||
}, | ||
{ | ||
"latitude": 37.4300, | ||
"longitude": -122.1400, | ||
"infobox": "<b>Hello World from other place</b>", | ||
"content": { | ||
"border_color": "", | ||
"glyph_colors": "", | ||
"background": "", | ||
"glyph": "", | ||
"scale": 2.0, | ||
} | ||
}, | ||
] | ||
|
||
|
||
def test_map_markers(markers: List[Dict], map_properties): | ||
assert len(Map(markers=markers, **map_properties).markers) == 2 | ||
|
||
|
||
def test_map_markers_expected_errors(markers: List[Dict], map_properties): | ||
markers.append({"latitude": -1, "longitude": 250}) | ||
with pytest.raises(AttributeError) as exception_info: | ||
Map(markers=markers, **map_properties) | ||
assert str(exception_info.value) == ( | ||
"Longitude must be between -180 and 180 degrees inclusive." | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters