(self)
| 48 | class test_iso8601: |
| 49 | |
| 50 | def test_parse_with_timezone(self): |
| 51 | d = datetime.now(_timezone.utc).replace(tzinfo=ZoneInfo("UTC")) |
| 52 | assert parse_iso8601(d.isoformat()) == d |
| 53 | # 2013-06-07T20:12:51.775877+00:00 |
| 54 | iso = d.isoformat() |
| 55 | iso1 = iso.replace('+00:00', '-01:00') |
| 56 | d1 = parse_iso8601(iso1) |
| 57 | d1_offset_in_minutes = d1.utcoffset().total_seconds() / 60 |
| 58 | assert d1_offset_in_minutes == -60 |
| 59 | iso2 = iso.replace('+00:00', '+01:00') |
| 60 | d2 = parse_iso8601(iso2) |
| 61 | d2_offset_in_minutes = d2.utcoffset().total_seconds() / 60 |
| 62 | assert d2_offset_in_minutes == +60 |
| 63 | iso3 = iso.replace('+00:00', 'Z') |
| 64 | d3 = parse_iso8601(iso3) |
| 65 | assert d3.tzinfo == _timezone.utc |
| 66 | |
| 67 | |
| 68 | @pytest.mark.parametrize('delta,expected', [ |
nothing calls this directly
no test coverage detected