if pos < len_str:
if tstr[pos] not in '.,':
- raise ValueError("Invalid microsecond component")
+ raise ValueError("Invalid microsecond separator")
else:
pos += 1
# HH:MM:SS len: 8
# HH:MM:SS.f+ len: 10+
- if len(tzstr) in (0, 1, 3):
+ if len(tzstr) in (0, 1, 3) or tstr[tz_pos-1] == 'Z':
raise ValueError("Malformed time zone string")
tz_comps = _parse_hh_mm_ss_ff(tzstr)
'2009-04-32T24:00:00.000000', # Day is invalid before wrapping due to 24:00
'2009-13-01T24:00:00.000000', # Month is invalid before wrapping due to 24:00
'9999-12-31T24:00:00.000000', # Year is invalid after wrapping due to 24:00
+ '2009-04-19T12:30Z12:00', # Extra time zone info after Z
+ '2009-04-19T12:30:45:334034', # Invalid microsecond separator
]
for bad_str in bad_strs:
('00:00:00.000', self.theclass(0, 0)),
('000000.000000', self.theclass(0, 0)),
('00:00:00.000000', self.theclass(0, 0)),
+ ('00:00:00,100000', self.theclass(0, 0, 0, 100000)),
('1200', self.theclass(12, 0)),
('12:00', self.theclass(12, 0)),
('120000', self.theclass(12, 0)),
'12:30:45.123456+12:00:30a', # Extra at end of full time
'12.5', # Decimal mark at end of hour
'12:30,5', # Decimal mark at end of minute
+ '12:30:45.123456Z12:00', # Extra time zone info after Z
+ '12:30:45:334034', # Invalid microsecond separator
]
for bad_str in bad_strs: