File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -2091,6 +2091,24 @@ def test_warning_notimplemented(self):
20912091 with self .assertWarns (DeprecationWarning ):
20922092 self .assertFalse (not NotImplemented )
20932093
2094+ def test_singleton_attribute_access (self ):
2095+ for singleton in (NotImplemented , Ellipsis ):
2096+ with self .subTest (singleton ):
2097+ self .assertIs (type (singleton ), singleton .__class__ )
2098+ self .assertIs (type (singleton ).__class__ , type )
2099+
2100+ # Missing instance attributes:
2101+ with self .assertRaises (AttributeError ):
2102+ singleton .prop = 1
2103+ with self .assertRaises (AttributeError ):
2104+ singleton .prop
2105+
2106+ # Missing class attributes:
2107+ with self .assertRaises (TypeError ):
2108+ type(singleton ).prop = 1
2109+ with self .assertRaises (AttributeError ):
2110+ type (singleton ).prop
2111+
20942112
20952113class TestBreakpoint (unittest .TestCase ):
20962114 def setUp (self ):
You can’t perform that action at this time.
0 commit comments