File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -109,12 +109,16 @@ def __repr__(self):
109
109
assert s1 == s2
110
110
111
111
malformed_utf8 = b"\x80 "
112
- with pytest .raises (UnicodeDecodeError ) as excinfo :
113
- assert m .str_from_object (malformed_utf8 )
114
- assert 'invalid start byte' in str (excinfo .value )
115
- with pytest .raises (UnicodeDecodeError ) as excinfo :
116
- assert m .str_from_handle (malformed_utf8 )
117
- assert 'invalid start byte' in str (excinfo .value )
112
+ if sys .version_info .major < 3 :
113
+ with pytest .raises (UnicodeDecodeError ) as excinfo :
114
+ assert m .str_from_object (malformed_utf8 )
115
+ assert 'invalid start byte' in str (excinfo .value )
116
+ with pytest .raises (UnicodeDecodeError ) as excinfo :
117
+ assert m .str_from_handle (malformed_utf8 )
118
+ assert 'invalid start byte' in str (excinfo .value )
119
+ else :
120
+ assert m .str_from_object (malformed_utf8 ) == "b'\\ x80'"
121
+ assert m .str_from_handle (malformed_utf8 ) == "b'\\ x80'"
118
122
119
123
120
124
def test_bytes (doc ):
You can’t perform that action at this time.
0 commit comments