File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -823,8 +823,10 @@ def f():
823823 else :
824824 return "unused"
825825
826- self .assertEqual (f .__code__ .co_consts ,
827- (f .__doc__ , "used" ))
826+ if f .__doc__ is None :
827+ self .assertEqual (f .__code__ .co_consts , (True , "used" ))
828+ else :
829+ self .assertEqual (f .__code__ .co_consts , (f .__doc__ , "used" ))
828830
829831 @support .cpython_only
830832 def test_remove_unused_consts_no_docstring (self ):
@@ -869,7 +871,11 @@ def test_strip_unused_None(self):
869871 def f1 ():
870872 "docstring"
871873 return 42
872- self .assertEqual (f1 .__code__ .co_consts , (f1 .__doc__ ,))
874+
875+ if f1 .__doc__ is None :
876+ self .assertEqual (f1 .__code__ .co_consts , (42 ,))
877+ else :
878+ self .assertEqual (f1 .__code__ .co_consts , (f1 .__doc__ ,))
873879
874880 # This is a regression test for a CPython specific peephole optimizer
875881 # implementation bug present in a few releases. It's assertion verifies
You can’t perform that action at this time.
0 commit comments