summaryrefslogtreecommitdiffstats
path: root/lang/python/python-pytz/test.sh
blob: 25c5609ae199f5e4b0d2e8b66d72adbbcedca58d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

[ "$1" = python3-pytz ] || exit 0

python3 - << 'EOF'
import pytz
import datetime

utc = pytz.utc
assert utc.zone == 'UTC'

eastern = pytz.timezone('US/Eastern')
fmt = '%Y-%m-%d %H:%M:%S %Z%z'
loc_dt = eastern.localize(datetime.datetime(2026, 1, 1, 0, 0, 0))
assert loc_dt.strftime(fmt) is not None

utc_dt = loc_dt.astimezone(pytz.utc)
assert utc_dt.tzinfo is pytz.utc
EOF