diff options
Diffstat (limited to 'tests/run/datetime_cimport.pyx')
-rw-r--r-- | tests/run/datetime_cimport.pyx | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/run/datetime_cimport.pyx b/tests/run/datetime_cimport.pyx index e7e95206f..2fe90a397 100644 --- a/tests/run/datetime_cimport.pyx +++ b/tests/run/datetime_cimport.pyx @@ -1,10 +1,12 @@ # coding: utf-8 from cpython.datetime cimport import_datetime -from cpython.datetime cimport date, time, datetime, timedelta, PyDateTime_IMPORT +from cpython.datetime cimport date, time, datetime, timedelta, timezone_new, PyDateTime_IMPORT + +import sys import_datetime() - + def test_date(int year, int month, int day): ''' >>> val = test_date(2012, 12, 31) @@ -40,3 +42,20 @@ def test_timedelta(int days, int seconds, int useconds): ''' val = timedelta(days, seconds, useconds) return val + +def test_timezone(int days, int seconds, int useconds, str name): + ''' + >>> val = test_timezone(0, 3600, 0, 'CET') + >>> print(val) + True + ''' + try: + val = timezone_new(timedelta(days, seconds, useconds), name) + except RuntimeError: + if sys.version_info < (3, 7): + return True + else: + # It's only supposed to raise on Python < 3.7 + return False + else: + return True |