mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
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. ........
This commit is contained in:
parent
72aee3dcab
commit
378c0cf5ab
19 changed files with 211 additions and 42 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue