MCPcopy Index your code
hub / github.com/python-pendulum/pendulum / test_setting_timezone

Function test_setting_timezone

tests/datetime/test_construct.py:41–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39
40
41def test_setting_timezone():
42 tz = "Australia/Brisbane"
43 dtz = timezone(tz)
44 dt = datetime.utcnow()
45 offset = dtz.convert(dt).utcoffset().total_seconds() / 3600
46
47 p = pendulum.datetime(dt.year, dt.month, dt.day, tz=dtz)
48 assert p.timezone_name == tz
49 assert p.offset_hours == int(offset)
50
51
52def test_setting_timezone_with_string():

Callers

nothing calls this directly

Calls 6

timezoneFunction · 0.90
utcnowMethod · 0.80
utcoffsetMethod · 0.80
total_secondsMethod · 0.45
convertMethod · 0.45
datetimeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…