()
| 734 | |
| 735 | |
| 736 | def test_zoneinfo(): |
| 737 | tz = parse_timezone("Asia/Shanghai") |
| 738 | tz2 = parse_timezone("asia/shanghai") |
| 739 | tz3 = parse_timezone("asia/ShangHai") |
| 740 | now = datetime.now() |
| 741 | assert now.replace(tzinfo=tz) == now.replace(tzinfo=tz2) == now.replace(tzinfo=tz3) |
| 742 | tz = parse_timezone("US/central") |
| 743 | tz2 = parse_timezone("US/Central") |
| 744 | assert now.replace(tzinfo=tz) == now.replace(tzinfo=tz2) |
| 745 | tz_utc = parse_timezone("UTC") |
| 746 | tz_utc2 = parse_timezone("utc") |
| 747 | tz_utc3 = parse_timezone("Utc") |
| 748 | assert tz_utc.key == tz_utc2.zone == "UTC" |
| 749 | assert ( |
| 750 | now.replace(tzinfo=UTC) |
| 751 | == now.replace(tzinfo=tz_utc) |
| 752 | == now.replace(tzinfo=tz_utc2) |
| 753 | == now.replace(tzinfo=tz_utc3) |
| 754 | ) |
| 755 | with pytest.raises(ZoneInfoNotFoundError): |
| 756 | parse_timezone("invalid-zone-name") |
| 757 | with pytest.raises(ZoneInfoNotFoundError): |
| 758 | parse_timezone("Invalid/Zonename") |
| 759 | |
| 760 | |
| 761 | def test_timezone(tz_env): |
nothing calls this directly
no test coverage detected
searching dependent graphs…