File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -207,7 +207,7 @@ def as_bytes(s):
207207 """
208208 try :
209209 s = s .encode ()
210- except AttributeError :
210+ except ( AttributeError , UnicodeDecodeError ) :
211211 pass
212212 return s
213213
@@ -220,6 +220,6 @@ def as_unicode(b):
220220 """
221221 try :
222222 b = b .decode ()
223- except AttributeError :
223+ except ( AttributeError , UnicodeDecodeError ) :
224224 pass
225225 return b
Original file line number Diff line number Diff line change @@ -133,13 +133,13 @@ def test_hmac_from_keyrep():
133133
134134
135135def test_left_hash_hs256 ():
136- hsh = jws .left_hash (b 'Please take a moment to register today' )
137- assert hsh == b 'rCFHVJuxTqRxOsn2IUzgvA'
136+ hsh = jws .left_hash ('Please take a moment to register today' )
137+ assert hsh == 'rCFHVJuxTqRxOsn2IUzgvA'
138138
139139
140140def test_left_hash_hs512 ():
141- hsh = jws .left_hash (b 'Please take a moment to register today' , "HS512" )
142- assert hsh == b '_h6feWLt8zbYcOFnaBmekTzMJYEHdVTaXlDgJSWsEeY'
141+ hsh = jws .left_hash ('Please take a moment to register today' , "HS512" )
142+ assert hsh == '_h6feWLt8zbYcOFnaBmekTzMJYEHdVTaXlDgJSWsEeY'
143143
144144
145145def test_rs256 ():
You can’t perform that action at this time.
0 commit comments