-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
54624b0
commit 6fc344a
Showing
7 changed files
with
88 additions
and
51 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
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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from pytest import mark | ||
from tzfpy import get_tz | ||
|
||
|
||
@mark.parametrize( | ||
"lng, lat, tz", | ||
[ | ||
(116.3883, 39.9289, "Asia/Shanghai"), | ||
(120.347287, 22.598127, "Asia/Taipei"), | ||
(2.3522, 48.8566, "Europe/Paris"), | ||
(-0.1276, 51.5074, "Europe/London"), | ||
(13.4049, 52.5200, "Europe/Berlin"), | ||
(-74.0060, 40.7128, "America/New_York"), | ||
(-118.2437, 34.0522, "America/Los_Angeles"), | ||
], | ||
) | ||
def test_get_tz(lng, lat, tz): | ||
assert get_tz(lng, lat) == tz |
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,30 +1,26 @@ | ||
from unittest import TestCase, main | ||
|
||
from citiespy import all_cities | ||
from tzfpy import data_version, get_tzs, timezonenames | ||
|
||
|
||
class TestCompatibility(TestCase): | ||
def test_with_pytz(self): | ||
from pytz import timezone | ||
def test_with_pytz(): | ||
from pytz import timezone | ||
|
||
for tz in timezonenames(): | ||
timezone(tz) | ||
|
||
for tz in timezonenames(): | ||
timezone(tz) | ||
|
||
def test_with_tzdata(self): | ||
from zoneinfo import ZoneInfo | ||
def test_with_tzdata(): | ||
from zoneinfo import ZoneInfo | ||
|
||
for tz in timezonenames(): | ||
ZoneInfo(tz) | ||
for tz in timezonenames(): | ||
ZoneInfo(tz) | ||
|
||
def test_no_empty(self): | ||
for city in all_cities(): | ||
tznames = get_tzs(city.lng, city.lat) | ||
self.assertTrue(len(tznames) != 0) | ||
|
||
def test_version_support(self): | ||
self.assertTrue(data_version() not in [None, ""]) | ||
def test_no_empty(): | ||
for city in all_cities(): | ||
tznames = get_tzs(city.lng, city.lat) | ||
assert len(tznames) != 0 | ||
|
||
|
||
if __name__ == "__main___": | ||
main() | ||
def test_version_support(): | ||
assert data_version() not in [None, ""] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.