mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Expose the namedtuple source with a _source attribute.
This commit is contained in:
parent
843a751369
commit
2ebea41d31
3 changed files with 20 additions and 53 deletions
|
@ -127,6 +127,7 @@ class TestNamedTuple(unittest.TestCase):
|
|||
self.assertEqual(Point.__module__, __name__)
|
||||
self.assertEqual(Point.__getitem__, tuple.__getitem__)
|
||||
self.assertEqual(Point._fields, ('x', 'y'))
|
||||
self.assertIn('class Point(tuple)', Point._source)
|
||||
|
||||
self.assertRaises(ValueError, namedtuple, 'abc%', 'efg ghi') # type has non-alpha char
|
||||
self.assertRaises(ValueError, namedtuple, 'class', 'efg ghi') # type has keyword
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue