Skip to content

Commit

Permalink
Add a test that asserts the correct behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood committed Nov 27, 2023
1 parent fdab495 commit 3932d48
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Lib/test/test_typing.py
Expand Up @@ -7577,6 +7577,21 @@ class NamedTupleClass(NamedTuple):
normal_exception.__notes__[0].replace("NormalClass", "NamedTupleClass")
)

def test_strange_errors_when_accessing_set_name_itself(self):
class Meta(type):
def __getattribute__(self, attr):
if attr == "__set_name__":
raise TypeError("NO")
return object.__getattribute__(self, attr)

class VeryAnnoying(metaclass=Meta): pass

annoying = VeryAnnoying()

with self.assertRaisesRegex(TypeError, "NO"):
class Foo(NamedTuple):
attr = annoying


class TypedDictTests(BaseTestCase):
def test_basics_functional_syntax(self):
Expand Down

0 comments on commit 3932d48

Please sign in to comment.