]> granicus.if.org Git - python/commitdiff
Fix test of count.__repr__() to ignore the 'L' if the count is a long
authorRaymond Hettinger <python@rcn.com>
Fri, 12 Oct 2007 17:53:11 +0000 (17:53 +0000)
committerRaymond Hettinger <python@rcn.com>
Fri, 12 Oct 2007 17:53:11 +0000 (17:53 +0000)
Lib/test/test_itertools.py

index 3a370d965f5233359182ef754a4200df7bba276a..1a3064c3051b259661cb30a6ae0c4cef75df2943 100644 (file)
@@ -67,7 +67,10 @@ class TestBasicOps(unittest.TestCase):
         c.next()
         self.assertEqual(c.next(), -8)
         for i in (-sys.maxint-5, -sys.maxint+5 ,-10, -1, 0, 10, sys.maxint-5, sys.maxint+5):
-            self.assertEqual(repr(count(i)), 'count(%r)' % i)
+            # Test repr (ignoring the L in longs)
+            r1 = repr(count(i)).replace('L', '')
+            r2 = 'count(%r)'.__mod__(i).replace('L', '')
+            self.assertEqual(r1, r2)
 
     def test_cycle(self):
         self.assertEqual(take(10, cycle('abc')), list('abcabcabca'))