forked from IronLanguages/ironpython3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_datetime_stdlib.py
More file actions
128 lines (118 loc) · 10.8 KB
/
Copy pathtest_datetime_stdlib.py
File metadata and controls
128 lines (118 loc) · 10.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
##
## Run selected tests from test_datetime from StdLib
##
import sys
from iptest import is_ironpython, is_mono, is_arm64, generate_suite, run_test
import test.datetimetester
def load_tests(loader, standard_tests, pattern):
tests = loader.loadTestsFromModule(test.datetimetester, pattern=pattern)
if is_ironpython:
failing_tests = [
test.datetimetester.TestDate('test_backdoor_resistance'),
test.datetimetester.TestDate('test_insane_fromtimestamp'),
test.datetimetester.TestDateTime('test_extreme_timedelta'),
test.datetimetester.TestDateTime('test_insane_fromtimestamp'),
test.datetimetester.TestDateTime('test_insane_utcfromtimestamp'),
test.datetimetester.TestDateTime('test_microsecond_rounding'),
test.datetimetester.TestDateTime('test_strftime_with_bad_tzname_replace'),
test.datetimetester.TestDateTimeTZ('test_backdoor_resistance'),
test.datetimetester.TestDateTimeTZ('test_even_more_compare'),
test.datetimetester.TestDateTimeTZ('test_extreme_hashes'),
test.datetimetester.TestDateTimeTZ('test_extreme_timedelta'),
test.datetimetester.TestDateTimeTZ('test_insane_fromtimestamp'),
test.datetimetester.TestDateTimeTZ('test_insane_utcfromtimestamp'),
test.datetimetester.TestDateTimeTZ('test_microsecond_rounding'),
test.datetimetester.TestDateTimeTZ('test_mixed_compare'),
test.datetimetester.TestDateTimeTZ('test_strftime_with_bad_tzname_replace'),
test.datetimetester.TestDateTimeTZ('test_tz_aware_arithmetic'),
test.datetimetester.TestSubclassDateTime('test_backdoor_resistance'),
test.datetimetester.TestSubclassDateTime('test_extreme_timedelta'),
test.datetimetester.TestSubclassDateTime('test_insane_fromtimestamp'),
test.datetimetester.TestSubclassDateTime('test_insane_utcfromtimestamp'),
test.datetimetester.TestSubclassDateTime('test_microsecond_rounding'),
test.datetimetester.TestSubclassDateTime('test_replace'), # TODO
test.datetimetester.TestSubclassDateTime('test_strftime_with_bad_tzname_replace'),
test.datetimetester.TestTimeDelta('test_computations'), # rounding differences
test.datetimetester.TestTimeTZ('test_zones'),
test.datetimetester.TestTimeZone('test_constructor'),
]
if sys.version_info < (3, 6):
failing_tests += [
test.datetimetester.TestDateTime('test_backdoor_resistance'),
]
if sys.version_info >= (3, 6):
failing_tests += [
test.datetimetester.IranTest('test_folds'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.IranTest('test_gaps'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.IranTest('test_system_transitions'), # AttributeError: 'module' object has no attribute 'tzset'
test.datetimetester.Oddballs('test_check_arg_types'), # TypeError: an integer is required
test.datetimetester.TestDate('test_compat_unpickle'), # TypeError: date() takes exactly 3 arguments (1 given)
test.datetimetester.TestDate('test_subclass_replace'), # TypeError: replace() got an unexpected keyword argument 'year'
test.datetimetester.TestDateTime('test_backdoor_resistance'), # AssertionError: "^bad tzinfo state arg$" does not match "function takes at least 3 arguments (2 given)"
test.datetimetester.TestDateTime('test_bad_constructor_arguments'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestDateTime('test_combine'), # TypeError: combine() takes exactly 2 arguments (3 given)
test.datetimetester.TestDateTime('test_compat_unpickle'), # TypeError: function takes at least 3 arguments (1 given)
test.datetimetester.TestDateTime('test_isoformat'), # TypeError: isoformat() got an unexpected keyword argument 'timespec'
test.datetimetester.TestDateTime('test_subclass_replace'), # TypeError: replace() got an unexpected keyword argument 'year'
test.datetimetester.TestDateTimeTZ('test_bad_constructor_arguments'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestDateTimeTZ('test_compat_unpickle'), # TypeError: function takes at least 3 arguments (2 given)
test.datetimetester.TestDateTimeTZ('test_isoformat'), # TypeError: isoformat() got an unexpected keyword argument 'timespec'
test.datetimetester.TestDateTimeTZ('test_subclass_replace'), # TypeError: replace() got an unexpected keyword argument 'year'
test.datetimetester.TestLocalTimeDisambiguation('test_comparison'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestLocalTimeDisambiguation('test_constructors'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestLocalTimeDisambiguation('test_dst'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestLocalTimeDisambiguation('test_fromtimestamp_low_fold_detection'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestLocalTimeDisambiguation('test_fromutc'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestLocalTimeDisambiguation('test_hash'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestLocalTimeDisambiguation('test_hash_aware'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestLocalTimeDisambiguation('test_member'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestLocalTimeDisambiguation('test_mixed_compare_fold'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestLocalTimeDisambiguation('test_mixed_compare_gap'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestLocalTimeDisambiguation('test_pickle_fold'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestLocalTimeDisambiguation('test_replace'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestLocalTimeDisambiguation('test_repr'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestLocalTimeDisambiguation('test_utcoffset'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestLocalTimeDisambiguation('test_vilnius_1941_fromutc'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestLocalTimeDisambiguation('test_vilnius_1941_toutc'), # AssertionError: '06/23/41 19:59:59 ' != 'Mon Jun 23 19:59:59 1941 UTC'
test.datetimetester.TestModule('test_divide_and_round'), # AttributeError: 'module' object has no attribute '_divide_and_round'
test.datetimetester.TestSubclassDateTime('test_bad_constructor_arguments'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.TestSubclassDateTime('test_combine'), # TypeError: combine() takes exactly 2 arguments (3 given)
test.datetimetester.TestSubclassDateTime('test_compat_unpickle'), # TypeError: function takes at least 3 arguments (1 given)
test.datetimetester.TestSubclassDateTime('test_isoformat'), # TypeError: isoformat() got an unexpected keyword argument 'timespec'
test.datetimetester.TestSubclassDateTime('test_subclass_replace'), # TypeError: replace() got an unexpected keyword argument 'year'
test.datetimetester.TestTime('test_backdoor_resistance'), # AssertionError: "^bad tzinfo state arg$" does not match "expected Int32, got bytes"
test.datetimetester.TestTime('test_compat_unpickle'), # TypeError: expected Int32, got str
test.datetimetester.TestTime('test_isoformat'), # TypeError: isoformat() takes no arguments (1 given)
test.datetimetester.TestTime('test_subclass_replace'), # AssertionError: <class '_datetime.time'> is not <class 'test.datetimetester.TimeSubclass'>
test.datetimetester.TestTimeDelta('test_issue31293'), # ZeroDivisionError: Attempted to divide by zero.
test.datetimetester.TestTimeTZ('test_backdoor_resistance'), # AssertionError: "^bad tzinfo state arg$" does not match "expected Int32, got bytes"
test.datetimetester.TestTimeTZ('test_compat_unpickle'), # TypeError: expected Int32, got str
test.datetimetester.TestTimeTZ('test_isoformat'), # TypeError: isoformat() takes no arguments (1 given)
test.datetimetester.TestTimeTZ('test_subclass_replace'), # AssertionError: <class '_datetime.time'> is not <class 'test.datetimetester.TimeSubclass'>
test.datetimetester.ZoneInfoTest('test_folds'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.ZoneInfoTest('test_gaps'), # https://github.com/IronLanguages/ironpython3/issues/1459
test.datetimetester.ZoneInfoTest('test_system_transitions'), # AttributeError: 'module' object has no attribute 'tzset'
]
skip_tests = []
if is_mono and is_arm64:
skip_tests += [
test.datetimetester.TestTimeDelta('test_overflow'), # rounding differences
]
if sys.version_info >= (3, 6):
skip_tests += [
# these can fail with a ValueError if the current time zone is not UTC
test.datetimetester.TestDateTime('test_timestamp_limits'), # ValueError: The added or subtracted value results in an un-representable DateTime.
test.datetimetester.TestDateTimeTZ('test_timestamp_limits'), # ValueError: The added or subtracted value results in an un-representable DateTime.
test.datetimetester.TestSubclassDateTime('test_timestamp_limits'), # ValueError: The added or subtracted value results in an un-representable DateTime.
]
for test_or_suite in tests:
if isinstance(test_or_suite, test.datetimetester.ZoneInfoCompleteTest):
for t in test_or_suite:
skip_tests.append(t)
return generate_suite(tests, failing_tests, skip_tests)
else:
return tests
run_test(__name__)