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 @@ -2139,6 +2139,24 @@ def test_warning_notimplemented(self):
21392139 with self .assertWarns (DeprecationWarning ):
21402140 self .assertFalse (not NotImplemented )
21412141
2142+ def test_singleton_attribute_access (self ):
2143+ for singleton in (NotImplemented , Ellipsis ):
2144+ with self .subTest (singleton ):
2145+ self .assertIs (type (singleton ), singleton .__class__ )
2146+ self .assertIs (type (singleton ).__class__ , type )
2147+
2148+ # Missing instance attributes:
2149+ with self .assertRaises (AttributeError ):
2150+ singleton .prop = 1
2151+ with self .assertRaises (AttributeError ):
2152+ singleton .prop
2153+
2154+ # Missing class attributes:
2155+ with self .assertRaises (TypeError ):
2156+ type(singleton ).prop = 1
2157+ with self .assertRaises (AttributeError ):
2158+ type (singleton ).prop
2159+
21422160
21432161class TestBreakpoint (unittest .TestCase ):
21442162 def setUp (self ):
You can’t perform that action at this time.
0 commit comments