feat: implement timezone and country data handling in thctime module

This commit is contained in:
2026-05-10 12:20:40 +02:00
parent 3f5630da2c
commit 01d94376d4
3 changed files with 191 additions and 203 deletions
+3 -6
View File
@@ -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']