@@ -32,10 +32,8 @@ class A(object):
3232 pytest .raises (TypeError , "_pytest._code.Code(A)" )
3333
3434
35- if True :
36-
37- def x ():
38- pass
35+ def x ():
36+ raise NotImplementedError ()
3937
4038
4139def test_code_fullsource ():
@@ -48,7 +46,7 @@ def test_code_source():
4846 code = _pytest ._code .Code (x )
4947 src = code .source ()
5048 expected = """def x():
51- pass """
49+ raise NotImplementedError() """
5250 assert str (src ) == expected
5351
5452
@@ -85,9 +83,9 @@ def f():
8583 raise Exception (value )
8684
8785 excinfo = pytest .raises (Exception , f )
88- str (excinfo )
89- if sys .version_info [ 0 ] < 3 :
90- text_type (excinfo )
86+ text_type (excinfo )
87+ if sys .version_info < ( 3 ,) :
88+ bytes (excinfo )
9189
9290
9391@pytest .mark .skipif (sys .version_info [0 ] >= 3 , reason = "python 2 only issue" )
@@ -105,25 +103,25 @@ def f():
105103
106104def test_code_getargs ():
107105 def f1 (x ):
108- pass
106+ raise NotImplementedError ()
109107
110108 c1 = _pytest ._code .Code (f1 )
111109 assert c1 .getargs (var = True ) == ("x" ,)
112110
113111 def f2 (x , * y ):
114- pass
112+ raise NotImplementedError ()
115113
116114 c2 = _pytest ._code .Code (f2 )
117115 assert c2 .getargs (var = True ) == ("x" , "y" )
118116
119117 def f3 (x , ** z ):
120- pass
118+ raise NotImplementedError ()
121119
122120 c3 = _pytest ._code .Code (f3 )
123121 assert c3 .getargs (var = True ) == ("x" , "z" )
124122
125123 def f4 (x , * y , ** z ):
126- pass
124+ raise NotImplementedError ()
127125
128126 c4 = _pytest ._code .Code (f4 )
129127 assert c4 .getargs (var = True ) == ("x" , "y" , "z" )
@@ -188,11 +186,14 @@ def test_not_raise_exception_with_mixed_encoding(self):
188186
189187 tw = TWMock ()
190188
191- args = [("unicode_string" , u"São Paulo" ), ("utf8_string" , "S\xc3 \xa3 o Paulo" )]
189+ args = [("unicode_string" , u"São Paulo" ), ("utf8_string" , b "S\xc3 \xa3 o Paulo" )]
192190
193191 r = ReprFuncArgs (args )
194192 r .toterminal (tw )
195193 if sys .version_info [0 ] >= 3 :
196- assert tw .lines [0 ] == "unicode_string = São Paulo, utf8_string = São Paulo"
194+ assert (
195+ tw .lines [0 ]
196+ == r"unicode_string = São Paulo, utf8_string = b'S\xc3\xa3o Paulo'"
197+ )
197198 else :
198199 assert tw .lines [0 ] == "unicode_string = São Paulo, utf8_string = São Paulo"
0 commit comments