fix maketrans (#5824)

This commit is contained in:
Jeong, YunWon authored and GitHub committed 2025-06-23 11:43:18 +09:00
1 parent 0728da51fc
commit 33af632914
2 files changed
+4 -2

No files matched your search

-2
View File
@@ -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',
+4
View File
@@ -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))