mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Fix error messages in binary/ternary ops to match CPython format (#7625)
* Fix `divmod` error message to match CPython format * Fix ternary op error message separator to match CPython
This commit is contained in:
1 parent
57ca1d59a6
commit
67eedddcd7
2 files changed
+2
-4
No files matched your search
Vendored
-2
@@ -1669,7 +1669,6 @@ class FractionTest(unittest.TestCase):
|
||||
self.assertEqual(float(format(f, fmt2)), float(rhs))
|
||||
self.assertEqual(float(format(-f, fmt2)), float('-' + rhs))
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; TypeError: '%' not supported between instances of 'Fraction' and 'complex'
|
||||
def test_complex_handling(self):
|
||||
# See issue gh-102840 for more details.
|
||||
|
||||
@@ -1697,7 +1696,6 @@ class FractionTest(unittest.TestCase):
|
||||
message % ("divmod()", "complex", "Fraction"),
|
||||
divmod, b, a)
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; Wrong error message
|
||||
def test_three_argument_pow(self):
|
||||
message = "unsupported operand type(s) for ** or pow(): '%s', '%s', '%s'"
|
||||
self.assertRaisesMessage(TypeError,
|
||||
|
||||
@@ -372,7 +372,7 @@ impl VirtualMachine {
|
||||
} else {
|
||||
self.new_type_error(format!(
|
||||
"unsupported operand type(s) for {}: \
|
||||
'{}' and '{}', '{}'",
|
||||
'{}', '{}', '{}'",
|
||||
op_str,
|
||||
a.class(),
|
||||
b.class(),
|
||||
@@ -401,7 +401,7 @@ impl VirtualMachine {
|
||||
|
||||
binary_func!(_sub, Subtract, "-");
|
||||
binary_func!(_mod, Remainder, "%");
|
||||
binary_func!(_divmod, Divmod, "divmod");
|
||||
binary_func!(_divmod, Divmod, "divmod()");
|
||||
binary_func!(_lshift, Lshift, "<<");
|
||||
binary_func!(_rshift, Rshift, ">>");
|
||||
binary_func!(_and, And, "&");
|
||||
|
||||
Reference in new issue
Block a user