mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #17941: Add a *module* parameter to collections.namedtuple()
This commit is contained in:
parent
11fa3ffcb1
commit
0d5048cb21
4 changed files with 22 additions and 7 deletions
|
@ -242,6 +242,10 @@ class TestNamedTuple(unittest.TestCase):
|
|||
]:
|
||||
self.assertEqual(namedtuple('NT', spec, rename=True)._fields, renamed)
|
||||
|
||||
def test_module_parameter(self):
|
||||
NT = namedtuple('NT', ['x', 'y'], module=collections)
|
||||
self.assertEqual(NT.__module__, collections)
|
||||
|
||||
def test_instance(self):
|
||||
Point = namedtuple('Point', 'x y')
|
||||
p = Point(11, 22)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue