def test_timezone_no_sep(): dt = parse('2018-12-04T19:36:08-0500') assert dt.tzinfo assert str(dt.tzinfo) == 'UTC-05:00'
def test_python(): dt1 = datetime.now().astimezone(timezone.utc) dt2 = parse(dt1.isoformat()) assert dt1 == dt2
def test_parse_error(): with pytest.raises(ValueError): parse("foo")