danielrichman / strict-rfc3339

Strict, simple, lightweight RFC3339 functions
GNU General Public License v3.0
31 stars 13 forks source link

Two more test failures on 32bit #10

Open jayvdb opened 4 years ago

jayvdb commented 4 years ago

I see two more failures on 32bit. These tests should be skipped, and/or a custom exception be raised to indicate functionality is unsupported on 32bit.

[   59s] =================================== FAILURES ===================================
[   59s] ________________ TestTimestampToRFC3339UTCOffset.test_leap_year ________________
[   59s] 
[   59s] self = <test_strict_rfc3339.TestTimestampToRFC3339UTCOffset testMethod=test_leap_year>
[   59s] 
[   59s]     def test_leap_year(self):
[   59s]         assert self.func(1330519341) == "2012-02-29T12:42:21Z"
[   59s]         assert self.func(951868799) == "2000-02-29T23:59:59Z"
[   59s]         assert self.func(1298865732) == "2011-02-28T04:02:12Z"
[   59s]     
[   59s]         try:
[   59s] >           assert self.func(4107456000) == "2100-02-28T00:00:00Z"
[   59s] 
[   59s] test_strict_rfc3339.py:163: 
[   59s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   59s] 
[   59s] timestamp = 4107456000
[   59s] 
[   59s]     def timestamp_to_rfc3339_utcoffset(timestamp):
[   59s]         """Convert a UTC UNIX timestamp to RFC3339, with the offset as 'Z'"""
[   59s]     
[   59s]         seconds, microseconds = _seconds_and_microseconds(timestamp)
[   59s]     
[   59s] >       time_tuple = time.gmtime(seconds)
[   59s] E       OverflowError: timestamp out of range for platform time_t
[   59s] 
[   59s] strict_rfc3339.py:143: OverflowError
[   59s] __________________ TestTimestampToRFC3339UTCOffset.test_y2038 __________________
[   59s] 
[   59s] self = <test_strict_rfc3339.TestTimestampToRFC3339UTCOffset testMethod=test_y2038>
[   59s] 
[   59s]     def test_y2038(self):
[   59s]         try:
[   59s] >           assert self.func(4102444800) == "2100-01-01T00:00:00Z"
[   59s] 
[   59s] test_strict_rfc3339.py:149: 
[   59s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   59s] 
[   59s] timestamp = 4102444800
[   59s] 
[   59s]     def timestamp_to_rfc3339_utcoffset(timestamp):
[   59s]         """Convert a UTC UNIX timestamp to RFC3339, with the offset as 'Z'"""
[   59s]     
[   59s]         seconds, microseconds = _seconds_and_microseconds(timestamp)
[   59s]     
[   59s] >       time_tuple = time.gmtime(seconds)
[   59s] E       OverflowError: timestamp out of range for platform time_t
[   59s] 
[   59s] strict_rfc3339.py:143: OverflowError
chewi commented 2 years ago

I believe the problem here is that it tries to catch this error, but uses ValueError rather than OverflowError. I guess this changed in Python at some point.