Mercurial > cpython-lru_cache-weakref
annotate Lib/test/test_py3kwarn.py @ 54294:dba767bc3155 legacy-trunk
remove mention of old ctypes version
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Sat, 23 May 2009 20:59:09 +0000 |
| parents | 228cfb6e2900 |
| children | 6768b2350c57 |
| rev | line source |
|---|---|
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
1 import unittest |
|
45926
3bf19c31c956
Use sys.py3kwarning instead of trying to trigger a Py3k-related warning.
Brett Cannon <bcannon@gmail.com>
parents:
45899
diff
changeset
|
2 import sys |
|
52355
228cfb6e2900
fix incorrect auto-translation of TestSkipped -> unittest.SkipTest
Benjamin Peterson <benjamin@python.org>
parents:
52353
diff
changeset
|
3 from test.test_support import check_warnings, CleanImport, run_unittest |
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
4 import warnings |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
5 |
|
47958
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
6 from contextlib import nested |
|
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
7 |
|
45926
3bf19c31c956
Use sys.py3kwarning instead of trying to trigger a Py3k-related warning.
Brett Cannon <bcannon@gmail.com>
parents:
45899
diff
changeset
|
8 if not sys.py3kwarning: |
|
52355
228cfb6e2900
fix incorrect auto-translation of TestSkipped -> unittest.SkipTest
Benjamin Peterson <benjamin@python.org>
parents:
52353
diff
changeset
|
9 raise unittest.SkipTest('%s must be run with the -3 flag' % __name__) |
|
45926
3bf19c31c956
Use sys.py3kwarning instead of trying to trigger a Py3k-related warning.
Brett Cannon <bcannon@gmail.com>
parents:
45899
diff
changeset
|
10 |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
11 def reset_module_registry(module): |
|
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
12 try: |
|
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
13 registry = module.__warningregistry__ |
|
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
14 except AttributeError: |
|
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
15 pass |
|
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
16 else: |
|
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
17 registry.clear() |
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
18 |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
19 class TestPy3KWarnings(unittest.TestCase): |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
20 |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
21 def assertWarning(self, _, warning, expected_message): |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
22 self.assertEqual(str(warning.message), expected_message) |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
23 |
|
47516
f3df51b60dc2
change Py3k backquote warning to a SyntaxWarning and add a test
Benjamin Peterson <benjamin@python.org>
parents:
47433
diff
changeset
|
24 def test_backquote(self): |
|
f3df51b60dc2
change Py3k backquote warning to a SyntaxWarning and add a test
Benjamin Peterson <benjamin@python.org>
parents:
47433
diff
changeset
|
25 expected = 'backquote not supported in 3.x; use repr()' |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
26 with check_warnings() as w: |
|
47516
f3df51b60dc2
change Py3k backquote warning to a SyntaxWarning and add a test
Benjamin Peterson <benjamin@python.org>
parents:
47433
diff
changeset
|
27 exec "`2`" in {} |
|
f3df51b60dc2
change Py3k backquote warning to a SyntaxWarning and add a test
Benjamin Peterson <benjamin@python.org>
parents:
47433
diff
changeset
|
28 self.assertWarning(None, w, expected) |
|
f3df51b60dc2
change Py3k backquote warning to a SyntaxWarning and add a test
Benjamin Peterson <benjamin@python.org>
parents:
47433
diff
changeset
|
29 |
|
49584
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
30 def test_forbidden_names(self): |
|
47523
d56450db60a2
Warn about assigning to Py3k keywords (True and False)
Benjamin Peterson <benjamin@python.org>
parents:
47516
diff
changeset
|
31 # So we don't screw up our globals |
|
d56450db60a2
Warn about assigning to Py3k keywords (True and False)
Benjamin Peterson <benjamin@python.org>
parents:
47516
diff
changeset
|
32 def safe_exec(expr): |
|
d56450db60a2
Warn about assigning to Py3k keywords (True and False)
Benjamin Peterson <benjamin@python.org>
parents:
47516
diff
changeset
|
33 def f(**kwargs): pass |
|
d56450db60a2
Warn about assigning to Py3k keywords (True and False)
Benjamin Peterson <benjamin@python.org>
parents:
47516
diff
changeset
|
34 exec expr in {'f' : f} |
|
d56450db60a2
Warn about assigning to Py3k keywords (True and False)
Benjamin Peterson <benjamin@python.org>
parents:
47516
diff
changeset
|
35 |
|
49584
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
36 tests = [("True", "assignment to True or False is forbidden in 3.x"), |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
37 ("False", "assignment to True or False is forbidden in 3.x"), |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
38 ("nonlocal", "nonlocal is a keyword in 3.x")] |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
39 with check_warnings() as w: |
|
49584
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
40 for keyword, expected in tests: |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
41 safe_exec("{0} = False".format(keyword)) |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
42 self.assertWarning(None, w, expected) |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
43 w.reset() |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
44 try: |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
45 safe_exec("obj.{0} = True".format(keyword)) |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
46 except NameError: |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
47 pass |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
48 self.assertWarning(None, w, expected) |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
49 w.reset() |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
50 safe_exec("def {0}(): pass".format(keyword)) |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
51 self.assertWarning(None, w, expected) |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
52 w.reset() |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
53 safe_exec("class {0}: pass".format(keyword)) |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
54 self.assertWarning(None, w, expected) |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
55 w.reset() |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
56 safe_exec("def f({0}=43): pass".format(keyword)) |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
57 self.assertWarning(None, w, expected) |
|
6634530a04e0
give a py3k warning when 'nonlocal' is used as a variable name
Benjamin Peterson <benjamin@python.org>
parents:
49146
diff
changeset
|
58 w.reset() |
|
47523
d56450db60a2
Warn about assigning to Py3k keywords (True and False)
Benjamin Peterson <benjamin@python.org>
parents:
47516
diff
changeset
|
59 |
|
d56450db60a2
Warn about assigning to Py3k keywords (True and False)
Benjamin Peterson <benjamin@python.org>
parents:
47516
diff
changeset
|
60 |
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
61 def test_type_inequality_comparisons(self): |
|
46075
84bb7701efba
Make Py3k warnings consistent w.r.t. punctuation; also respect the
Georg Brandl <georg@python.org>
parents:
46074
diff
changeset
|
62 expected = 'type inequality comparisons not supported in 3.x' |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
63 with check_warnings() as w: |
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
64 self.assertWarning(int < str, w, expected) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
65 w.reset() |
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
66 self.assertWarning(type < object, w, expected) |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
67 |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
68 def test_object_inequality_comparisons(self): |
|
46075
84bb7701efba
Make Py3k warnings consistent w.r.t. punctuation; also respect the
Georg Brandl <georg@python.org>
parents:
46074
diff
changeset
|
69 expected = 'comparing unequal types not supported in 3.x' |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
70 with check_warnings() as w: |
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
71 self.assertWarning(str < [], w, expected) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
72 w.reset() |
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
73 self.assertWarning(object() < (1, 2), w, expected) |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
74 |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
75 def test_dict_inequality_comparisons(self): |
|
46075
84bb7701efba
Make Py3k warnings consistent w.r.t. punctuation; also respect the
Georg Brandl <georg@python.org>
parents:
46074
diff
changeset
|
76 expected = 'dict inequality comparisons not supported in 3.x' |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
77 with check_warnings() as w: |
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
78 self.assertWarning({} < {2:3}, w, expected) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
79 w.reset() |
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
80 self.assertWarning({} <= {}, w, expected) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
81 w.reset() |
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
82 self.assertWarning({} > {2:3}, w, expected) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
83 w.reset() |
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
84 self.assertWarning({2:3} >= {}, w, expected) |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
85 |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
86 def test_cell_inequality_comparisons(self): |
|
46075
84bb7701efba
Make Py3k warnings consistent w.r.t. punctuation; also respect the
Georg Brandl <georg@python.org>
parents:
46074
diff
changeset
|
87 expected = 'cell comparisons not supported in 3.x' |
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
88 def f(x): |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
89 def g(): |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
90 return x |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
91 return g |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
92 cell0, = f(0).func_closure |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
93 cell1, = f(1).func_closure |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
94 with check_warnings() as w: |
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
95 self.assertWarning(cell0 == cell1, w, expected) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
96 w.reset() |
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
97 self.assertWarning(cell0 < cell1, w, expected) |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
98 |
|
45885
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
99 def test_code_inequality_comparisons(self): |
|
46075
84bb7701efba
Make Py3k warnings consistent w.r.t. punctuation; also respect the
Georg Brandl <georg@python.org>
parents:
46074
diff
changeset
|
100 expected = 'code inequality comparisons not supported in 3.x' |
|
45885
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
101 def f(x): |
|
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
102 pass |
|
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
103 def g(x): |
|
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
104 pass |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
105 with check_warnings() as w: |
|
45885
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
106 self.assertWarning(f.func_code < g.func_code, w, expected) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
107 w.reset() |
|
45885
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
108 self.assertWarning(f.func_code <= g.func_code, w, expected) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
109 w.reset() |
|
45885
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
110 self.assertWarning(f.func_code >= g.func_code, w, expected) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
111 w.reset() |
|
45885
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
112 self.assertWarning(f.func_code > g.func_code, w, expected) |
|
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
113 |
|
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
114 def test_builtin_function_or_method_comparisons(self): |
|
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
115 expected = ('builtin_function_or_method ' |
|
46075
84bb7701efba
Make Py3k warnings consistent w.r.t. punctuation; also respect the
Georg Brandl <georg@python.org>
parents:
46074
diff
changeset
|
116 'inequality comparisons not supported in 3.x') |
|
45885
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
117 func = eval |
|
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
118 meth = {}.get |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
119 with check_warnings() as w: |
|
45885
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
120 self.assertWarning(func < meth, w, expected) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
121 w.reset() |
|
45885
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
122 self.assertWarning(func > meth, w, expected) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
123 w.reset() |
|
45885
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
124 self.assertWarning(meth <= func, w, expected) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
125 w.reset() |
|
45885
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
126 self.assertWarning(meth >= func, w, expected) |
|
860e23a61e55
Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code.
Steven Bethard <steven.bethard@gmail.com>
parents:
45860
diff
changeset
|
127 |
|
50259
d79fdd8420f3
add py3k warnings to frame.f_exc_*
Benjamin Peterson <benjamin@python.org>
parents:
49584
diff
changeset
|
128 def test_frame_attributes(self): |
|
d79fdd8420f3
add py3k warnings to frame.f_exc_*
Benjamin Peterson <benjamin@python.org>
parents:
49584
diff
changeset
|
129 template = "%s has been removed in 3.x" |
|
d79fdd8420f3
add py3k warnings to frame.f_exc_*
Benjamin Peterson <benjamin@python.org>
parents:
49584
diff
changeset
|
130 f = sys._getframe(0) |
|
d79fdd8420f3
add py3k warnings to frame.f_exc_*
Benjamin Peterson <benjamin@python.org>
parents:
49584
diff
changeset
|
131 for attr in ("f_exc_traceback", "f_exc_value", "f_exc_type"): |
|
d79fdd8420f3
add py3k warnings to frame.f_exc_*
Benjamin Peterson <benjamin@python.org>
parents:
49584
diff
changeset
|
132 expected = template % attr |
|
d79fdd8420f3
add py3k warnings to frame.f_exc_*
Benjamin Peterson <benjamin@python.org>
parents:
49584
diff
changeset
|
133 with check_warnings() as w: |
|
d79fdd8420f3
add py3k warnings to frame.f_exc_*
Benjamin Peterson <benjamin@python.org>
parents:
49584
diff
changeset
|
134 self.assertWarning(getattr(f, attr), w, expected) |
|
d79fdd8420f3
add py3k warnings to frame.f_exc_*
Benjamin Peterson <benjamin@python.org>
parents:
49584
diff
changeset
|
135 w.reset() |
|
d79fdd8420f3
add py3k warnings to frame.f_exc_*
Benjamin Peterson <benjamin@python.org>
parents:
49584
diff
changeset
|
136 self.assertWarning(setattr(f, attr, None), w, expected) |
|
d79fdd8420f3
add py3k warnings to frame.f_exc_*
Benjamin Peterson <benjamin@python.org>
parents:
49584
diff
changeset
|
137 |
|
45927
dc5be0b3c3be
Issue 2354: Fix-up compare warning. Patch contributed by Jeff Balogh.
Raymond Hettinger <python@rcn.com>
parents:
45926
diff
changeset
|
138 def test_sort_cmp_arg(self): |
|
46075
84bb7701efba
Make Py3k warnings consistent w.r.t. punctuation; also respect the
Georg Brandl <georg@python.org>
parents:
46074
diff
changeset
|
139 expected = "the cmp argument is not supported in 3.x" |
|
45927
dc5be0b3c3be
Issue 2354: Fix-up compare warning. Patch contributed by Jeff Balogh.
Raymond Hettinger <python@rcn.com>
parents:
45926
diff
changeset
|
140 lst = range(5) |
|
dc5be0b3c3be
Issue 2354: Fix-up compare warning. Patch contributed by Jeff Balogh.
Raymond Hettinger <python@rcn.com>
parents:
45926
diff
changeset
|
141 cmp = lambda x,y: -1 |
|
dc5be0b3c3be
Issue 2354: Fix-up compare warning. Patch contributed by Jeff Balogh.
Raymond Hettinger <python@rcn.com>
parents:
45926
diff
changeset
|
142 |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
143 with check_warnings() as w: |
|
45927
dc5be0b3c3be
Issue 2354: Fix-up compare warning. Patch contributed by Jeff Balogh.
Raymond Hettinger <python@rcn.com>
parents:
45926
diff
changeset
|
144 self.assertWarning(lst.sort(cmp=cmp), w, expected) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
145 w.reset() |
|
45927
dc5be0b3c3be
Issue 2354: Fix-up compare warning. Patch contributed by Jeff Balogh.
Raymond Hettinger <python@rcn.com>
parents:
45926
diff
changeset
|
146 self.assertWarning(sorted(lst, cmp=cmp), w, expected) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
147 w.reset() |
|
45927
dc5be0b3c3be
Issue 2354: Fix-up compare warning. Patch contributed by Jeff Balogh.
Raymond Hettinger <python@rcn.com>
parents:
45926
diff
changeset
|
148 self.assertWarning(lst.sort(cmp), w, expected) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
149 w.reset() |
|
45927
dc5be0b3c3be
Issue 2354: Fix-up compare warning. Patch contributed by Jeff Balogh.
Raymond Hettinger <python@rcn.com>
parents:
45926
diff
changeset
|
150 self.assertWarning(sorted(lst, cmp), w, expected) |
|
dc5be0b3c3be
Issue 2354: Fix-up compare warning. Patch contributed by Jeff Balogh.
Raymond Hettinger <python@rcn.com>
parents:
45926
diff
changeset
|
151 |
|
45983
99355baa748d
#2358: add py3k warning to sys.exc_clear().
Georg Brandl <georg@python.org>
parents:
45928
diff
changeset
|
152 def test_sys_exc_clear(self): |
|
46075
84bb7701efba
Make Py3k warnings consistent w.r.t. punctuation; also respect the
Georg Brandl <georg@python.org>
parents:
46074
diff
changeset
|
153 expected = 'sys.exc_clear() not supported in 3.x; use except clauses' |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
154 with check_warnings() as w: |
|
45983
99355baa748d
#2358: add py3k warning to sys.exc_clear().
Georg Brandl <georg@python.org>
parents:
45928
diff
changeset
|
155 self.assertWarning(sys.exc_clear(), w, expected) |
|
99355baa748d
#2358: add py3k warning to sys.exc_clear().
Georg Brandl <georg@python.org>
parents:
45928
diff
changeset
|
156 |
|
45984
2275612c16a9
#2346/#2347: add py3k warning for __methods__ and __members__. Patch by Jack Diederich.
Georg Brandl <georg@python.org>
parents:
45983
diff
changeset
|
157 def test_methods_members(self): |
|
2275612c16a9
#2346/#2347: add py3k warning for __methods__ and __members__. Patch by Jack Diederich.
Georg Brandl <georg@python.org>
parents:
45983
diff
changeset
|
158 expected = '__members__ and __methods__ not supported in 3.x' |
|
2275612c16a9
#2346/#2347: add py3k warning for __methods__ and __members__. Patch by Jack Diederich.
Georg Brandl <georg@python.org>
parents:
45983
diff
changeset
|
159 class C: |
|
2275612c16a9
#2346/#2347: add py3k warning for __methods__ and __members__. Patch by Jack Diederich.
Georg Brandl <georg@python.org>
parents:
45983
diff
changeset
|
160 __methods__ = ['a'] |
|
2275612c16a9
#2346/#2347: add py3k warning for __methods__ and __members__. Patch by Jack Diederich.
Georg Brandl <georg@python.org>
parents:
45983
diff
changeset
|
161 __members__ = ['b'] |
|
2275612c16a9
#2346/#2347: add py3k warning for __methods__ and __members__. Patch by Jack Diederich.
Georg Brandl <georg@python.org>
parents:
45983
diff
changeset
|
162 c = C() |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
163 with check_warnings() as w: |
|
45984
2275612c16a9
#2346/#2347: add py3k warning for __methods__ and __members__. Patch by Jack Diederich.
Georg Brandl <georg@python.org>
parents:
45983
diff
changeset
|
164 self.assertWarning(dir(c), w, expected) |
|
2275612c16a9
#2346/#2347: add py3k warning for __methods__ and __members__. Patch by Jack Diederich.
Georg Brandl <georg@python.org>
parents:
45983
diff
changeset
|
165 |
|
45985
bf07bad1d72f
#2348: add py3k warning for file.softspace.
Georg Brandl <georg@python.org>
parents:
45984
diff
changeset
|
166 def test_softspace(self): |
|
bf07bad1d72f
#2348: add py3k warning for file.softspace.
Georg Brandl <georg@python.org>
parents:
45984
diff
changeset
|
167 expected = 'file.softspace not supported in 3.x' |
|
bf07bad1d72f
#2348: add py3k warning for file.softspace.
Georg Brandl <georg@python.org>
parents:
45984
diff
changeset
|
168 with file(__file__) as f: |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
169 with check_warnings() as w: |
|
45985
bf07bad1d72f
#2348: add py3k warning for file.softspace.
Georg Brandl <georg@python.org>
parents:
45984
diff
changeset
|
170 self.assertWarning(f.softspace, w, expected) |
|
bf07bad1d72f
#2348: add py3k warning for file.softspace.
Georg Brandl <georg@python.org>
parents:
45984
diff
changeset
|
171 def set(): |
|
bf07bad1d72f
#2348: add py3k warning for file.softspace.
Georg Brandl <georg@python.org>
parents:
45984
diff
changeset
|
172 f.softspace = 0 |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
173 with check_warnings() as w: |
|
45985
bf07bad1d72f
#2348: add py3k warning for file.softspace.
Georg Brandl <georg@python.org>
parents:
45984
diff
changeset
|
174 self.assertWarning(set(), w, expected) |
|
bf07bad1d72f
#2348: add py3k warning for file.softspace.
Georg Brandl <georg@python.org>
parents:
45984
diff
changeset
|
175 |
|
48854
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
176 def test_slice_methods(self): |
|
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
177 class Spam(object): |
|
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
178 def __getslice__(self, i, j): pass |
|
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
179 def __setslice__(self, i, j, what): pass |
|
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
180 def __delslice__(self, i, j): pass |
|
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
181 class Egg: |
|
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
182 def __getslice__(self, i, h): pass |
|
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
183 def __setslice__(self, i, j, what): pass |
|
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
184 def __delslice__(self, i, j): pass |
|
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
185 |
|
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
186 expected = "in 3.x, __{0}slice__ has been removed; use __{0}item__" |
|
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
187 |
|
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
188 for obj in (Spam(), Egg()): |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
189 with check_warnings() as w: |
|
48854
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
190 self.assertWarning(obj[1:2], w, expected.format('get')) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
191 w.reset() |
|
48854
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
192 del obj[3:4] |
|
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
193 self.assertWarning(None, w, expected.format('del')) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
194 w.reset() |
|
48854
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
195 obj[4:5] = "eggs" |
|
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
196 self.assertWarning(None, w, expected.format('set')) |
|
6ea1a720b057
generate py3k warnings on __getslice__, __delslice__, and __setslice__
Benjamin Peterson <benjamin@python.org>
parents:
48295
diff
changeset
|
197 |
|
47524
53253f36014e
warn about parameter tuple unpacking
Benjamin Peterson <benjamin@python.org>
parents:
47523
diff
changeset
|
198 def test_tuple_parameter_unpacking(self): |
|
53253f36014e
warn about parameter tuple unpacking
Benjamin Peterson <benjamin@python.org>
parents:
47523
diff
changeset
|
199 expected = "tuple parameter unpacking has been removed in 3.x" |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
200 with check_warnings() as w: |
|
47524
53253f36014e
warn about parameter tuple unpacking
Benjamin Peterson <benjamin@python.org>
parents:
47523
diff
changeset
|
201 exec "def f((a, b)): pass" |
|
53253f36014e
warn about parameter tuple unpacking
Benjamin Peterson <benjamin@python.org>
parents:
47523
diff
changeset
|
202 self.assertWarning(None, w, expected) |
|
53253f36014e
warn about parameter tuple unpacking
Benjamin Peterson <benjamin@python.org>
parents:
47523
diff
changeset
|
203 |
|
46074
9b3f0fa5d8ca
#2355: py3k warning for buffer().
Georg Brandl <georg@python.org>
parents:
45985
diff
changeset
|
204 def test_buffer(self): |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
205 expected = 'buffer() not supported in 3.x' |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
206 with check_warnings() as w: |
|
46074
9b3f0fa5d8ca
#2355: py3k warning for buffer().
Georg Brandl <georg@python.org>
parents:
45985
diff
changeset
|
207 self.assertWarning(buffer('a'), w, expected) |
|
9b3f0fa5d8ca
#2355: py3k warning for buffer().
Georg Brandl <georg@python.org>
parents:
45985
diff
changeset
|
208 |
|
47148
3d5cddc6e5e7
#2353: raise Py3k warning in file.xreadlines().
Georg Brandl <georg@python.org>
parents:
47141
diff
changeset
|
209 def test_file_xreadlines(self): |
|
3d5cddc6e5e7
#2353: raise Py3k warning in file.xreadlines().
Georg Brandl <georg@python.org>
parents:
47141
diff
changeset
|
210 expected = ("f.xreadlines() not supported in 3.x, " |
|
3d5cddc6e5e7
#2353: raise Py3k warning in file.xreadlines().
Georg Brandl <georg@python.org>
parents:
47141
diff
changeset
|
211 "try 'for line in f' instead") |
|
3d5cddc6e5e7
#2353: raise Py3k warning in file.xreadlines().
Georg Brandl <georg@python.org>
parents:
47141
diff
changeset
|
212 with file(__file__) as f: |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
213 with check_warnings() as w: |
|
47148
3d5cddc6e5e7
#2353: raise Py3k warning in file.xreadlines().
Georg Brandl <georg@python.org>
parents:
47141
diff
changeset
|
214 self.assertWarning(f.xreadlines(), w, expected) |
|
3d5cddc6e5e7
#2353: raise Py3k warning in file.xreadlines().
Georg Brandl <georg@python.org>
parents:
47141
diff
changeset
|
215 |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
216 def test_hash_inheritance(self): |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
217 with check_warnings() as w: |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
218 # With object as the base class |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
219 class WarnOnlyCmp(object): |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
220 def __cmp__(self, other): pass |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
221 self.assertEqual(len(w.warnings), 1) |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
222 self.assertWarning(None, w, |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
223 "Overriding __cmp__ blocks inheritance of __hash__ in 3.x") |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
224 w.reset() |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
225 class WarnOnlyEq(object): |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
226 def __eq__(self, other): pass |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
227 self.assertEqual(len(w.warnings), 1) |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
228 self.assertWarning(None, w, |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
229 "Overriding __eq__ blocks inheritance of __hash__ in 3.x") |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
230 w.reset() |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
231 class WarnCmpAndEq(object): |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
232 def __cmp__(self, other): pass |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
233 def __eq__(self, other): pass |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
234 self.assertEqual(len(w.warnings), 2) |
|
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
235 self.assertWarning(None, w.warnings[0], |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
236 "Overriding __cmp__ blocks inheritance of __hash__ in 3.x") |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
237 self.assertWarning(None, w, |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
238 "Overriding __eq__ blocks inheritance of __hash__ in 3.x") |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
239 w.reset() |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
240 class NoWarningOnlyHash(object): |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
241 def __hash__(self): pass |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
242 self.assertEqual(len(w.warnings), 0) |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
243 # With an intermediate class in the heirarchy |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
244 class DefinesAllThree(object): |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
245 def __cmp__(self, other): pass |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
246 def __eq__(self, other): pass |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
247 def __hash__(self): pass |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
248 class WarnOnlyCmp(DefinesAllThree): |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
249 def __cmp__(self, other): pass |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
250 self.assertEqual(len(w.warnings), 1) |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
251 self.assertWarning(None, w, |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
252 "Overriding __cmp__ blocks inheritance of __hash__ in 3.x") |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
253 w.reset() |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
254 class WarnOnlyEq(DefinesAllThree): |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
255 def __eq__(self, other): pass |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
256 self.assertEqual(len(w.warnings), 1) |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
257 self.assertWarning(None, w, |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
258 "Overriding __eq__ blocks inheritance of __hash__ in 3.x") |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
259 w.reset() |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
260 class WarnCmpAndEq(DefinesAllThree): |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
261 def __cmp__(self, other): pass |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
262 def __eq__(self, other): pass |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
263 self.assertEqual(len(w.warnings), 2) |
|
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
264 self.assertWarning(None, w.warnings[0], |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
265 "Overriding __cmp__ blocks inheritance of __hash__ in 3.x") |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
266 self.assertWarning(None, w, |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
267 "Overriding __eq__ blocks inheritance of __hash__ in 3.x") |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
268 w.reset() |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
269 class NoWarningOnlyHash(DefinesAllThree): |
|
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
270 def __hash__(self): pass |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
271 self.assertEqual(len(w.warnings), 0) |
|
48213
7527da2b05e8
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
Nick Coghlan <ncoghlan@gmail.com>
parents:
48020
diff
changeset
|
272 |
|
45984
2275612c16a9
#2346/#2347: add py3k warning for __methods__ and __members__. Patch by Jack Diederich.
Georg Brandl <georg@python.org>
parents:
45983
diff
changeset
|
273 |
|
46702
ffdb5f4139fe
Deprecate the audiodev module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46075
diff
changeset
|
274 class TestStdlibRemovals(unittest.TestCase): |
|
ffdb5f4139fe
Deprecate the audiodev module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46075
diff
changeset
|
275 |
|
46777
946fbae4baab
Deprecate test.testall for removal in 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46775
diff
changeset
|
276 # test.testall not tested as it executes all unit tests as an |
|
946fbae4baab
Deprecate test.testall for removal in 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46775
diff
changeset
|
277 # import side-effect. |
|
46811
5679ce66e74b
Deprecate Bastion and rexec for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46807
diff
changeset
|
278 all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new', 'rexec', |
|
48020
f9040d107d66
Deprecate the sunaudio module for removal in Python 3.0. The sunau module can provide similar functionality.
Brett Cannon <bcannon@gmail.com>
parents:
47958
diff
changeset
|
279 'Bastion', 'compiler', 'dircache', 'mimetools', |
|
f9040d107d66
Deprecate the sunaudio module for removal in Python 3.0. The sunau module can provide similar functionality.
Brett Cannon <bcannon@gmail.com>
parents:
47958
diff
changeset
|
280 'fpformat', 'ihooks', 'mhlib', 'statvfs', 'htmllib', |
|
f9040d107d66
Deprecate the sunaudio module for removal in Python 3.0. The sunau module can provide similar functionality.
Brett Cannon <bcannon@gmail.com>
parents:
47958
diff
changeset
|
281 'sgmllib', 'rfc822', 'sunaudio') |
|
47000
f2c4ab74cc65
Deprecate the cdplayer module for IRIX for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46997
diff
changeset
|
282 inclusive_platforms = {'irix' : ('pure', 'AL', 'al', 'CD', 'cd', 'cddb', |
|
47017
f0a47091c8d8
Deprecate DEVICE, GL, gl, and the related modules cgen and cgensupport for removal in 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
47006
diff
changeset
|
283 'cdplayer', 'CL', 'cl', 'DEVICE', 'GL', |
|
47025
62d9ec9c9efd
Deprecated 'fm' for removal in 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
47023
diff
changeset
|
284 'gl', 'ERRNO', 'FILE', 'FL', 'flp', 'fl', |
|
47034
bada0e871ac1
Deprecate IOCTL from IRIX for removal in 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
47032
diff
changeset
|
285 'fm', 'GET', 'GLWS', 'imgfile', 'IN', |
|
47042
80435bc7aac4
Deprecate readcd for removal in 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
47038
diff
changeset
|
286 'IOCTL', 'jpeg', 'panel', 'panelparser', |
|
47048
ed532ca7ae75
Deprecate WAIT for removal in 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
47046
diff
changeset
|
287 'readcd', 'SV', 'torgb', 'WAIT'), |
|
46967
6df0394abbf1
Add warnings to and deprecated all those Mac modules
Benjamin Peterson <benjamin@python.org>
parents:
46936
diff
changeset
|
288 'darwin' : ('autoGIL', 'Carbon', 'OSATerminology', |
|
46988
49038ee0e5b5
Rewrap some lines in test_py3kwarn.
Brett Cannon <bcannon@gmail.com>
parents:
46987
diff
changeset
|
289 'icglue', 'Nav', 'MacOS', 'aepack', |
|
49038ee0e5b5
Rewrap some lines in test_py3kwarn.
Brett Cannon <bcannon@gmail.com>
parents:
46987
diff
changeset
|
290 'aetools', 'aetypes', 'applesingle', |
|
49038ee0e5b5
Rewrap some lines in test_py3kwarn.
Brett Cannon <bcannon@gmail.com>
parents:
46987
diff
changeset
|
291 'appletrawmain', 'appletrunner', |
|
49038ee0e5b5
Rewrap some lines in test_py3kwarn.
Brett Cannon <bcannon@gmail.com>
parents:
46987
diff
changeset
|
292 'argvemulator', 'bgenlocations', |
|
46967
6df0394abbf1
Add warnings to and deprecated all those Mac modules
Benjamin Peterson <benjamin@python.org>
parents:
46936
diff
changeset
|
293 'EasyDialogs', 'macerrors', 'macostools', |
|
6df0394abbf1
Add warnings to and deprecated all those Mac modules
Benjamin Peterson <benjamin@python.org>
parents:
46936
diff
changeset
|
294 'findertools', 'FrameWork', 'ic', |
|
6df0394abbf1
Add warnings to and deprecated all those Mac modules
Benjamin Peterson <benjamin@python.org>
parents:
46936
diff
changeset
|
295 'gensuitemodule', 'icopen', 'macresource', |
|
6df0394abbf1
Add warnings to and deprecated all those Mac modules
Benjamin Peterson <benjamin@python.org>
parents:
46936
diff
changeset
|
296 'MiniAEFrame', 'pimp', 'PixMapWrapper', |
|
46988
49038ee0e5b5
Rewrap some lines in test_py3kwarn.
Brett Cannon <bcannon@gmail.com>
parents:
46987
diff
changeset
|
297 'terminalcommand', 'videoreader', |
|
49038ee0e5b5
Rewrap some lines in test_py3kwarn.
Brett Cannon <bcannon@gmail.com>
parents:
46987
diff
changeset
|
298 '_builtinSuites', 'CodeWarrior', |
|
49038ee0e5b5
Rewrap some lines in test_py3kwarn.
Brett Cannon <bcannon@gmail.com>
parents:
46987
diff
changeset
|
299 'Explorer', 'Finder', 'Netscape', |
|
49038ee0e5b5
Rewrap some lines in test_py3kwarn.
Brett Cannon <bcannon@gmail.com>
parents:
46987
diff
changeset
|
300 'StdSuites', 'SystemEvents', 'Terminal', |
|
49038ee0e5b5
Rewrap some lines in test_py3kwarn.
Brett Cannon <bcannon@gmail.com>
parents:
46987
diff
changeset
|
301 'cfmfile', 'bundlebuilder', 'buildtools', |
|
47958
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
302 'ColorPicker', 'Audio_mac'), |
|
47068
ae16e94bb03a
Deprecate sunaudiodev/SUNAUDIODEV for removal in 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
47048
diff
changeset
|
303 'sunos5' : ('sunaudiodev', 'SUNAUDIODEV'), |
|
ae16e94bb03a
Deprecate sunaudiodev/SUNAUDIODEV for removal in 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
47048
diff
changeset
|
304 } |
|
46936
799321e7e7bb
Deprecate the sv module as per PEP 4.
Brett Cannon <bcannon@gmail.com>
parents:
46928
diff
changeset
|
305 optional_modules = ('bsddb185', 'Canvas', 'dl', 'linuxaudiodev', 'imageop', |
|
49028
b45868fe489c
Deprecate bsddb for removal in Python 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
48996
diff
changeset
|
306 'sv', 'cPickle', 'bsddb', 'dbhash') |
|
46702
ffdb5f4139fe
Deprecate the audiodev module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46075
diff
changeset
|
307 |
|
46807
c56e83d08d0b
Deprecate the pure module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46777
diff
changeset
|
308 def check_removal(self, module_name, optional=False): |
|
46702
ffdb5f4139fe
Deprecate the audiodev module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46075
diff
changeset
|
309 """Make sure the specified module, when imported, raises a |
|
ffdb5f4139fe
Deprecate the audiodev module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46075
diff
changeset
|
310 DeprecationWarning and specifies itself in the message.""" |
|
49099
ff96a313cd1c
warnings.catch_warnings() now returns a list or None instead of the custom
Brett Cannon <bcannon@gmail.com>
parents:
49028
diff
changeset
|
311 with nested(CleanImport(module_name), warnings.catch_warnings()): |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
312 # XXX: This is not quite enough for extension modules - those |
|
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
313 # won't rerun their init code even with CleanImport. |
|
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
314 # You can see this easily by running the whole test suite with -3 |
|
47958
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
315 warnings.filterwarnings("error", ".+ removed", |
|
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
316 DeprecationWarning, __name__) |
|
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
317 try: |
|
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
318 __import__(module_name, level=0) |
|
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
319 except DeprecationWarning as exc: |
|
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
320 self.assert_(module_name in exc.args[0], |
|
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
321 "%s warning didn't contain module name" |
|
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
322 % module_name) |
|
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
323 except ImportError: |
|
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
324 if not optional: |
|
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
325 self.fail("Non-optional module {0} raised an " |
|
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
326 "ImportError.".format(module_name)) |
|
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
327 else: |
|
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
328 self.fail("DeprecationWarning not raised for {0}" |
|
e7a6a4515ab0
fix test_py3kwarns
Benjamin Peterson <benjamin@python.org>
parents:
47942
diff
changeset
|
329 .format(module_name)) |
|
46702
ffdb5f4139fe
Deprecate the audiodev module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46075
diff
changeset
|
330 |
|
ffdb5f4139fe
Deprecate the audiodev module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46075
diff
changeset
|
331 def test_platform_independent_removals(self): |
|
ffdb5f4139fe
Deprecate the audiodev module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46075
diff
changeset
|
332 # Make sure that the modules that are available on all platforms raise |
|
ffdb5f4139fe
Deprecate the audiodev module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46075
diff
changeset
|
333 # the proper DeprecationWarning. |
|
ffdb5f4139fe
Deprecate the audiodev module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46075
diff
changeset
|
334 for module_name in self.all_platforms: |
|
ffdb5f4139fe
Deprecate the audiodev module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46075
diff
changeset
|
335 self.check_removal(module_name) |
|
ffdb5f4139fe
Deprecate the audiodev module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46075
diff
changeset
|
336 |
|
46807
c56e83d08d0b
Deprecate the pure module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46777
diff
changeset
|
337 def test_platform_specific_removals(self): |
|
c56e83d08d0b
Deprecate the pure module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46777
diff
changeset
|
338 # Test the removal of platform-specific modules. |
|
c56e83d08d0b
Deprecate the pure module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46777
diff
changeset
|
339 for module_name in self.inclusive_platforms.get(sys.platform, []): |
|
c56e83d08d0b
Deprecate the pure module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46777
diff
changeset
|
340 self.check_removal(module_name, optional=True) |
|
c56e83d08d0b
Deprecate the pure module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46777
diff
changeset
|
341 |
|
46813
aa9250e6c409
Deprecate the bsddb185 module for removal in 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46811
diff
changeset
|
342 def test_optional_module_removals(self): |
|
aa9250e6c409
Deprecate the bsddb185 module for removal in 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46811
diff
changeset
|
343 # Test the removal of modules that may or may not be built. |
|
aa9250e6c409
Deprecate the bsddb185 module for removal in 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46811
diff
changeset
|
344 for module_name in self.optional_modules: |
|
aa9250e6c409
Deprecate the bsddb185 module for removal in 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46811
diff
changeset
|
345 self.check_removal(module_name, optional=True) |
|
aa9250e6c409
Deprecate the bsddb185 module for removal in 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46811
diff
changeset
|
346 |
|
46771
b93005712e39
Add Py3k warnings to os.path.walk
Benjamin Peterson <benjamin@python.org>
parents:
46764
diff
changeset
|
347 def test_os_path_walk(self): |
|
b93005712e39
Add Py3k warnings to os.path.walk
Benjamin Peterson <benjamin@python.org>
parents:
46764
diff
changeset
|
348 msg = "In 3.x, os.path.walk is removed in favor of os.walk." |
|
b93005712e39
Add Py3k warnings to os.path.walk
Benjamin Peterson <benjamin@python.org>
parents:
46764
diff
changeset
|
349 def dumbo(where, names, args): pass |
|
b93005712e39
Add Py3k warnings to os.path.walk
Benjamin Peterson <benjamin@python.org>
parents:
46764
diff
changeset
|
350 for path_mod in ("ntpath", "macpath", "os2emxpath", "posixpath"): |
|
b93005712e39
Add Py3k warnings to os.path.walk
Benjamin Peterson <benjamin@python.org>
parents:
46764
diff
changeset
|
351 mod = __import__(path_mod) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
352 reset_module_registry(mod) |
|
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
353 with check_warnings() as w: |
|
47349
e4104597c2a3
Improvements for test_py3kwarn
Benjamin Peterson <benjamin@python.org>
parents:
47336
diff
changeset
|
354 mod.walk("crashers", dumbo, None) |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
355 self.assertEquals(str(w.message), msg) |
|
46771
b93005712e39
Add Py3k warnings to os.path.walk
Benjamin Peterson <benjamin@python.org>
parents:
46764
diff
changeset
|
356 |
|
47336
2f9319169fec
warn about some members of the commands module
Benjamin Peterson <benjamin@python.org>
parents:
47252
diff
changeset
|
357 def test_commands_members(self): |
|
2f9319169fec
warn about some members of the commands module
Benjamin Peterson <benjamin@python.org>
parents:
47252
diff
changeset
|
358 import commands |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
359 # commands module tests may have already triggered this warning |
|
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
360 reset_module_registry(commands) |
|
47336
2f9319169fec
warn about some members of the commands module
Benjamin Peterson <benjamin@python.org>
parents:
47252
diff
changeset
|
361 members = {"mk2arg" : 2, "mkarg" : 1, "getstatus" : 1} |
|
2f9319169fec
warn about some members of the commands module
Benjamin Peterson <benjamin@python.org>
parents:
47252
diff
changeset
|
362 for name, arg_count in members.items(): |
|
49099
ff96a313cd1c
warnings.catch_warnings() now returns a list or None instead of the custom
Brett Cannon <bcannon@gmail.com>
parents:
49028
diff
changeset
|
363 with warnings.catch_warnings(): |
|
47336
2f9319169fec
warn about some members of the commands module
Benjamin Peterson <benjamin@python.org>
parents:
47252
diff
changeset
|
364 warnings.filterwarnings("error") |
|
2f9319169fec
warn about some members of the commands module
Benjamin Peterson <benjamin@python.org>
parents:
47252
diff
changeset
|
365 func = getattr(commands, name) |
|
2f9319169fec
warn about some members of the commands module
Benjamin Peterson <benjamin@python.org>
parents:
47252
diff
changeset
|
366 self.assertRaises(DeprecationWarning, func, *([None]*arg_count)) |
|
2f9319169fec
warn about some members of the commands module
Benjamin Peterson <benjamin@python.org>
parents:
47252
diff
changeset
|
367 |
|
48281
5a87b0d1ce91
add a test for reduce's move
Benjamin Peterson <benjamin@python.org>
parents:
48213
diff
changeset
|
368 def test_reduce_move(self): |
|
5a87b0d1ce91
add a test for reduce's move
Benjamin Peterson <benjamin@python.org>
parents:
48213
diff
changeset
|
369 from operator import add |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
370 # reduce tests may have already triggered this warning |
|
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
371 reset_module_registry(unittest) |
|
49099
ff96a313cd1c
warnings.catch_warnings() now returns a list or None instead of the custom
Brett Cannon <bcannon@gmail.com>
parents:
49028
diff
changeset
|
372 with warnings.catch_warnings(): |
|
48281
5a87b0d1ce91
add a test for reduce's move
Benjamin Peterson <benjamin@python.org>
parents:
48213
diff
changeset
|
373 warnings.filterwarnings("error", "reduce") |
|
5a87b0d1ce91
add a test for reduce's move
Benjamin Peterson <benjamin@python.org>
parents:
48213
diff
changeset
|
374 self.assertRaises(DeprecationWarning, reduce, add, range(10)) |
|
5a87b0d1ce91
add a test for reduce's move
Benjamin Peterson <benjamin@python.org>
parents:
48213
diff
changeset
|
375 |
|
47362
156746a63a5c
UserString.MutableString has been removed in Python 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
47349
diff
changeset
|
376 def test_mutablestring_removal(self): |
|
156746a63a5c
UserString.MutableString has been removed in Python 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
47349
diff
changeset
|
377 # UserString.MutableString has been removed in 3.0. |
|
156746a63a5c
UserString.MutableString has been removed in Python 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
47349
diff
changeset
|
378 import UserString |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
379 # UserString tests may have already triggered this warning |
|
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
380 reset_module_registry(UserString) |
|
49099
ff96a313cd1c
warnings.catch_warnings() now returns a list or None instead of the custom
Brett Cannon <bcannon@gmail.com>
parents:
49028
diff
changeset
|
381 with warnings.catch_warnings(): |
|
47362
156746a63a5c
UserString.MutableString has been removed in Python 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
47349
diff
changeset
|
382 warnings.filterwarnings("error", ".*MutableString", |
|
156746a63a5c
UserString.MutableString has been removed in Python 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
47349
diff
changeset
|
383 DeprecationWarning) |
|
156746a63a5c
UserString.MutableString has been removed in Python 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
47349
diff
changeset
|
384 self.assertRaises(DeprecationWarning, UserString.MutableString) |
|
156746a63a5c
UserString.MutableString has been removed in Python 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
47349
diff
changeset
|
385 |
|
46702
ffdb5f4139fe
Deprecate the audiodev module for 3.0.
Brett Cannon <bcannon@gmail.com>
parents:
46075
diff
changeset
|
386 |
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
387 def test_main(): |
|
49146
f28b999a69f8
Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
Nick Coghlan <ncoghlan@gmail.com>
parents:
49099
diff
changeset
|
388 with check_warnings(): |
|
47349
e4104597c2a3
Improvements for test_py3kwarn
Benjamin Peterson <benjamin@python.org>
parents:
47336
diff
changeset
|
389 warnings.simplefilter("always") |
|
e4104597c2a3
Improvements for test_py3kwarn
Benjamin Peterson <benjamin@python.org>
parents:
47336
diff
changeset
|
390 run_unittest(TestPy3KWarnings, |
|
e4104597c2a3
Improvements for test_py3kwarn
Benjamin Peterson <benjamin@python.org>
parents:
47336
diff
changeset
|
391 TestStdlibRemovals) |
|
45860
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
392 |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
393 if __name__ == '__main__': |
|
50771a3fad2c
Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373.
Steven Bethard <steven.bethard@gmail.com>
parents:
diff
changeset
|
394 test_main() |
