summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-04-04 21:31:30 +0300
committerGitHub <noreply@github.com>2020-04-04 21:31:30 +0300
commita94e6272f16381349dbed74cdb738ec8ae23b4fe (patch)
tree88b84259573c0752ded1fce71c76094f8cb7989a /Lib/test
parent1ae6445391cc3519733df69a4448059d6eff3c6f (diff)
downloadcpython-git-a94e6272f16381349dbed74cdb738ec8ae23b4fe.tar.gz
bpo-36517: Raise error on multiple inheritance with NamedTuple (GH-19363)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_typing.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index 8d6262b9c1..3a0edb9e2d 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -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)