scrapinghub / dateparser

python parser for human readable dates
BSD 3-Clause "New" or "Revised" License
2.56k stars 465 forks source link

test_timezone_offset_calculation_1 fails on 32bit platforms #1204

Closed wRAR closed 11 months ago

wRAR commented 11 months ago
=================================== FAILURES ===================================
_____________ TestLocalTZOffset.test_timezone_offset_calculation_1 _____________

a = (<tests.test_timezone_parser.TestLocalTZOffset testMethod=test_timezone_offset_calculation_1>,)

    @wraps(func)
    def standalone_func(*a):
>       return func(*(a + p.args), **p.kwargs)

/usr/lib/python3/dist-packages/parameterized/parameterized.py:637: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/tmp/autopkgtest-lxc.mx1vnh9l/downtmp/autopkgtest_tmp/tests/test_timezone_parser.py:137: in test_timezone_offset_calculation
    self.given_time(utc, local)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_timezone_parser.TestLocalTZOffset testMethod=test_timezone_offset_calculation_1>
utc_dt_string = '2052-01-02 11:07', local_dt_string = '2052-01-02 10:07'

    def given_time(self, utc_dt_string, local_dt_string):
        datetime_cls = dateparser.timezone_parser.datetime
        if not isinstance(datetime_cls, Mock):
            datetime_cls = Mock(wraps=datetime)
>       utc_dt_obj = datetime.strptime(utc_dt_string, "%Y-%m-%d %H:%M").astimezone(
            dt.timezone.utc
        )
E       OverflowError: timestamp out of range for platform time_t
wRAR commented 11 months ago

To be honest, I think we should just catch OverflowError and skip the test in that case.