mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
fix maketrans (#5824)
This commit is contained in:
1 parent
0728da51fc
commit
33af632914
2 files changed
+4
-2
No files matched your search
Vendored
-2
@@ -378,8 +378,6 @@ class UnicodeTest(string_tests.CommonTest,
|
||||
self.assertRaises(ValueError, ('a' * 100).rindex, '\U00100304a')
|
||||
self.assertRaises(ValueError, ('\u0102' * 100).rindex, '\U00100304\u0102')
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_maketrans_translate(self):
|
||||
# these work with plain translate()
|
||||
self.checkequalnofix('bbbc', 'abababc', 'translate',
|
||||
|
||||
@@ -1416,6 +1416,10 @@ impl PyStr {
|
||||
"string keys in translate table must be of length 1".to_owned(),
|
||||
));
|
||||
}
|
||||
} else {
|
||||
return Err(vm.new_type_error(
|
||||
"keys in translate table must be strings or integers".to_owned(),
|
||||
));
|
||||
}
|
||||
}
|
||||
Ok(new_dict.to_pyobject(vm))
|
||||
|
||||
Reference in new issue
Block a user