diff options
author | Guido van Rossum <guido@python.org> | 2007-05-07 22:24:25 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-05-07 22:24:25 (GMT) |
commit | 805365ee39298f93e433e19ae0dd87c6f782145b (patch) | |
tree | ae8f8a3c315b49cfb2e7926d4b7e56f64c68b21c /Lib/test/test_set.py | |
parent | 598d98a7e8981e650e803e41e884ffc905b2311e (diff) | |
download | cpython-805365ee39298f93e433e19ae0dd87c6f782145b.zip cpython-805365ee39298f93e433e19ae0dd87c6f782145b.tar.gz cpython-805365ee39298f93e433e19ae0dd87c6f782145b.tar.bz2 |
Merged revisions 55007-55179 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
........
r55077 | guido.van.rossum | 2007-05-02 11:54:37 -0700 (Wed, 02 May 2007) | 2 lines
Use the new print syntax, at least.
........
r55142 | fred.drake | 2007-05-04 21:27:30 -0700 (Fri, 04 May 2007) | 1 line
remove old cruftiness
........
r55143 | fred.drake | 2007-05-04 21:52:16 -0700 (Fri, 04 May 2007) | 1 line
make this work with the new Python
........
r55162 | neal.norwitz | 2007-05-06 22:29:18 -0700 (Sun, 06 May 2007) | 1 line
Get asdl code gen working with Python 2.3. Should continue to work with 3.0
........
r55164 | neal.norwitz | 2007-05-07 00:00:38 -0700 (Mon, 07 May 2007) | 1 line
Verify checkins to p3yk (sic) branch go to 3000 list.
........
r55166 | neal.norwitz | 2007-05-07 00:12:35 -0700 (Mon, 07 May 2007) | 1 line
Fix this test so it runs again by importing warnings_test properly.
........
r55167 | neal.norwitz | 2007-05-07 01:03:22 -0700 (Mon, 07 May 2007) | 8 lines
So long xrange. range() now supports values that are outside
-sys.maxint to sys.maxint. floats raise a TypeError.
This has been sitting for a long time. It probably has some problems and
needs cleanup. Objects/rangeobject.c now uses 4-space indents since
it is almost completely new.
........
r55171 | guido.van.rossum | 2007-05-07 10:21:26 -0700 (Mon, 07 May 2007) | 4 lines
Fix two tests that were previously depending on significant spaces
at the end of a line (and before that on Python 2.x print behavior
that has no exact equivalent in 3.0).
........
Diffstat (limited to 'Lib/test/test_set.py')
-rw-r--r-- | Lib/test/test_set.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py index 0e47623..3b62478 100644 --- a/Lib/test/test_set.py +++ b/Lib/test/test_set.py @@ -227,7 +227,7 @@ class TestJointOps(unittest.TestCase): # Create a nest of cycles to exercise overall ref count check class A: pass - s = set(A() for i in xrange(1000)) + s = set(A() for i in range(1000)) for elem in s: elem.cycle = s elem.sub = elem @@ -283,7 +283,7 @@ class TestJointOps(unittest.TestCase): def test_do_not_rehash_dict_keys(self): n = 10 - d = dict.fromkeys(map(HashCountingInt, xrange(n))) + d = dict.fromkeys(map(HashCountingInt, range(n))) self.assertEqual(sum(elem.hash_count for elem in d), n) s = self.thetype(d) self.assertEqual(sum(elem.hash_count for elem in d), n) @@ -377,7 +377,7 @@ class TestSet(TestJointOps): s.discard(self.thetype(self.word)) def test_pop(self): - for i in xrange(len(self.s)): + for i in range(len(self.s)): elem = self.s.pop() self.assert_(elem not in self.s) self.assertRaises(KeyError, self.s.pop) @@ -525,7 +525,7 @@ class TestFrozenSet(TestJointOps): f = frozenset() efs = [frozenset(), frozenset([]), frozenset(()), frozenset(''), frozenset(), frozenset([]), frozenset(()), frozenset(''), - frozenset(xrange(0)), frozenset(frozenset()), + frozenset(range(0)), frozenset(frozenset()), frozenset(f), f] # All of the empty frozensets should have just one id() self.assertEqual(len(set(map(id, efs))), 1) @@ -541,9 +541,9 @@ class TestFrozenSet(TestJointOps): # make sure that all permutations give the same hash value n = 100 - seq = [randrange(n) for i in xrange(n)] + seq = [randrange(n) for i in range(n)] results = set() - for i in xrange(200): + for i in range(200): shuffle(seq) results.add(hash(self.thetype(seq))) self.assertEqual(len(results), 1) @@ -553,7 +553,7 @@ class TestFrozenSet(TestJointOps): self.assertEqual(id(self.s), id(dup)) def test_frozen_as_dictkey(self): - seq = range(10) + list('abcdefg') + ['apple'] + seq = list(range(10)) + list('abcdefg') + ['apple'] key1 = self.thetype(seq) key2 = self.thetype(reversed(seq)) self.assertEqual(key1, key2) @@ -571,7 +571,7 @@ class TestFrozenSet(TestJointOps): hashvalues = set() addhashvalue = hashvalues.add elemmasks = [(i+1, 1<<i) for i in range(n)] - for i in xrange(2**n): + for i in range(2**n): addhashvalue(hash(frozenset([e for e, m in elemmasks if m&i]))) self.assertEqual(len(hashvalues), 2**n) @@ -601,7 +601,7 @@ class TestFrozenSetSubclass(TestFrozenSet): F = Frozenset() efs = [Frozenset(), Frozenset([]), Frozenset(()), Frozenset(''), Frozenset(), Frozenset([]), Frozenset(()), Frozenset(''), - Frozenset(xrange(0)), Frozenset(Frozenset()), + Frozenset(range(0)), Frozenset(Frozenset()), Frozenset(frozenset()), f, F, Frozenset(f), Frozenset(F)] # All empty frozenset subclass instances should have different ids self.assertEqual(len(set(map(id, efs))), len(efs)) @@ -775,7 +775,7 @@ class TestExceptionPropagation(unittest.TestCase): set([1,2,3]) set((1,2,3)) set({'one':1, 'two':2, 'three':3}) - set(xrange(3)) + set(range(3)) set('abc') set(gooditer()) @@ -1268,7 +1268,7 @@ class TestOnlySetsString(TestOnlySetsInBinaryOps): class TestOnlySetsGenerator(TestOnlySetsInBinaryOps): def setUp(self): def gen(): - for i in xrange(0, 10, 2): + for i in range(0, 10, 2): yield i self.set = set((1, 2, 3)) self.other = gen() @@ -1451,7 +1451,7 @@ class TestVariousIteratorArgs(unittest.TestCase): def test_constructor(self): for cons in (set, frozenset): - for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): + for s in ("123", "", range(1000), ('do', 1.2), range(2000,2200,5)): for g in (G, I, Ig, S, L, R): self.assertEqual(sorted(cons(g(s)), key=repr), sorted(g(s), key=repr)) self.assertRaises(TypeError, cons , X(s)) @@ -1460,7 +1460,7 @@ class TestVariousIteratorArgs(unittest.TestCase): def test_inline_methods(self): s = set('november') - for data in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5), 'december'): + for data in ("123", "", range(1000), ('do', 1.2), range(2000,2200,5), 'december'): for meth in (s.union, s.intersection, s.difference, s.symmetric_difference): for g in (G, I, Ig, L, R): expected = meth(data) @@ -1471,7 +1471,7 @@ class TestVariousIteratorArgs(unittest.TestCase): self.assertRaises(ZeroDivisionError, meth, E(s)) def test_inplace_methods(self): - for data in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5), 'december'): + for data in ("123", "", range(1000), ('do', 1.2), range(2000,2200,5), 'december'): for methname in ('update', 'intersection_update', 'difference_update', 'symmetric_difference_update'): for g in (G, I, Ig, S, L, R): @@ -1529,7 +1529,7 @@ def test_main(verbose=None): if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 - for i in xrange(len(counts)): + for i in range(len(counts)): test_support.run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() |