Commits

Anonymous committed f0716ad

`parse_date` will no longer raise `ValueError` or return invalid values
for dates that make no sense at all (like January the 33rd). Instead it
will return `None` now.

Comments (0)

Files changed (2)

tests/test_http.py

     """Test for problematic days."""
     assert parse_date(' Sun 02 Feb 1343 08:49:37 GMT') == datetime(1343, 2, 2, 8, 49, 37)
     assert parse_date('Thu, 01 Jan 1970 00:00:00 GMT') == datetime(1970, 1, 1, 0, 0)
+    assert parse_date('Thu, 33 Jan 1970 00:00:00 GMT') is None
 
 
 def test_remove_entity_headers():
                     year += 1900
                 return datetime(*((year,) + t[1:7])) - \
                        timedelta(seconds=t[-1] or 0)
-            except OverflowError:
+            except (ValueError, OverflowError):
                 return None