diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-09-05 19:05:05 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-09-05 19:05:05 (GMT) |
commit | a3acea3e07dba03a22dc35ca17ad83baa82e3729 (patch) | |
tree | 2a2e4f25b0ea350f0d828ce09b86f6dfbd214606 /Lib/test/test_collections.py | |
parent | 342fd18f5369863dfa0c44bc1f57476fdde587aa (diff) | |
download | cpython-a3acea3e07dba03a22dc35ca17ad83baa82e3729.zip cpython-a3acea3e07dba03a22dc35ca17ad83baa82e3729.tar.gz cpython-a3acea3e07dba03a22dc35ca17ad83baa82e3729.tar.bz2 |
Issue #22340: Fix Python 3 warnings in Python 2 tests
Diffstat (limited to 'Lib/test/test_collections.py')
-rw-r--r-- | Lib/test/test_collections.py | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index de4ba86..6c9c407 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -8,13 +8,14 @@ import pickle, cPickle, copy from random import randrange, shuffle import keyword import re -import sets import sys from collections import Hashable, Iterable, Iterator from collections import Sized, Container, Callable from collections import Set, MutableSet from collections import Mapping, MutableMapping from collections import Sequence, MutableSequence +with test_support.check_warnings(('', DeprecationWarning)): + import sets TestNT = namedtuple('TestNT', 'x y z') # type used for pickle tests @@ -713,10 +714,12 @@ class TestCollectionABCs(ABCTestCase): self.assertTrue(r1 < r3) self.assertFalse(r1 < r1) self.assertFalse(r1 < r2) - # python 2 only, cross-type compares will succeed - f1 < l3 - f1 < l1 - f1 < l2 + + with test_support.check_py3k_warnings(): + # python 2 only, cross-type compares will succeed + f1 < l3 + f1 < l1 + f1 < l2 # any subset self.assertTrue(f1 <= f3) @@ -728,10 +731,12 @@ class TestCollectionABCs(ABCTestCase): self.assertTrue(r1 <= r3) self.assertTrue(r1 <= r1) self.assertFalse(r1 <= r2) - # python 2 only, cross-type compares will succeed - f1 <= l3 - f1 <= l1 - f1 <= l2 + + with test_support.check_py3k_warnings(): + # python 2 only, cross-type compares will succeed + f1 <= l3 + f1 <= l1 + f1 <= l2 # proper superset self.assertTrue(f3 > f1) @@ -743,10 +748,12 @@ class TestCollectionABCs(ABCTestCase): self.assertTrue(r3 > r1) self.assertFalse(r1 > r1) self.assertFalse(r2 > r1) - # python 2 only, cross-type compares will succeed - f1 > l3 - f1 > l1 - f1 > l2 + + with test_support.check_py3k_warnings(): + # python 2 only, cross-type compares will succeed + f1 > l3 + f1 > l1 + f1 > l2 # any superset self.assertTrue(f3 >= f1) @@ -758,10 +765,12 @@ class TestCollectionABCs(ABCTestCase): self.assertTrue(r3 >= r1) self.assertTrue(r1 >= r1) self.assertFalse(r2 >= r1) - # python 2 only, cross-type compares will succeed - f1 >= l3 - f1 >=l1 - f1 >= l2 + + with test_support.check_py3k_warnings(): + # python 2 only, cross-type compares will succeed + f1 >= l3 + f1 >=l1 + f1 >= l2 # equality self.assertTrue(f1 == f1) |