summaryrefslogtreecommitdiff
path: root/Lib/test/test_collections.py
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-02-24 01:46:21 +0000
committerR. David Murray <rdmurray@bitdance.com>2010-02-24 01:46:21 +0000
commit7f6c2e6cb2e1be5e25c556e6258d76b8fcf72ce8 (patch)
treecf017413a6bcbe7221d5a8b016f1afa98780e909 /Lib/test/test_collections.py
parenta1f698754bc05deaea56dba1e7d61b9f476862b0 (diff)
downloadcpython-7f6c2e6cb2e1be5e25c556e6258d76b8fcf72ce8.tar.gz
Merged revisions 78351 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78351 | r.david.murray | 2010-02-22 19:24:49 -0500 (Mon, 22 Feb 2010) | 5 lines Issue 6292: for the moment at least, the test suite passes if run with -OO. Tests requiring docstrings are skipped. Patch by Brian Curtin, thanks to Matias Torchinsky for helping review and improve the patch. ........
Diffstat (limited to 'Lib/test/test_collections.py')
-rw-r--r--Lib/test/test_collections.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 2dc71575a1..467ddef708 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -10,6 +10,7 @@ from random import randrange, shuffle
import operator
import keyword
import re
+import sys
from collections import Hashable, Iterable, Iterator
from collections import Sized, Container, Callable
from collections import Set, MutableSet
@@ -24,7 +25,6 @@ class TestNamedTuple(unittest.TestCase):
def test_factory(self):
Point = namedtuple('Point', 'x y')
self.assertEqual(Point.__name__, 'Point')
- self.assertEqual(Point.__doc__, 'Point(x, y)')
self.assertEqual(Point.__slots__, ())
self.assertEqual(Point.__module__, __name__)
self.assertEqual(Point.__getitem__, tuple.__getitem__)
@@ -51,6 +51,12 @@ class TestNamedTuple(unittest.TestCase):
self.assertRaises(TypeError, Point._make, [11]) # catch too few args
self.assertRaises(TypeError, Point._make, [11, 22, 33]) # catch too many args
+ @unittest.skipIf(sys.flags.optimize >= 2,
+ "Docstrings are omitted with -O2 and above")
+ def test_factory_doc_attr(self):
+ Point = namedtuple('Point', 'x y')
+ self.assertEqual(Point.__doc__, 'Point(x, y)')
+
def test_name_fixer(self):
for spec, renamed in [
[('efg', 'g%hi'), ('efg', '_1')], # field with non-alpha char