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():
823
823
else :
824
824
return "unused"
825
825
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" ))
828
830
829
831
@support .cpython_only
830
832
def test_remove_unused_consts_no_docstring (self ):
@@ -869,7 +871,11 @@ def test_strip_unused_None(self):
869
871
def f1 ():
870
872
"docstring"
871
873
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__ ,))
873
879
874
880
# This is a regression test for a CPython specific peephole optimizer
875
881
# implementation bug present in a few releases. It's assertion verifies
You can’t perform that action at this time.
0 commit comments