◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
3 changes: 2 additions & 1 deletion extra_tests/snippets/bytes.py
Original file line number Diff line number Diff line change
@@ -633,7 +633,8 @@ def __bytes__(self):
assert id(a) == id(a)
assert id(a) != id(a * -1)
assert id(a) != id(a * 0)
assert id(a) == id(a * 1) # only case when `id` stays the same
assert id(a) != id(a * 2)


Expand Down
29 changes: 27 additions & 2 deletions extra_tests/snippets/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ def test_removeprefix():
assert s_uc.removeprefix('😱') == s_ref_uc[1:]
assert s_uc.removeprefix('😱fo') == s_ref_uc[3:]
assert s_uc.removeprefix('😱foo') == s_ref_uc[4:]
assert s_uc.removeprefix('🖖') == s_ref_uc
assert s_uc.removeprefix('foo') == s_ref_uc
assert s_uc.removeprefix(' ') == s_ref_uc
Expand Up @@ -676,7 +676,7 @@ def test_removesuffix():
assert s_uc.removesuffix('🖖') == s_ref_uc[:-1]
assert s_uc.removesuffix('oo🖖') == s_ref_uc[:-3]
assert s_uc.removesuffix('foo🖖') == s_ref_uc[:-4]
assert s_uc.removesuffix('😱') == s_ref_uc
assert s_uc.removesuffix('foo') == s_ref_uc
assert s_uc.removesuffix(' ') == s_ref_uc
Expand All @@ -702,3 +702,28 @@ def test_removesuffix_types():
skip_if_unsupported(3,9,test_removeprefix_types)
skip_if_unsupported(3,9,test_removesuffix)
skip_if_unsupported(3,9,test_removesuffix_types)
11 changes: 9 additions & 2 deletions vm/src/builtins/pystr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,15 @@ impl PyStr {

#[pymethod(name = "__rmul__")]
#[pymethod(magic)]
fn mul(&self, value: isize) -> String {
self.value.repeat(value.to_usize().unwrap_or(0))
}

#[pymethod(magic)]
Expand Down
Toggle all file notes Toggle all file annotations