MCPcopy Create free account
hub / github.com/dateutil/dateutil / test_gettz_key_attribute_by_source

Function test_gettz_key_attribute_by_source

tests/test_tzfile.py:2315–2328  ·  view source on GitHub ↗

The key is the string passed to gettz whichever source supplied it.

(source, zoneinfo_cache)

Source from the content-addressed store, hash-verified

2313@pytest.mark.parametrize("zoneinfo_cache", ["fat"], indirect=True)
2314@pytest.mark.parametrize("source", ["tzdata", "tzpath"])
2315def test_gettz_key_attribute_by_source(source, zoneinfo_cache):
2316 """The key is the string passed to gettz whichever source supplied it."""
2317 if source == "tzdata":
2318 pytest.importorskip("tzdata")
2319 paths = ()
2320 else:
2321 paths = (zoneinfo_cache[0],)
2322
2323 with set_tzpath(paths, block_tzdata=(source != "tzdata")):
2324 tz.gettz.cache_clear()
2325 for key in ("America/New_York", "Europe/London"):
2326 zone = tz.gettz(key)
2327 assert isinstance(zone, tz.tzfile)
2328 assert zone.key == key
2329
2330
2331@pytest.mark.parametrize("zoneinfo_cache", ["fat"], indirect=True)

Callers

nothing calls this directly

Calls 3

set_tzpathFunction · 0.85
cache_clearMethod · 0.80
gettzMethod · 0.45

Tested by

no test coverage detected