summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_itertools.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-12-17 20:43:33 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-12-17 20:43:33 (GMT)
commit64958a15d7c03efdc3d2eddf247666e18d1fd910 (patch)
treebc135ae082f8635fa858b81f52f141d7ffbd4c78 /Lib/test/test_itertools.py
parentdf38ea9c29a431602704c6bd45ca7417225a61c4 (diff)
downloadcpython-64958a15d7c03efdc3d2eddf247666e18d1fd910.zip
cpython-64958a15d7c03efdc3d2eddf247666e18d1fd910.tar.gz
cpython-64958a15d7c03efdc3d2eddf247666e18d1fd910.tar.bz2
Guido grants a Christmas wish:
sorted() becomes a regular function instead of a classmethod.
Diffstat (limited to 'Lib/test/test_itertools.py')
-rw-r--r--Lib/test/test_itertools.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index b4c0a8b..31b1b7c 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -97,16 +97,16 @@ class TestBasicOps(unittest.TestCase):
# Exercise pipes and filters style
s = 'abracadabra'
# sort s | uniq
- r = [k for k, g in groupby(list.sorted(s))]
+ r = [k for k, g in groupby(sorted(s))]
self.assertEqual(r, ['a', 'b', 'c', 'd', 'r'])
# sort s | uniq -d
- r = [k for k, g in groupby(list.sorted(s)) if list(islice(g,1,2))]
+ r = [k for k, g in groupby(sorted(s)) if list(islice(g,1,2))]
self.assertEqual(r, ['a', 'b', 'r'])
# sort s | uniq -c
- r = [(len(list(g)), k) for k, g in groupby(list.sorted(s))]
+ r = [(len(list(g)), k) for k, g in groupby(sorted(s))]
self.assertEqual(r, [(5, 'a'), (2, 'b'), (1, 'c'), (1, 'd'), (2, 'r')])
# sort s | uniq -c | sort -rn | head -3
- r = list.sorted([(len(list(g)) , k) for k, g in groupby(list.sorted(s))], reverse=True)[:3]
+ r = sorted([(len(list(g)) , k) for k, g in groupby(sorted(s))], reverse=True)[:3]
self.assertEqual(r, [(5, 'a'), (2, 'r'), (2, 'b')])
# iter.next failure
@@ -669,7 +669,7 @@ Samuele
>>> from operator import itemgetter
>>> d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3)
->>> di = list.sorted(d.iteritems(), key=itemgetter(1))
+>>> di = sorted(d.iteritems(), key=itemgetter(1))
>>> for k, g in groupby(di, itemgetter(1)):
... print k, map(itemgetter(0), g)
...