File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -326,8 +326,6 @@ def __len__(self):
326
326
return - 1
327
327
self .assertRaises (ValueError , bool , Eggs ())
328
328
329
- # TODO: RUSTPYTHON
330
- @unittest .expectedFailure
331
329
def test_from_bytes (self ):
332
330
self .assertIs (bool .from_bytes (b'\x00 ' * 8 , 'big' ), False )
333
331
self .assertIs (bool .from_bytes (b'abcd' , 'little' ), True )
Original file line number Diff line number Diff line change @@ -233,6 +233,12 @@ impl PyInt {
233
233
{
234
234
if cls. is ( & vm. ctx . types . int_type ) {
235
235
Ok ( vm. ctx . new_int ( value) . downcast ( ) . unwrap ( ) )
236
+ } else if cls. is ( & vm. ctx . types . bool_type ) {
237
+ Ok ( vm
238
+ . ctx
239
+ . new_bool ( !value. into ( ) . eq ( & BigInt :: zero ( ) ) )
240
+ . downcast ( )
241
+ . unwrap ( ) )
236
242
} else {
237
243
PyInt :: from ( value) . into_ref_with_type ( vm, cls)
238
244
}
You can’t perform that action at this time.
0 commit comments