File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2063,8 +2063,13 @@ class BareRaise:
20632063 def __getattr__ (self , name ):
20642064 raise AttributeError
20652065
2066+ class RaiseCustom :
2067+ def __getattr__ (self , name ):
2068+ raise AttributeError ("custom" )
2069+
20662070 self ._test_generated_message (RaiseWithName (), "missing1" )
20672071 self ._test_generated_message (BareRaise (), "missing2" )
2072+ self ._test_generated_message (RaiseCustom (), "custom" )
20682073
20692074 def test_module_getattr_attribute_error_message (self ):
20702075 mod1 = ModuleType ("raisewithname" )
@@ -2077,8 +2082,14 @@ def bare_raise(name):
20772082 raise AttributeError
20782083 mod2 .__getattr__ = bare_raise
20792084
2085+ mod3 = ModuleType ("bareraise" )
2086+ def raise_custom (name ):
2087+ raise AttributeError ("custom" )
2088+ mod3 .__getattr__ = raise_custom
2089+
20802090 self ._test_generated_message (mod1 , "missing3" )
20812091 self ._test_generated_message (mod2 , "missing4" )
2092+ self ._test_generated_message (mod3 , "custom" )
20822093
20832094 # Note: name suggestion tests live in `test_traceback`.
20842095
You can’t perform that action at this time.
0 commit comments