MCPcopy Create free account
hub / github.com/Pometry/Raphtory / test_datetime_with_timezone

Function test_datetime_with_timezone

python/tests/test_timezone.py:8–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6
7
8def test_datetime_with_timezone():
9 g = Graph()
10 # testing zones east and west of UK
11 timezones = [
12 "Asia/Kolkata",
13 "America/New_York",
14 "US/Central",
15 "Europe/London",
16 "Australia/Sydney",
17 "Africa/Johannesburg",
18 ]
19 results = [
20 datetime(2024, 1, 5, 1, 0, tzinfo=utc),
21 datetime(2024, 1, 5, 6, 30, tzinfo=utc),
22 datetime(2024, 1, 5, 10, 0, tzinfo=utc),
23 datetime(2024, 1, 5, 12, 0, tzinfo=utc),
24 datetime(2024, 1, 5, 17, 0, tzinfo=utc),
25 datetime(2024, 1, 5, 18, 0, tzinfo=utc),
26 ]
27
28 for tz in timezones:
29 timezone = pytz.timezone(tz)
30 naive_datetime = datetime(2024, 1, 5, 12, 0, 0)
31 localized_datetime = timezone.localize(naive_datetime)
32 g.add_node(localized_datetime, 1)
33
34 def check(g):
35 assert g.node(1).history.dt.collect() == results
36
37 check(g)

Callers

nothing calls this directly

Calls 3

GraphClass · 0.90
checkFunction · 0.70
add_nodeMethod · 0.45

Tested by

no test coverage detected