We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fdab495 commit 3932d48Copy full SHA for 3932d48
Lib/test/test_typing.py
@@ -7577,6 +7577,21 @@ class NamedTupleClass(NamedTuple):
7577
normal_exception.__notes__[0].replace("NormalClass", "NamedTupleClass")
7578
)
7579
7580
+ def test_strange_errors_when_accessing_set_name_itself(self):
7581
+ class Meta(type):
7582
+ def __getattribute__(self, attr):
7583
+ if attr == "__set_name__":
7584
+ raise TypeError("NO")
7585
+ return object.__getattribute__(self, attr)
7586
+
7587
+ class VeryAnnoying(metaclass=Meta): pass
7588
7589
+ annoying = VeryAnnoying()
7590
7591
+ with self.assertRaisesRegex(TypeError, "NO"):
7592
+ class Foo(NamedTuple):
7593
+ attr = annoying
7594
7595
7596
class TypedDictTests(BaseTestCase):
7597
def test_basics_functional_syntax(self):
0 commit comments