@@ -744,12 +744,12 @@ def assign(self, expr):
744
744
745
745
def display (self , expr ):
746
746
"""Call saferepr on the expression."""
747
- return self .helper ("saferepr " , expr )
747
+ return self .helper ("_saferepr " , expr )
748
748
749
749
def helper (self , name , * args ):
750
750
"""Call a helper in this module."""
751
751
py_name = ast .Name ("@pytest_ar" , ast .Load ())
752
- attr = ast .Attribute (py_name , "_" + name , ast .Load ())
752
+ attr = ast .Attribute (py_name , name , ast .Load ())
753
753
return ast_Call (attr , list (args ), [])
754
754
755
755
def builtin (self , name ):
@@ -849,14 +849,14 @@ def visit_Assert(self, assert_):
849
849
negation = ast .UnaryOp (ast .Not (), top_condition )
850
850
self .statements .append (ast .If (negation , body , []))
851
851
if assert_ .msg :
852
- assertmsg = self .helper ("format_assertmsg " , assert_ .msg )
852
+ assertmsg = self .helper ("_format_assertmsg " , assert_ .msg )
853
853
explanation = "\n >assert " + explanation
854
854
else :
855
855
assertmsg = ast .Str ("" )
856
856
explanation = "assert " + explanation
857
857
template = ast .BinOp (assertmsg , ast .Add (), ast .Str (explanation ))
858
858
msg = self .pop_format_context (template )
859
- fmt = self .helper ("format_explanation " , msg )
859
+ fmt = self .helper ("_format_explanation " , msg )
860
860
err_name = ast .Name ("AssertionError" , ast .Load ())
861
861
exc = ast_Call (err_name , [fmt ], [])
862
862
if sys .version_info [0 ] >= 3 :
@@ -906,7 +906,7 @@ def visit_Name(self, name):
906
906
# _should_repr_global_name() thinks it's acceptable.
907
907
locs = ast_Call (self .builtin ("locals" ), [], [])
908
908
inlocs = ast .Compare (ast .Str (name .id ), [ast .In ()], [locs ])
909
- dorepr = self .helper ("should_repr_global_name " , name )
909
+ dorepr = self .helper ("_should_repr_global_name " , name )
910
910
test = ast .BoolOp (ast .Or (), [inlocs , dorepr ])
911
911
expr = ast .IfExp (test , self .display (name ), ast .Str (name .id ))
912
912
return name , self .explanation_param (expr )
@@ -942,7 +942,7 @@ def visit_BoolOp(self, boolop):
942
942
self .statements = body = inner
943
943
self .statements = save
944
944
self .on_failure = fail_save
945
- expl_template = self .helper ("format_boolop " , expl_list , ast .Num (is_or ))
945
+ expl_template = self .helper ("_format_boolop " , expl_list , ast .Num (is_or ))
946
946
expl = self .pop_format_context (expl_template )
947
947
return ast .Name (res_var , ast .Load ()), self .explanation_param (expl )
948
948
@@ -1067,7 +1067,7 @@ def visit_Compare(self, comp):
1067
1067
left_res , left_expl = next_res , next_expl
1068
1068
# Use pytest.assertion.util._reprcompare if that's available.
1069
1069
expl_call = self .helper (
1070
- "call_reprcompare " ,
1070
+ "_call_reprcompare " ,
1071
1071
ast .Tuple (syms , ast .Load ()),
1072
1072
ast .Tuple (load_names , ast .Load ()),
1073
1073
ast .Tuple (expls , ast .Load ()),
0 commit comments