feat: implement timezone and country data handling in thctime module
This commit is contained in:
+3
-6
@@ -5,6 +5,7 @@ from unittest import mock
|
||||
import pytest
|
||||
|
||||
import main
|
||||
import thctime
|
||||
|
||||
|
||||
SAMPLE_TIMEZONE_CSV = """Etc/UTC,ZZ,UTC,0,0,0
|
||||
@@ -72,7 +73,7 @@ def test_create_embed_all_types(monkeypatch):
|
||||
|
||||
def test_where_is_it_420(monkeypatch):
|
||||
# Limit timezones to a predictable set
|
||||
monkeypatch.setattr(main.pytz, 'all_timezones', ['Etc/UTC'])
|
||||
monkeypatch.setattr(thctime.pytz, 'all_timezones', ['Etc/UTC'])
|
||||
|
||||
tzs = [{'zone_name': 'Etc/UTC', 'country_code': 'ZZ'}]
|
||||
countries = [{'country_code': 'ZZ', 'country_name': 'Nowhere'}]
|
||||
@@ -84,11 +85,7 @@ def test_where_is_it_420(monkeypatch):
|
||||
hour = 4
|
||||
return R()
|
||||
|
||||
monkeypatch.setattr(main, 'datetime', FakeDatetime)
|
||||
monkeypatch.setattr(main, 'get_tz_info', lambda name,
|
||||
t: tzs[0] if name == 'Etc/UTC' else None)
|
||||
monkeypatch.setattr(main, 'get_country_info', lambda code,
|
||||
c: countries[0] if code == 'ZZ' else None)
|
||||
monkeypatch.setattr(thctime, 'datetime', FakeDatetime)
|
||||
|
||||
res = main.where_is_it_420(tzs, countries)
|
||||
assert res == ['Nowhere']
|
||||
|
||||
Reference in New Issue
Block a user