-
Notifications
You must be signed in to change notification settings - Fork 311
Expand file tree
/
Copy pathtest_functools_stdlib.py
More file actions
66 lines (57 loc) · 5.1 KB
/
test_functools_stdlib.py
File metadata and controls
66 lines (57 loc) · 5.1 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
# 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_functools from StdLib
##
from iptest import is_ironpython, generate_suite, run_test, is_mono
import test.test_functools
def load_tests(loader, standard_tests, pattern):
tests = loader.loadTestsFromModule(test.test_functools, pattern=pattern)
if is_ironpython:
failing_tests = [
test.test_functools.TestCmpToKeyC('test_bad_cmp'), # TypeError: cmp_to_key() takes exactly 1 argument (2 given)
test.test_functools.TestCmpToKeyC('test_cmp_to_key'), # TypeError: cmp_to_key() takes exactly 1 argument (2 given)
test.test_functools.TestCmpToKeyC('test_cmp_to_key_arguments'), # TypeError: cmp_to_key() takes exactly 1 argument (2 given)
test.test_functools.TestCmpToKeyC('test_hash'), # TypeError: cmp_to_key() takes exactly 1 argument (2 given)
test.test_functools.TestCmpToKeyC('test_obj_field'), # TypeError: cmp_to_key() takes exactly 1 argument (2 given)
test.test_functools.TestCmpToKeyC('test_sort_int'), # TypeError: cmp_to_key() takes exactly 1 argument (2 given)
test.test_functools.TestCmpToKeyC('test_sort_int_str'), # TypeError: cmp_to_key() takes exactly 1 argument (2 given)
test.test_functools.TestLRUC('test_lru_cache_threaded'), # unittest.expectedFailure(
test.test_functools.TestLRUC('test_pickle'), # pickle.PicklingError: Can't pickle
test.test_functools.TestLRUPy('test_lru_cache_threaded'), # AttributeError: 'module' object has no attribute 'getswitchinterval'
test.test_functools.TestLRUPy('test_pickle'), # pickle.PicklingError: Can't pickle
test.test_functools.TestPartialC('test_copy'), # AssertionError: (['asdf'],) is not (['asdf'],)
test.test_functools.TestPartialC('test_keystr_replaces_value'), # AssertionError: 'astr' not found in '<CPartialSubclass object at 0x00000000000000A8>'
test.test_functools.TestPartialC('test_nested_optimization'), # AssertionError: Tuples differ: (<partial object at 0x0000000000000066>, (), {'bar': True}, {}) != (<function signature at 0x0000000000000051>, ('asdf',), {'bar': True}, {})
test.test_functools.TestPartialC('test_setstate'), # AssertionError: Tuples differ: (<function capture at 0x000000000000008D>, (1,), {'a': 10}, {'attr': []}) != (<function capture at 0x000000000000008D>, (1,), {'a': 10}, {})
test.test_functools.TestPartialC('test_setstate_subclasses'), # AssertionError: <class 'test.test_functools.MyDict'> is not <class 'dict'>
test.test_functools.TestPartialCSubclass('test_attributes_unwritable'), # AssertionError: AttributeError not raised by setattr
test.test_functools.TestPartialCSubclass('test_copy'), # AttributeError: 'partial' object has no attribute 'attr'
test.test_functools.TestPartialCSubclass('test_deepcopy'), # AttributeError: 'partial' object has no attribute 'attr'
test.test_functools.TestPartialCSubclass('test_keystr_replaces_value'), # AssertionError: 'astr' not found in '<CPartialSubclass object at 0x00000000000000A8>'
test.test_functools.TestPartialCSubclass('test_recursive_repr'), # AssertionError: 'functools.partial(...)' != 'CPartialSubclass(...)'
test.test_functools.TestPartialCSubclass('test_repr'), # AssertionError
test.test_functools.TestPartialCSubclass('test_setstate'), # AssertionError: Tuples differ: (<function capture at 0x000000000000008D>, (1,), {'a': 10}, {'attr': []}) != (<function capture at 0x000000000000008D>, (1,), {'a': 10}, {})
test.test_functools.TestPartialCSubclass('test_setstate_subclasses'), # AssertionError: <class 'test.test_functools.MyDict'> is not <class 'dict'>
test.test_functools.TestTotalOrdering('test_pickle'), # pickle.PicklingError: Can't pickle
]
skip_tests = [
test.test_functools.TestLRUC('test_lru_cache_threaded2'), # intermittent failures
test.test_functools.TestLRUC('test_lru_cache_threaded3'), # intermittent failures
test.test_functools.TestLRUPy('test_lru_cache_threaded2'), # intermittent failures
test.test_functools.TestLRUPy('test_lru_cache_threaded3'), # intermittent failures
test.test_functools.TestPartialC('test_recursive_pickle'), # StackOverflowException
test.test_functools.TestPartialCSubclass('test_recursive_pickle'), # StackOverflowException
test.test_functools.TestPartialPy('test_recursive_pickle'), # # StackOverflowException
test.test_functools.TestPartialPySubclass('test_recursive_pickle'), # StackOverflowException
]
if is_mono:
skip_tests += [
test.test_functools.TestPartialCSubclass('test_weakref'),
test.test_functools.TestPartialPy('test_weakref'),
]
return generate_suite(tests, failing_tests, skip_tests)
else:
return tests
run_test(__name__)