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

Function test_gettz_space_for_underscore

tests/test_tzfile.py:2295–2308  ·  view source on GitHub ↗

Spaces in a key are tried as underscores, whichever source is used.

(source, zoneinfo_cache)

Source from the content-addressed store, hash-verified

2293@pytest.mark.parametrize("zoneinfo_cache", ["fat"], indirect=True)
2294@pytest.mark.parametrize("source", ["tzdata", "tzpath"])
2295def test_gettz_space_for_underscore(source, zoneinfo_cache):
2296 """Spaces in a key are tried as underscores, whichever source is used."""
2297 if source == "tzdata":
2298 pytest.importorskip("tzdata")
2299 paths = ()
2300 else:
2301 paths = (zoneinfo_cache[0],)
2302
2303 with set_tzpath(paths, block_tzdata=(source != "tzdata")):
2304 tz.gettz.cache_clear()
2305 with_space = tz.gettz("America/New York")
2306 assert with_space is not None
2307 assert with_space.key == "America/New York"
2308 assert with_space == tz.gettz("America/New_York")
2309
2310
2311####

Callers

nothing calls this directly

Calls 3

set_tzpathFunction · 0.85
cache_clearMethod · 0.80
gettzMethod · 0.45

Tested by

no test coverage detected