@@ -104,21 +104,22 @@ def test_parse_rfc3339_error_message_clarity(self):
104104 self .assertIn ("expected" , error_msg )
105105
106106 def test_parse_rfc3339_handles_none_from_timezone_regex (self ):
107- """Test that parse_rfc3339 handles cases where timezone regex returns None.
108-
109- This test addresses the GitHub issue where parse_rfc3339 was calling .groups()
110- on None when the timezone regex failed to match, causing:
111- 'NoneType' object has no attribute 'groups'
112-
113- The fix adds a check to ensure _re_timezone.search() result is not None
114- before calling .groups(), and provides a clear error message.
107+ """Test parse_rfc3339 handles timezone regex returning None.
108+
109+ This test addresses the GitHub issue where parse_rfc3339 was
110+ calling .groups() on None when the timezone regex failed to match,
111+ causing: 'NoneType' object has no attribute 'groups'
112+
113+ The fix adds a check to ensure _re_timezone.search() result is
114+ not None before calling .groups(), and provides a clear error
115+ message.
115116 """
116- # The main RFC3339 regex allows space in the timezone position: [zZ ]
117+ # The main RFC3339 regex allows space in timezone position: [zZ ]
117118 # If a space ends up in groups[7], it should be handled gracefully
118119 # Since the current code uses strip(), trailing spaces are removed,
119120 # but the fix ensures robustness for any edge case
120-
121+
121122 # Test that space in timezone is treated as UTC (like Z/z)
122- actual = parse_rfc3339 ("2017-07-25 04:44:21" ) # No timezone specified
123+ actual = parse_rfc3339 ("2017-07-25 04:44:21" )
123124 expected = datetime (2017 , 7 , 25 , 4 , 44 , 21 , 0 , UTC )
124125 self .assertEqual (expected , actual )
0 commit comments