mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Fix exception repr
This commit is contained in:
1 parent
378a36c7e1
commit
7bb530dd89
2 files changed
+1
-6
No files matched your search
@@ -86,8 +86,6 @@ class ExceptionClassTests(unittest.TestCase):
|
||||
self.assertEqual(given, expected, "%s: %s != %s" % (test_name,
|
||||
given, expected))
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_interface_single_arg(self):
|
||||
# Make sure interface works properly when given a single argument
|
||||
arg = "spam"
|
||||
|
||||
@@ -139,10 +139,7 @@ impl PyBaseException {
|
||||
fn repr(zelf: PyRef<Self>, vm: &VirtualMachine) -> String {
|
||||
let repr_args = exception_args_as_string(vm, zelf.args(), false);
|
||||
let cls = zelf.class();
|
||||
match repr_args.into_iter().exactly_one() {
|
||||
Ok(one) => format!("{}({},)", cls.name, one),
|
||||
Err(i) => format!("{}({})", cls.name, i.format(", ")),
|
||||
}
|
||||
format!("{}({})", cls.name, repr_args.iter().format(", "))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user