mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Add more test for bytearray.pop and fix the panic message
This commit is contained in:
@@ -43,3 +43,12 @@ c = bytearray([123, 255, 111])
|
||||
assert len(c) == 3
|
||||
c.pop()
|
||||
assert len(c) == 2
|
||||
c.pop()
|
||||
c.pop()
|
||||
|
||||
try:
|
||||
c.pop()
|
||||
except IndexError:
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
|
||||
@@ -185,7 +185,7 @@ pub fn get_value<'a>(obj: &'a PyObjectRef) -> impl Deref<Target = Vec<u8>> + 'a
|
||||
if let PyObjectPayload::Bytes { ref value } = py_obj.payload {
|
||||
value
|
||||
} else {
|
||||
panic!("Inner error getting int {:?}", obj);
|
||||
panic!("Inner error getting bytearray {:?}", obj);
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -195,7 +195,7 @@ pub fn get_mut_value<'a>(obj: &'a PyObjectRef) -> impl DerefMut<Target = Vec<u8>
|
||||
if let PyObjectPayload::Bytes { ref mut value } = py_obj.payload {
|
||||
value
|
||||
} else {
|
||||
panic!("Inner error getting int {:?}", obj);
|
||||
panic!("Inner error getting bytearray {:?}", obj);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user