mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-36517: Raise error on multiple inheritance with NamedTuple (GH-19363)
This commit is contained in:
parent
1ae6445391
commit
a94e6272f1
3 changed files with 12 additions and 0 deletions
|
@ -3626,6 +3626,13 @@ class XMethBad2(NamedTuple):
|
|||
return 'no chance for this as well'
|
||||
""")
|
||||
|
||||
def test_multiple_inheritance(self):
|
||||
class A:
|
||||
pass
|
||||
with self.assertRaises(TypeError):
|
||||
class X(NamedTuple, A):
|
||||
x: int
|
||||
|
||||
def test_namedtuple_keyword_usage(self):
|
||||
LocalEmployee = NamedTuple("LocalEmployee", name=str, age=int)
|
||||
nick = LocalEmployee('Nick', 25)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue