summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sort.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-01-08 19:04:16 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-01-08 19:04:16 (GMT)
commitce8e33a095030e7af94f58f9da196b240bdf0476 (patch)
treeb0ba50cbb6e85c6be6f6e6a870e4232be50a0f9c /Lib/test/test_sort.py
parent3ddc435af6873c6304058d7bcbcb19ee4fba7781 (diff)
downloadcpython-ce8e33a095030e7af94f58f9da196b240bdf0476.zip
cpython-ce8e33a095030e7af94f58f9da196b240bdf0476.tar.gz
cpython-ce8e33a095030e7af94f58f9da196b240bdf0476.tar.bz2
Reverting the Revision: 77368. I committed Flox's big patch for tests by
mistake. ( It may come in for sure tough)
Diffstat (limited to 'Lib/test/test_sort.py')
-rw-r--r--Lib/test/test_sort.py31
1 files changed, 13 insertions, 18 deletions
diff --git a/Lib/test/test_sort.py b/Lib/test/test_sort.py
index a8e239a..a61fb96 100644
--- a/Lib/test/test_sort.py
+++ b/Lib/test/test_sort.py
@@ -2,7 +2,6 @@ from test import test_support
import random
import sys
import unittest
-import warnings
verbose = test_support.verbose
nerrors = 0
@@ -186,7 +185,7 @@ class TestDecorateSortUndecorate(unittest.TestCase):
def test_stability(self):
data = [(random.randrange(100), i) for i in xrange(200)]
copy = data[:]
- data.sort(key=lambda x: x[0]) # sort on the random first field
+ data.sort(key=lambda (x,y): x) # sort on the random first field
copy.sort() # sort using both fields
self.assertEqual(data, copy) # should get the same result
@@ -208,7 +207,7 @@ class TestDecorateSortUndecorate(unittest.TestCase):
# Verify that the wrapper has been removed
data = range(-2,2)
dup = data[:]
- self.assertRaises(ZeroDivisionError, data.sort, None, lambda x: 1 // x)
+ self.assertRaises(ZeroDivisionError, data.sort, None, lambda x: 1/x)
self.assertEqual(data, dup)
def test_key_with_mutation(self):
@@ -275,21 +274,17 @@ def test_main(verbose=None):
TestBugs,
)
- with warnings.catch_warnings():
- # Silence Py3k warning
- warnings.filterwarnings("ignore", "the cmp argument is not supported",
- DeprecationWarning)
- test_support.run_unittest(*test_classes)
-
- # verify reference counting
- if verbose and hasattr(sys, "gettotalrefcount"):
- import gc
- counts = [None] * 5
- for i in xrange(len(counts)):
- test_support.run_unittest(*test_classes)
- gc.collect()
- counts[i] = sys.gettotalrefcount()
- print counts
+ test_support.run_unittest(*test_classes)
+
+ # verify reference counting
+ if verbose and hasattr(sys, "gettotalrefcount"):
+ import gc
+ counts = [None] * 5
+ for i in xrange(len(counts)):
+ test_support.run_unittest(*test_classes)
+ gc.collect()
+ counts[i] = sys.gettotalrefcount()
+ print counts
if __name__ == "__main__":
test_main(verbose=True)