mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
* Add str.__rmod__ method. * Add tests for str.__rmod__ method. * Improve test for str.__rmod__ method. * Change str.__rmod__ method return value type. * Format with rustfmt. * Remove not required code of str.__rmod__ method. * Improve with clippy.
This commit is contained in:
@@ -293,3 +293,6 @@ assert next(str_iter_reversed) == "2"
|
||||
assert next(str_iter_reversed) == "1"
|
||||
assert next(str_iter_reversed, None) == None
|
||||
assert_raises(StopIteration, lambda: next(str_iter_reversed))
|
||||
|
||||
assert str.__rmod__('%i', 30) == NotImplemented
|
||||
assert_raises(TypeError, lambda: str.__rmod__(30, '%i'))
|
||||
|
||||
@@ -518,6 +518,11 @@ impl PyString {
|
||||
do_cformat(vm, format_string, values.clone())
|
||||
}
|
||||
|
||||
#[pymethod(name = "__rmod__")]
|
||||
fn rmod(&self, _values: PyObjectRef, vm: &VirtualMachine) -> PyResult {
|
||||
Ok(vm.ctx.not_implemented())
|
||||
}
|
||||
|
||||
#[pymethod]
|
||||
fn format(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
|
||||
if args.args.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user