diff options
author | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2004-03-10 17:30:03 (GMT) |
---|---|---|
committer | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2004-03-10 17:30:03 (GMT) |
commit | 6cbba50a43cdb4c8584d418153d8e0c2683107cb (patch) | |
tree | 2d9b27503ce7f70d4e69059b77f71a7432d3db41 /Lib/test | |
parent | 66d31f8f3812f91d8d9bf7878f93fabe6f005082 (diff) | |
download | cpython-6cbba50a43cdb4c8584d418153d8e0c2683107cb.zip cpython-6cbba50a43cdb4c8584d418153d8e0c2683107cb.tar.gz cpython-6cbba50a43cdb4c8584d418153d8e0c2683107cb.tar.bz2 |
Make test_coercion.py less sensitive to platform fp quirks. Closes
SF bug #678265.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/output/test_coercion | 658 | ||||
-rw-r--r-- | Lib/test/test_coercion.py | 23 |
2 files changed, 348 insertions, 333 deletions
diff --git a/Lib/test/output/test_coercion b/Lib/test/output/test_coercion index dc74b37..ad35b60 100644 --- a/Lib/test/output/test_coercion +++ b/Lib/test/output/test_coercion @@ -35,18 +35,18 @@ test_coercion 2 **= 2 => 4 2 % 2 = 0 2 %= 2 => 0 -2 + (2+0j) = (4+0j) -2 += (2+0j) => (4+0j) -2 - (2+0j) = 0j -2 -= (2+0j) => 0j -2 * (2+0j) = (4+0j) -2 *= (2+0j) => (4+0j) -2 / (2+0j) = (1+0j) -2 /= (2+0j) => (1+0j) -2 ** (2+0j) = (4+0j) -2 **= (2+0j) => (4+0j) -2 % (2+0j) = 0j -2 %= (2+0j) => 0j +2 + (2+0j) = (4.0 + 0.0j) +2 += (2+0j) => (4.0 + 0.0j) +2 - (2+0j) = (0.0 + 0.0j) +2 -= (2+0j) => (0.0 + 0.0j) +2 * (2+0j) = (4.0 + 0.0j) +2 *= (2+0j) => (4.0 + 0.0j) +2 / (2+0j) = (1.0 + 0.0j) +2 /= (2+0j) => (1.0 + 0.0j) +2 ** (2+0j) = (4.0 + 0.0j) +2 **= (2+0j) => (4.0 + 0.0j) +2 % (2+0j) = (0.0 + 0.0j) +2 %= (2+0j) => (0.0 + 0.0j) 2 + [1] ... exceptions.TypeError 2 += [1] ... exceptions.TypeError 2 - [1] ... exceptions.TypeError @@ -83,18 +83,18 @@ test_coercion 2 **= None ... exceptions.TypeError 2 % None ... exceptions.TypeError 2 %= None ... exceptions.TypeError -2 + <MethodNumber 1> = 3 -2 += <MethodNumber 1> => 3 -2 - <MethodNumber 1> = 1 -2 -= <MethodNumber 1> => 1 -2 * <MethodNumber 1> = 2 -2 *= <MethodNumber 1> => 2 -2 / <MethodNumber 1> = 2 -2 /= <MethodNumber 1> => 2 -2 ** <MethodNumber 1> = 2 -2 **= <MethodNumber 1> => 2 -2 % <MethodNumber 1> = 0 -2 %= <MethodNumber 1> => 0 +2 + <MethodNumber 2> = 4 +2 += <MethodNumber 2> => 4 +2 - <MethodNumber 2> = 0 +2 -= <MethodNumber 2> => 0 +2 * <MethodNumber 2> = 4 +2 *= <MethodNumber 2> => 4 +2 / <MethodNumber 2> = 1 +2 /= <MethodNumber 2> => 1 +2 ** <MethodNumber 2> = 4 +2 **= <MethodNumber 2> => 4 +2 % <MethodNumber 2> = 0 +2 %= <MethodNumber 2> => 0 2 + <CoerceNumber 2> = 4 2 += <CoerceNumber 2> => 4 2 - <CoerceNumber 2> = 0 @@ -143,18 +143,18 @@ test_coercion 4.0 **= 2 => 16.0 4.0 % 2 = 0.0 4.0 %= 2 => 0.0 -4.0 + (2+0j) = (6+0j) -4.0 += (2+0j) => (6+0j) -4.0 - (2+0j) = (2+0j) -4.0 -= (2+0j) => (2+0j) -4.0 * (2+0j) = (8+0j) -4.0 *= (2+0j) => (8+0j) -4.0 / (2+0j) = (2+0j) -4.0 /= (2+0j) => (2+0j) -4.0 ** (2+0j) = (16+0j) -4.0 **= (2+0j) => (16+0j) -4.0 % (2+0j) = 0j -4.0 %= (2+0j) => 0j +4.0 + (2+0j) = (6.0 + 0.0j) +4.0 += (2+0j) => (6.0 + 0.0j) +4.0 - (2+0j) = (2.0 + 0.0j) +4.0 -= (2+0j) => (2.0 + 0.0j) +4.0 * (2+0j) = (8.0 + 0.0j) +4.0 *= (2+0j) => (8.0 + 0.0j) +4.0 / (2+0j) = (2.0 + 0.0j) +4.0 /= (2+0j) => (2.0 + 0.0j) +4.0 ** (2+0j) = (16.0 + 0.0j) +4.0 **= (2+0j) => (16.0 + 0.0j) +4.0 % (2+0j) = (0.0 + 0.0j) +4.0 %= (2+0j) => (0.0 + 0.0j) 4.0 + [1] ... exceptions.TypeError 4.0 += [1] ... exceptions.TypeError 4.0 - [1] ... exceptions.TypeError @@ -191,18 +191,18 @@ test_coercion 4.0 **= None ... exceptions.TypeError 4.0 % None ... exceptions.TypeError 4.0 %= None ... exceptions.TypeError -4.0 + <MethodNumber 1> = 5.0 -4.0 += <MethodNumber 1> => 5.0 -4.0 - <MethodNumber 1> = 3.0 -4.0 -= <MethodNumber 1> => 3.0 -4.0 * <MethodNumber 1> = 4.0 -4.0 *= <MethodNumber 1> => 4.0 -4.0 / <MethodNumber 1> = 4.0 -4.0 /= <MethodNumber 1> => 4.0 -4.0 ** <MethodNumber 1> = 4.0 -4.0 **= <MethodNumber 1> => 4.0 -4.0 % <MethodNumber 1> = 0.0 -4.0 %= <MethodNumber 1> => 0.0 +4.0 + <MethodNumber 2> = 6.0 +4.0 += <MethodNumber 2> => 6.0 +4.0 - <MethodNumber 2> = 2.0 +4.0 -= <MethodNumber 2> => 2.0 +4.0 * <MethodNumber 2> = 8.0 +4.0 *= <MethodNumber 2> => 8.0 +4.0 / <MethodNumber 2> = 2.0 +4.0 /= <MethodNumber 2> => 2.0 +4.0 ** <MethodNumber 2> = 16.0 +4.0 **= <MethodNumber 2> => 16.0 +4.0 % <MethodNumber 2> = 0.0 +4.0 %= <MethodNumber 2> => 0.0 4.0 + <CoerceNumber 2> = 6.0 4.0 += <CoerceNumber 2> => 6.0 4.0 - <CoerceNumber 2> = 2.0 @@ -251,18 +251,18 @@ test_coercion 2 **= 2 => 4 2 % 2 = 0 2 %= 2 => 0 -2 + (2+0j) = (4+0j) -2 += (2+0j) => (4+0j) -2 - (2+0j) = 0j -2 -= (2+0j) => 0j -2 * (2+0j) = (4+0j) -2 *= (2+0j) => (4+0j) -2 / (2+0j) = (1+0j) -2 /= (2+0j) => (1+0j) -2 ** (2+0j) = (4+0j) -2 **= (2+0j) => (4+0j) -2 % (2+0j) = 0j -2 %= (2+0j) => 0j +2 + (2+0j) = (4.0 + 0.0j) +2 += (2+0j) => (4.0 + 0.0j) +2 - (2+0j) = (0.0 + 0.0j) +2 -= (2+0j) => (0.0 + 0.0j) +2 * (2+0j) = (4.0 + 0.0j) +2 *= (2+0j) => (4.0 + 0.0j) +2 / (2+0j) = (1.0 + 0.0j) +2 /= (2+0j) => (1.0 + 0.0j) +2 ** (2+0j) = (4.0 + 0.0j) +2 **= (2+0j) => (4.0 + 0.0j) +2 % (2+0j) = (0.0 + 0.0j) +2 %= (2+0j) => (0.0 + 0.0j) 2 + [1] ... exceptions.TypeError 2 += [1] ... exceptions.TypeError 2 - [1] ... exceptions.TypeError @@ -299,18 +299,18 @@ test_coercion 2 **= None ... exceptions.TypeError 2 % None ... exceptions.TypeError 2 %= None ... exceptions.TypeError -2 + <MethodNumber 1> = 3 -2 += <MethodNumber 1> => 3 -2 - <MethodNumber 1> = 1 -2 -= <MethodNumber 1> => 1 -2 * <MethodNumber 1> = 2 -2 *= <MethodNumber 1> => 2 -2 / <MethodNumber 1> = 2 -2 /= <MethodNumber 1> => 2 -2 ** <MethodNumber 1> = 2 -2 **= <MethodNumber 1> => 2 -2 % <MethodNumber 1> = 0 -2 %= <MethodNumber 1> => 0 +2 + <MethodNumber 2> = 4 +2 += <MethodNumber 2> => 4 +2 - <MethodNumber 2> = 0 +2 -= <MethodNumber 2> => 0 +2 * <MethodNumber 2> = 4 +2 *= <MethodNumber 2> => 4 +2 / <MethodNumber 2> = 1 +2 /= <MethodNumber 2> => 1 +2 ** <MethodNumber 2> = 4 +2 **= <MethodNumber 2> => 4 +2 % <MethodNumber 2> = 0 +2 %= <MethodNumber 2> => 0 2 + <CoerceNumber 2> = 4 2 += <CoerceNumber 2> => 4 2 - <CoerceNumber 2> = 0 @@ -323,54 +323,54 @@ test_coercion 2 **= <CoerceNumber 2> => 4 2 % <CoerceNumber 2> = 0 2 %= <CoerceNumber 2> => 0 -(2+0j) + 2 = (4+0j) -(2+0j) += 2 => (4+0j) -(2+0j) - 2 = 0j -(2+0j) -= 2 => 0j -(2+0j) * 2 = (4+0j) -(2+0j) *= 2 => (4+0j) -(2+0j) / 2 = (1+0j) -(2+0j) /= 2 => (1+0j) -(2+0j) ** 2 = (4+0j) -(2+0j) **= 2 => (4+0j) -(2+0j) % 2 = 0j -(2+0j) %= 2 => 0j -(2+0j) + 4.0 = (6+0j) -(2+0j) += 4.0 => (6+0j) -(2+0j) - 4.0 = (-2+0j) -(2+0j) -= 4.0 => (-2+0j) -(2+0j) * 4.0 = (8+0j) -(2+0j) *= 4.0 => (8+0j) -(2+0j) / 4.0 = (0.5+0j) -(2+0j) /= 4.0 => (0.5+0j) -(2+0j) ** 4.0 = (16+0j) -(2+0j) **= 4.0 => (16+0j) -(2+0j) % 4.0 = (2+0j) -(2+0j) %= 4.0 => (2+0j) -(2+0j) + 2 = (4+0j) -(2+0j) += 2 => (4+0j) -(2+0j) - 2 = 0j -(2+0j) -= 2 => 0j -(2+0j) * 2 = (4+0j) -(2+0j) *= 2 => (4+0j) -(2+0j) / 2 = (1+0j) -(2+0j) /= 2 => (1+0j) -(2+0j) ** 2 = (4+0j) -(2+0j) **= 2 => (4+0j) -(2+0j) % 2 = 0j -(2+0j) %= 2 => 0j -(2+0j) + (2+0j) = (4+0j) -(2+0j) += (2+0j) => (4+0j) -(2+0j) - (2+0j) = 0j -(2+0j) -= (2+0j) => 0j -(2+0j) * (2+0j) = (4+0j) -(2+0j) *= (2+0j) => (4+0j) -(2+0j) / (2+0j) = (1+0j) -(2+0j) /= (2+0j) => (1+0j) -(2+0j) ** (2+0j) = (4+0j) -(2+0j) **= (2+0j) => (4+0j) -(2+0j) % (2+0j) = 0j -(2+0j) %= (2+0j) => 0j +(2+0j) + 2 = (4.0 + 0.0j) +(2+0j) += 2 => (4.0 + 0.0j) +(2+0j) - 2 = (0.0 + 0.0j) +(2+0j) -= 2 => (0.0 + 0.0j) +(2+0j) * 2 = (4.0 + 0.0j) +(2+0j) *= 2 => (4.0 + 0.0j) +(2+0j) / 2 = (1.0 + 0.0j) +(2+0j) /= 2 => (1.0 + 0.0j) +(2+0j) ** 2 = (4.0 + 0.0j) +(2+0j) **= 2 => (4.0 + 0.0j) +(2+0j) % 2 = (0.0 + 0.0j) +(2+0j) %= 2 => (0.0 + 0.0j) +(2+0j) + 4.0 = (6.0 + 0.0j) +(2+0j) += 4.0 => (6.0 + 0.0j) +(2+0j) - 4.0 = (-2.0 + 0.0j) +(2+0j) -= 4.0 => (-2.0 + 0.0j) +(2+0j) * 4.0 = (8.0 + 0.0j) +(2+0j) *= 4.0 => (8.0 + 0.0j) +(2+0j) / 4.0 = (0.5 + 0.0j) +(2+0j) /= 4.0 => (0.5 + 0.0j) +(2+0j) ** 4.0 = (16.0 + 0.0j) +(2+0j) **= 4.0 => (16.0 + 0.0j) +(2+0j) % 4.0 = (2.0 + 0.0j) +(2+0j) %= 4.0 => (2.0 + 0.0j) +(2+0j) + 2 = (4.0 + 0.0j) +(2+0j) += 2 => (4.0 + 0.0j) +(2+0j) - 2 = (0.0 + 0.0j) +(2+0j) -= 2 => (0.0 + 0.0j) +(2+0j) * 2 = (4.0 + 0.0j) +(2+0j) *= 2 => (4.0 + 0.0j) +(2+0j) / 2 = (1.0 + 0.0j) +(2+0j) /= 2 => (1.0 + 0.0j) +(2+0j) ** 2 = (4.0 + 0.0j) +(2+0j) **= 2 => (4.0 + 0.0j) +(2+0j) % 2 = (0.0 + 0.0j) +(2+0j) %= 2 => (0.0 + 0.0j) +(2+0j) + (2+0j) = (4.0 + 0.0j) +(2+0j) += (2+0j) => (4.0 + 0.0j) +(2+0j) - (2+0j) = (0.0 + 0.0j) +(2+0j) -= (2+0j) => (0.0 + 0.0j) +(2+0j) * (2+0j) = (4.0 + 0.0j) +(2+0j) *= (2+0j) => (4.0 + 0.0j) +(2+0j) / (2+0j) = (1.0 + 0.0j) +(2+0j) /= (2+0j) => (1.0 + 0.0j) +(2+0j) ** (2+0j) = (4.0 + 0.0j) +(2+0j) **= (2+0j) => (4.0 + 0.0j) +(2+0j) % (2+0j) = (0.0 + 0.0j) +(2+0j) %= (2+0j) => (0.0 + 0.0j) (2+0j) + [1] ... exceptions.TypeError (2+0j) += [1] ... exceptions.TypeError (2+0j) - [1] ... exceptions.TypeError @@ -407,30 +407,30 @@ test_coercion (2+0j) **= None ... exceptions.TypeError (2+0j) % None ... exceptions.TypeError (2+0j) %= None ... exceptions.TypeError -(2+0j) + <MethodNumber 1> = (3+0j) -(2+0j) += <MethodNumber 1> => (3+0j) -(2+0j) - <MethodNumber 1> = (1+0j) -(2+0j) -= <MethodNumber 1> => (1+0j) -(2+0j) * <MethodNumber 1> = (2+0j) -(2+0j) *= <MethodNumber 1> => (2+0j) -(2+0j) / <MethodNumber 1> = (2+0j) -(2+0j) /= <MethodNumber 1> => (2+0j) -(2+0j) ** <MethodNumber 1> = (2+0j) -(2+0j) **= <MethodNumber 1> => (2+0j) -(2+0j) % <MethodNumber 1> = 0j -(2+0j) %= <MethodNumber 1> => 0j -(2+0j) + <CoerceNumber 2> = (4+0j) -(2+0j) += <CoerceNumber 2> => (4+0j) -(2+0j) - <CoerceNumber 2> = 0j -(2+0j) -= <CoerceNumber 2> => 0j -(2+0j) * <CoerceNumber 2> = (4+0j) -(2+0j) *= <CoerceNumber 2> => (4+0j) -(2+0j) / <CoerceNumber 2> = (1+0j) -(2+0j) /= <CoerceNumber 2> => (1+0j) -(2+0j) ** <CoerceNumber 2> = (4+0j) -(2+0j) **= <CoerceNumber 2> => (4+0j) -(2+0j) % <CoerceNumber 2> = 0j -(2+0j) %= <CoerceNumber 2> => 0j +(2+0j) + <MethodNumber 2> = (4.0 + 0.0j) +(2+0j) += <MethodNumber 2> => (4.0 + 0.0j) +(2+0j) - <MethodNumber 2> = (0.0 + 0.0j) +(2+0j) -= <MethodNumber 2> => (0.0 + 0.0j) +(2+0j) * <MethodNumber 2> = (4.0 + 0.0j) +(2+0j) *= <MethodNumber 2> => (4.0 + 0.0j) +(2+0j) / <MethodNumber 2> = (1.0 + 0.0j) +(2+0j) /= <MethodNumber 2> => (1.0 + 0.0j) +(2+0j) ** <MethodNumber 2> = (4.0 + 0.0j) +(2+0j) **= <MethodNumber 2> => (4.0 + 0.0j) +(2+0j) % <MethodNumber 2> = (0.0 + 0.0j) +(2+0j) %= <MethodNumber 2> => (0.0 + 0.0j) +(2+0j) + <CoerceNumber 2> = (4.0 + 0.0j) +(2+0j) += <CoerceNumber 2> => (4.0 + 0.0j) +(2+0j) - <CoerceNumber 2> = (0.0 + 0.0j) +(2+0j) -= <CoerceNumber 2> => (0.0 + 0.0j) +(2+0j) * <CoerceNumber 2> = (4.0 + 0.0j) +(2+0j) *= <CoerceNumber 2> => (4.0 + 0.0j) +(2+0j) / <CoerceNumber 2> = (1.0 + 0.0j) +(2+0j) /= <CoerceNumber 2> => (1.0 + 0.0j) +(2+0j) ** <CoerceNumber 2> = (4.0 + 0.0j) +(2+0j) **= <CoerceNumber 2> => (4.0 + 0.0j) +(2+0j) % <CoerceNumber 2> = (0.0 + 0.0j) +(2+0j) %= <CoerceNumber 2> => (0.0 + 0.0j) [1] + 2 ... exceptions.TypeError [1] += 2 ... exceptions.TypeError [1] - 2 ... exceptions.TypeError @@ -515,18 +515,18 @@ test_coercion [1] **= None ... exceptions.TypeError [1] % None ... exceptions.TypeError [1] %= None ... exceptions.TypeError -[1] + <MethodNumber 1> ... exceptions.TypeError -[1] += <MethodNumber 1> ... exceptions.TypeError -[1] - <MethodNumber 1> ... exceptions.TypeError -[1] -= <MethodNumber 1> ... exceptions.TypeError -[1] * <MethodNumber 1> = [1] -[1] *= <MethodNumber 1> => [1] -[1] / <MethodNumber 1> ... exceptions.TypeError -[1] /= <MethodNumber 1> ... exceptions.TypeError -[1] ** <MethodNumber 1> ... exceptions.TypeError -[1] **= <MethodNumber 1> ... exceptions.TypeError -[1] % <MethodNumber 1> ... exceptions.TypeError -[1] %= <MethodNumber 1> ... exceptions.TypeError +[1] + <MethodNumber 2> ... exceptions.TypeError +[1] += <MethodNumber 2> ... exceptions.TypeError +[1] - <MethodNumber 2> ... exceptions.TypeError +[1] -= <MethodNumber 2> ... exceptions.TypeError +[1] * <MethodNumber 2> = [1, 1] +[1] *= <MethodNumber 2> => [1, 1] +[1] / <MethodNumber 2> ... exceptions.TypeError +[1] /= <MethodNumber 2> ... exceptions.TypeError +[1] ** <MethodNumber 2> ... exceptions.TypeError +[1] **= <MethodNumber 2> ... exceptions.TypeError +[1] % <MethodNumber 2> ... exceptions.TypeError +[1] %= <MethodNumber 2> ... exceptions.TypeError [1] + <CoerceNumber 2> ... exceptions.TypeError [1] += <CoerceNumber 2> ... exceptions.TypeError [1] - <CoerceNumber 2> ... exceptions.TypeError @@ -623,18 +623,18 @@ test_coercion (2,) **= None ... exceptions.TypeError (2,) % None ... exceptions.TypeError (2,) %= None ... exceptions.TypeError -(2,) + <MethodNumber 1> ... exceptions.TypeError -(2,) += <MethodNumber 1> ... exceptions.TypeError -(2,) - <MethodNumber 1> ... exceptions.TypeError -(2,) -= <MethodNumber 1> ... exceptions.TypeError -(2,) * <MethodNumber 1> = (2,) -(2,) *= <MethodNumber 1> => (2,) -(2,) / <MethodNumber 1> ... exceptions.TypeError -(2,) /= <MethodNumber 1> ... exceptions.TypeError -(2,) ** <MethodNumber 1> ... exceptions.TypeError -(2,) **= <MethodNumber 1> ... exceptions.TypeError -(2,) % <MethodNumber 1> ... exceptions.TypeError -(2,) %= <MethodNumber 1> ... exceptions.TypeError +(2,) + <MethodNumber 2> ... exceptions.TypeError +(2,) += <MethodNumber 2> ... exceptions.TypeError +(2,) - <MethodNumber 2> ... exceptions.TypeError +(2,) -= <MethodNumber 2> ... exceptions.TypeError +(2,) * <MethodNumber 2> = (2, 2) +(2,) *= <MethodNumber 2> => (2, 2) +(2,) / <MethodNumber 2> ... exceptions.TypeError +(2,) /= <MethodNumber 2> ... exceptions.TypeError +(2,) ** <MethodNumber 2> ... exceptions.TypeError +(2,) **= <MethodNumber 2> ... exceptions.TypeError +(2,) % <MethodNumber 2> ... exceptions.TypeError +(2,) %= <MethodNumber 2> ... exceptions.TypeError (2,) + <CoerceNumber 2> ... exceptions.TypeError (2,) += <CoerceNumber 2> ... exceptions.TypeError (2,) - <CoerceNumber 2> ... exceptions.TypeError @@ -731,18 +731,18 @@ None ** None ... exceptions.TypeError None **= None ... exceptions.TypeError None % None ... exceptions.TypeError None %= None ... exceptions.TypeError -None + <MethodNumber 1> ... exceptions.TypeError -None += <MethodNumber 1> ... exceptions.TypeError -None - <MethodNumber 1> ... exceptions.TypeError -None -= <MethodNumber 1> ... exceptions.TypeError -None * <MethodNumber 1> ... exceptions.TypeError -None *= <MethodNumber 1> ... exceptions.TypeError -None / <MethodNumber 1> ... exceptions.TypeError -None /= <MethodNumber 1> ... exceptions.TypeError -None ** <MethodNumber 1> ... exceptions.TypeError -None **= <MethodNumber 1> ... exceptions.TypeError -None % <MethodNumber 1> ... exceptions.TypeError -None %= <MethodNumber 1> ... exceptions.TypeError +None + <MethodNumber 2> ... exceptions.TypeError +None += <MethodNumber 2> ... exceptions.TypeError +None - <MethodNumber 2> ... exceptions.TypeError +None -= <MethodNumber 2> ... exceptions.TypeError +None * <MethodNumber 2> ... exceptions.TypeError +None *= <MethodNumber 2> ... exceptions.TypeError +None / <MethodNumber 2> ... exceptions.TypeError +None /= <MethodNumber 2> ... exceptions.TypeError +None ** <MethodNumber 2> ... exceptions.TypeError +None **= <MethodNumber 2> ... exceptions.TypeError +None % <MethodNumber 2> ... exceptions.TypeError +None %= <MethodNumber 2> ... exceptions.TypeError None + <CoerceNumber 2> ... exceptions.TypeError None += <CoerceNumber 2> ... exceptions.TypeError None - <CoerceNumber 2> ... exceptions.TypeError @@ -755,114 +755,114 @@ None ** <CoerceNumber 2> ... exceptions.TypeError None **= <CoerceNumber 2> ... exceptions.TypeError None % <CoerceNumber 2> ... exceptions.TypeError None %= <CoerceNumber 2> ... exceptions.TypeError -<MethodNumber 1> + 2 = 3 -<MethodNumber 1> += 2 => 3 -<MethodNumber 1> - 2 = -1 -<MethodNumber 1> -= 2 => -1 -<MethodNumber 1> * 2 = 2 -<MethodNumber 1> *= 2 => 2 -<MethodNumber 1> / 2 = 0 -<MethodNumber 1> /= 2 => 0 -<MethodNumber 1> ** 2 = 1 -<MethodNumber 1> **= 2 => 1 -<MethodNumber 1> % 2 = 1 -<MethodNumber 1> %= 2 => 1 -<MethodNumber 1> + 4.0 = 5.0 -<MethodNumber 1> += 4.0 => 5.0 -<MethodNumber 1> - 4.0 = -3.0 -<MethodNumber 1> -= 4.0 => -3.0 -<MethodNumber 1> * 4.0 = 4.0 -<MethodNumber 1> *= 4.0 => 4.0 -<MethodNumber 1> / 4.0 = 0.25 -<MethodNumber 1> /= 4.0 => 0.25 -<MethodNumber 1> ** 4.0 = 1.0 -<MethodNumber 1> **= 4.0 => 1.0 -<MethodNumber 1> % 4.0 = 1.0 -<MethodNumber 1> %= 4.0 => 1.0 -<MethodNumber 1> + 2 = 3 -<MethodNumber 1> += 2 => 3 -<MethodNumber 1> - 2 = -1 -<MethodNumber 1> -= 2 => -1 -<MethodNumber 1> * 2 = 2 -<MethodNumber 1> *= 2 => 2 -<MethodNumber 1> / 2 = 0 -<MethodNumber 1> /= 2 => 0 -<MethodNumber 1> ** 2 = 1 -<MethodNumber 1> **= 2 => 1 -<MethodNumber 1> % 2 = 1 -<MethodNumber 1> %= 2 => 1 -<MethodNumber 1> + (2+0j) = (3+0j) -<MethodNumber 1> += (2+0j) => (3+0j) -<MethodNumber 1> - (2+0j) = (-1+0j) -<MethodNumber 1> -= (2+0j) => (-1+0j) -<MethodNumber 1> * (2+0j) = (2+0j) -<MethodNumber 1> *= (2+0j) => (2+0j) -<MethodNumber 1> / (2+0j) = (0.5+0j) -<MethodNumber 1> /= (2+0j) => (0.5+0j) -<MethodNumber 1> ** (2+0j) = (1+0j) -<MethodNumber 1> **= (2+0j) => (1+0j) -<MethodNumber 1> % (2+0j) = (1+0j) -<MethodNumber 1> %= (2+0j) => (1+0j) -<MethodNumber 1> + [1] ... exceptions.TypeError -<MethodNumber 1> += [1] ... exceptions.TypeError -<MethodNumber 1> - [1] ... exceptions.TypeError -<MethodNumber 1> -= [1] ... exceptions.TypeError -<MethodNumber 1> * [1] = [1] -<MethodNumber 1> *= [1] => [1] -<MethodNumber 1> / [1] ... exceptions.TypeError -<MethodNumber 1> /= [1] ... exceptions.TypeError -<MethodNumber 1> ** [1] ... exceptions.TypeError -<MethodNumber 1> **= [1] ... exceptions.TypeError -<MethodNumber 1> % [1] ... exceptions.TypeError -<MethodNumber 1> %= [1] ... exceptions.TypeError -<MethodNumber 1> + (2,) ... exceptions.TypeError -<MethodNumber 1> += (2,) ... exceptions.TypeError -<MethodNumber 1> - (2,) ... exceptions.TypeError -<MethodNumber 1> -= (2,) ... exceptions.TypeError -<MethodNumber 1> * (2,) = (2,) -<MethodNumber 1> *= (2,) => (2,) -<MethodNumber 1> / (2,) ... exceptions.TypeError -<MethodNumber 1> /= (2,) ... exceptions.TypeError -<MethodNumber 1> ** (2,) ... exceptions.TypeError -<MethodNumber 1> **= (2,) ... exceptions.TypeError -<MethodNumber 1> % (2,) ... exceptions.TypeError -<MethodNumber 1> %= (2,) ... exceptions.TypeError -<MethodNumber 1> + None ... exceptions.TypeError -<MethodNumber 1> += None ... exceptions.TypeError -<MethodNumber 1> - None ... exceptions.TypeError -<MethodNumber 1> -= None ... exceptions.TypeError -<MethodNumber 1> * None ... exceptions.TypeError -<MethodNumber 1> *= None ... exceptions.TypeError -<MethodNumber 1> / None ... exceptions.TypeError -<MethodNumber 1> /= None ... exceptions.TypeError -<MethodNumber 1> ** None ... exceptions.TypeError -<MethodNumber 1> **= None ... exceptions.TypeError -<MethodNumber 1> % None ... exceptions.TypeError -<MethodNumber 1> %= None ... exceptions.TypeError -<MethodNumber 1> + <MethodNumber 1> = 2 -<MethodNumber 1> += <MethodNumber 1> => 2 -<MethodNumber 1> - <MethodNumber 1> = 0 -<MethodNumber 1> -= <MethodNumber 1> => 0 -<MethodNumber 1> * <MethodNumber 1> = 1 -<MethodNumber 1> *= <MethodNumber 1> => 1 -<MethodNumber 1> / <MethodNumber 1> = 1 -<MethodNumber 1> /= <MethodNumber 1> => 1 -<MethodNumber 1> ** <MethodNumber 1> = 1 -<MethodNumber 1> **= <MethodNumber 1> => 1 -<MethodNumber 1> % <MethodNumber 1> = 0 -<MethodNumber 1> %= <MethodNumber 1> => 0 -<MethodNumber 1> + <CoerceNumber 2> = 3 -<MethodNumber 1> += <CoerceNumber 2> => 3 -<MethodNumber 1> - <CoerceNumber 2> = -1 -<MethodNumber 1> -= <CoerceNumber 2> => -1 -<MethodNumber 1> * <CoerceNumber 2> = 2 -<MethodNumber 1> *= <CoerceNumber 2> => 2 -<MethodNumber 1> / <CoerceNumber 2> = 0 -<MethodNumber 1> /= <CoerceNumber 2> => 0 -<MethodNumber 1> ** <CoerceNumber 2> = 1 -<MethodNumber 1> **= <CoerceNumber 2> => 1 -<MethodNumber 1> % <CoerceNumber 2> = 1 -<MethodNumber 1> %= <CoerceNumber 2> => 1 +<MethodNumber 2> + 2 = 4 +<MethodNumber 2> += 2 => 4 +<MethodNumber 2> - 2 = 0 +<MethodNumber 2> -= 2 => 0 +<MethodNumber 2> * 2 = 4 +<MethodNumber 2> *= 2 => 4 +<MethodNumber 2> / 2 = 1 +<MethodNumber 2> /= 2 => 1 +<MethodNumber 2> ** 2 = 4 +<MethodNumber 2> **= 2 => 4 +<MethodNumber 2> % 2 = 0 +<MethodNumber 2> %= 2 => 0 +<MethodNumber 2> + 4.0 = 6.0 +<MethodNumber 2> += 4.0 => 6.0 +<MethodNumber 2> - 4.0 = -2.0 +<MethodNumber 2> -= 4.0 => -2.0 +<MethodNumber 2> * 4.0 = 8.0 +<MethodNumber 2> *= 4.0 => 8.0 +<MethodNumber 2> / 4.0 = 0.5 +<MethodNumber 2> /= 4.0 => 0.5 +<MethodNumber 2> ** 4.0 = 16.0 +<MethodNumber 2> **= 4.0 => 16.0 +<MethodNumber 2> % 4.0 = 2.0 +<MethodNumber 2> %= 4.0 => 2.0 +<MethodNumber 2> + 2 = 4 +<MethodNumber 2> += 2 => 4 +<MethodNumber 2> - 2 = 0 +<MethodNumber 2> -= 2 => 0 +<MethodNumber 2> * 2 = 4 +<MethodNumber 2> *= 2 => 4 +<MethodNumber 2> / 2 = 1 +<MethodNumber 2> /= 2 => 1 +<MethodNumber 2> ** 2 = 4 +<MethodNumber 2> **= 2 => 4 +<MethodNumber 2> % 2 = 0 +<MethodNumber 2> %= 2 => 0 +<MethodNumber 2> + (2+0j) = (4.0 + 0.0j) +<MethodNumber 2> += (2+0j) => (4.0 + 0.0j) +<MethodNumber 2> - (2+0j) = (0.0 + 0.0j) +<MethodNumber 2> -= (2+0j) => (0.0 + 0.0j) +<MethodNumber 2> * (2+0j) = (4.0 + 0.0j) +<MethodNumber 2> *= (2+0j) => (4.0 + 0.0j) +<MethodNumber 2> / (2+0j) = (1.0 + 0.0j) +<MethodNumber 2> /= (2+0j) => (1.0 + 0.0j) +<MethodNumber 2> ** (2+0j) = (4.0 + 0.0j) +<MethodNumber 2> **= (2+0j) => (4.0 + 0.0j) +<MethodNumber 2> % (2+0j) = (0.0 + 0.0j) +<MethodNumber 2> %= (2+0j) => (0.0 + 0.0j) +<MethodNumber 2> + [1] ... exceptions.TypeError +<MethodNumber 2> += [1] ... exceptions.TypeError +<MethodNumber 2> - [1] ... exceptions.TypeError +<MethodNumber 2> -= [1] ... exceptions.TypeError +<MethodNumber 2> * [1] = [1, 1] +<MethodNumber 2> *= [1] => [1, 1] +<MethodNumber 2> / [1] ... exceptions.TypeError +<MethodNumber 2> /= [1] ... exceptions.TypeError +<MethodNumber 2> ** [1] ... exceptions.TypeError +<MethodNumber 2> **= [1] ... exceptions.TypeError +<MethodNumber 2> % [1] ... exceptions.TypeError +<MethodNumber 2> %= [1] ... exceptions.TypeError +<MethodNumber 2> + (2,) ... exceptions.TypeError +<MethodNumber 2> += (2,) ... exceptions.TypeError +<MethodNumber 2> - (2,) ... exceptions.TypeError +<MethodNumber 2> -= (2,) ... exceptions.TypeError +<MethodNumber 2> * (2,) = (2, 2) +<MethodNumber 2> *= (2,) => (2, 2) +<MethodNumber 2> / (2,) ... exceptions.TypeError +<MethodNumber 2> /= (2,) ... exceptions.TypeError +<MethodNumber 2> ** (2,) ... exceptions.TypeError +<MethodNumber 2> **= (2,) ... exceptions.TypeError +<MethodNumber 2> % (2,) ... exceptions.TypeError +<MethodNumber 2> %= (2,) ... exceptions.TypeError +<MethodNumber 2> + None ... exceptions.TypeError +<MethodNumber 2> += None ... exceptions.TypeError +<MethodNumber 2> - None ... exceptions.TypeError +<MethodNumber 2> -= None ... exceptions.TypeError +<MethodNumber 2> * None ... exceptions.TypeError +<MethodNumber 2> *= None ... exceptions.TypeError +<MethodNumber 2> / None ... exceptions.TypeError +<MethodNumber 2> /= None ... exceptions.TypeError +<MethodNumber 2> ** None ... exceptions.TypeError +<MethodNumber 2> **= None ... exceptions.TypeError +<MethodNumber 2> % None ... exceptions.TypeError +<MethodNumber 2> %= None ... exceptions.TypeError +<MethodNumber 2> + <MethodNumber 2> = 4 +<MethodNumber 2> += <MethodNumber 2> => 4 +<MethodNumber 2> - <MethodNumber 2> = 0 +<MethodNumber 2> -= <MethodNumber 2> => 0 +<MethodNumber 2> * <MethodNumber 2> = 4 +<MethodNumber 2> *= <MethodNumber 2> => 4 +<MethodNumber 2> / <MethodNumber 2> = 1 +<MethodNumber 2> /= <MethodNumber 2> => 1 +<MethodNumber 2> ** <MethodNumber 2> = 4 +<MethodNumber 2> **= <MethodNumber 2> => 4 +<MethodNumber 2> % <MethodNumber 2> = 0 +<MethodNumber 2> %= <MethodNumber 2> => 0 +<MethodNumber 2> + <CoerceNumber 2> = 4 +<MethodNumber 2> += <CoerceNumber 2> => 4 +<MethodNumber 2> - <CoerceNumber 2> = 0 +<MethodNumber 2> -= <CoerceNumber 2> => 0 +<MethodNumber 2> * <CoerceNumber 2> = 4 +<MethodNumber 2> *= <CoerceNumber 2> => 4 +<MethodNumber 2> / <CoerceNumber 2> = 1 +<MethodNumber 2> /= <CoerceNumber 2> => 1 +<MethodNumber 2> ** <CoerceNumber 2> = 4 +<MethodNumber 2> **= <CoerceNumber 2> => 4 +<MethodNumber 2> % <CoerceNumber 2> = 0 +<MethodNumber 2> %= <CoerceNumber 2> => 0 <CoerceNumber 2> + 2 = 4 <CoerceNumber 2> += 2 => 4 <CoerceNumber 2> - 2 = 0 @@ -899,18 +899,18 @@ None %= <CoerceNumber 2> ... exceptions.TypeError <CoerceNumber 2> **= 2 => 4 <CoerceNumber 2> % 2 = 0 <CoerceNumber 2> %= 2 => 0 -<CoerceNumber 2> + (2+0j) = (4+0j) -<CoerceNumber 2> += (2+0j) => (4+0j) -<CoerceNumber 2> - (2+0j) = 0j -<CoerceNumber 2> -= (2+0j) => 0j -<CoerceNumber 2> * (2+0j) = (4+0j) -<CoerceNumber 2> *= (2+0j) => (4+0j) -<CoerceNumber 2> / (2+0j) = (1+0j) -<CoerceNumber 2> /= (2+0j) => (1+0j) -<CoerceNumber 2> ** (2+0j) = (4+0j) -<CoerceNumber 2> **= (2+0j) => (4+0j) -<CoerceNumber 2> % (2+0j) = 0j -<CoerceNumber 2> %= (2+0j) => 0j +<CoerceNumber 2> + (2+0j) = (4.0 + 0.0j) +<CoerceNumber 2> += (2+0j) => (4.0 + 0.0j) +<CoerceNumber 2> - (2+0j) = (0.0 + 0.0j) +<CoerceNumber 2> -= (2+0j) => (0.0 + 0.0j) +<CoerceNumber 2> * (2+0j) = (4.0 + 0.0j) +<CoerceNumber 2> *= (2+0j) => (4.0 + 0.0j) +<CoerceNumber 2> / (2+0j) = (1.0 + 0.0j) +<CoerceNumber 2> /= (2+0j) => (1.0 + 0.0j) +<CoerceNumber 2> ** (2+0j) = (4.0 + 0.0j) +<CoerceNumber 2> **= (2+0j) => (4.0 + 0.0j) +<CoerceNumber 2> % (2+0j) = (0.0 + 0.0j) +<CoerceNumber 2> %= (2+0j) => (0.0 + 0.0j) <CoerceNumber 2> + [1] ... exceptions.TypeError <CoerceNumber 2> += [1] ... exceptions.TypeError <CoerceNumber 2> - [1] ... exceptions.TypeError @@ -947,18 +947,18 @@ None %= <CoerceNumber 2> ... exceptions.TypeError <CoerceNumber 2> **= None ... exceptions.TypeError <CoerceNumber 2> % None ... exceptions.TypeError <CoerceNumber 2> %= None ... exceptions.TypeError -<CoerceNumber 2> + <MethodNumber 1> = 3 -<CoerceNumber 2> += <MethodNumber 1> => 3 -<CoerceNumber 2> - <MethodNumber 1> = 1 -<CoerceNumber 2> -= <MethodNumber 1> => 1 -<CoerceNumber 2> * <MethodNumber 1> = 2 -<CoerceNumber 2> *= <MethodNumber 1> => 2 -<CoerceNumber 2> / <MethodNumber 1> = 2 -<CoerceNumber 2> /= <MethodNumber 1> => 2 -<CoerceNumber 2> ** <MethodNumber 1> = 2 -<CoerceNumber 2> **= <MethodNumber 1> => 2 -<CoerceNumber 2> % <MethodNumber 1> = 0 -<CoerceNumber 2> %= <MethodNumber 1> => 0 +<CoerceNumber 2> + <MethodNumber 2> = 4 +<CoerceNumber 2> += <MethodNumber 2> => 4 +<CoerceNumber 2> - <MethodNumber 2> = 0 +<CoerceNumber 2> -= <MethodNumber 2> => 0 +<CoerceNumber 2> * <MethodNumber 2> = 4 +<CoerceNumber 2> *= <MethodNumber 2> => 4 +<CoerceNumber 2> / <MethodNumber 2> = 1 +<CoerceNumber 2> /= <MethodNumber 2> => 1 +<CoerceNumber 2> ** <MethodNumber 2> = 4 +<CoerceNumber 2> **= <MethodNumber 2> => 4 +<CoerceNumber 2> % <MethodNumber 2> = 0 +<CoerceNumber 2> %= <MethodNumber 2> => 0 <CoerceNumber 2> + <CoerceNumber 2> = 4 <CoerceNumber 2> += <CoerceNumber 2> => 4 <CoerceNumber 2> - <CoerceNumber 2> = 0 @@ -978,7 +978,7 @@ divmod(2, (2+0j)) = ((1+0j), 0j) divmod(2, [1]) ... exceptions.TypeError divmod(2, (2,)) ... exceptions.TypeError divmod(2, None) ... exceptions.TypeError -divmod(2, <MethodNumber 1>) ... exceptions.TypeError +divmod(2, <MethodNumber 2>) ... exceptions.TypeError divmod(2, <CoerceNumber 2>) = (1, 0) divmod(4.0, 2) = (2.0, 0.0) divmod(4.0, 4.0) = (1.0, 0.0) @@ -987,7 +987,7 @@ divmod(4.0, (2+0j)) = ((2+0j), 0j) divmod(4.0, [1]) ... exceptions.TypeError divmod(4.0, (2,)) ... exceptions.TypeError divmod(4.0, None) ... exceptions.TypeError -divmod(4.0, <MethodNumber 1>) ... exceptions.TypeError +divmod(4.0, <MethodNumber 2>) ... exceptions.TypeError divmod(4.0, <CoerceNumber 2>) = (2.0, 0.0) divmod(2, 2) = (1L, 0L) divmod(2, 4.0) = (0.0, 2.0) @@ -996,7 +996,7 @@ divmod(2, (2+0j)) = ((1+0j), 0j) divmod(2, [1]) ... exceptions.TypeError divmod(2, (2,)) ... exceptions.TypeError divmod(2, None) ... exceptions.TypeError -divmod(2, <MethodNumber 1>) ... exceptions.TypeError +divmod(2, <MethodNumber 2>) ... exceptions.TypeError divmod(2, <CoerceNumber 2>) = (1L, 0L) divmod((2+0j), 2) = ((1+0j), 0j) divmod((2+0j), 4.0) = (0j, (2+0j)) @@ -1005,7 +1005,7 @@ divmod((2+0j), (2+0j)) = ((1+0j), 0j) divmod((2+0j), [1]) ... exceptions.TypeError divmod((2+0j), (2,)) ... exceptions.TypeError divmod((2+0j), None) ... exceptions.TypeError -divmod((2+0j), <MethodNumber 1>) ... exceptions.TypeError +divmod((2+0j), <MethodNumber 2>) ... exceptions.TypeError divmod((2+0j), <CoerceNumber 2>) = ((1+0j), 0j) divmod([1], 2) ... exceptions.TypeError divmod([1], 4.0) ... exceptions.TypeError @@ -1014,7 +1014,7 @@ divmod([1], (2+0j)) ... exceptions.TypeError divmod([1], [1]) ... exceptions.TypeError divmod([1], (2,)) ... exceptions.TypeError divmod([1], None) ... exceptions.TypeError -divmod([1], <MethodNumber 1>) ... exceptions.TypeError +divmod([1], <MethodNumber 2>) ... exceptions.TypeError divmod([1], <CoerceNumber 2>) ... exceptions.TypeError divmod((2,), 2) ... exceptions.TypeError divmod((2,), 4.0) ... exceptions.TypeError @@ -1023,7 +1023,7 @@ divmod((2,), (2+0j)) ... exceptions.TypeError divmod((2,), [1]) ... exceptions.TypeError divmod((2,), (2,)) ... exceptions.TypeError divmod((2,), None) ... exceptions.TypeError -divmod((2,), <MethodNumber 1>) ... exceptions.TypeError +divmod((2,), <MethodNumber 2>) ... exceptions.TypeError divmod((2,), <CoerceNumber 2>) ... exceptions.TypeError divmod(None, 2) ... exceptions.TypeError divmod(None, 4.0) ... exceptions.TypeError @@ -1032,17 +1032,17 @@ divmod(None, (2+0j)) ... exceptions.TypeError divmod(None, [1]) ... exceptions.TypeError divmod(None, (2,)) ... exceptions.TypeError divmod(None, None) ... exceptions.TypeError -divmod(None, <MethodNumber 1>) ... exceptions.TypeError +divmod(None, <MethodNumber 2>) ... exceptions.TypeError divmod(None, <CoerceNumber 2>) ... exceptions.TypeError -divmod(<MethodNumber 1>, 2) ... exceptions.TypeError -divmod(<MethodNumber 1>, 4.0) ... exceptions.TypeError -divmod(<MethodNumber 1>, 2) ... exceptions.TypeError -divmod(<MethodNumber 1>, (2+0j)) ... exceptions.TypeError -divmod(<MethodNumber 1>, [1]) ... exceptions.TypeError -divmod(<MethodNumber 1>, (2,)) ... exceptions.TypeError -divmod(<MethodNumber 1>, None) ... exceptions.TypeError -divmod(<MethodNumber 1>, <MethodNumber 1>) ... exceptions.TypeError -divmod(<MethodNumber 1>, <CoerceNumber 2>) ... exceptions.TypeError +divmod(<MethodNumber 2>, 2) ... exceptions.TypeError +divmod(<MethodNumber 2>, 4.0) ... exceptions.TypeError +divmod(<MethodNumber 2>, 2) ... exceptions.TypeError +divmod(<MethodNumber 2>, (2+0j)) ... exceptions.TypeError +divmod(<MethodNumber 2>, [1]) ... exceptions.TypeError +divmod(<MethodNumber 2>, (2,)) ... exceptions.TypeError +divmod(<MethodNumber 2>, None) ... exceptions.TypeError +divmod(<MethodNumber 2>, <MethodNumber 2>) ... exceptions.TypeError +divmod(<MethodNumber 2>, <CoerceNumber 2>) ... exceptions.TypeError divmod(<CoerceNumber 2>, 2) = (1, 0) divmod(<CoerceNumber 2>, 4.0) = (0.0, 2.0) divmod(<CoerceNumber 2>, 2) = (1L, 0L) @@ -1050,5 +1050,5 @@ divmod(<CoerceNumber 2>, (2+0j)) = ((1+0j), 0j) divmod(<CoerceNumber 2>, [1]) ... exceptions.TypeError divmod(<CoerceNumber 2>, (2,)) ... exceptions.TypeError divmod(<CoerceNumber 2>, None) ... exceptions.TypeError -divmod(<CoerceNumber 2>, <MethodNumber 1>) ... exceptions.TypeError +divmod(<CoerceNumber 2>, <MethodNumber 2>) ... exceptions.TypeError divmod(<CoerceNumber 2>, <CoerceNumber 2>) = (1, 0) diff --git a/Lib/test/test_coercion.py b/Lib/test/test_coercion.py index be5b744..331771f 100644 --- a/Lib/test/test_coercion.py +++ b/Lib/test/test_coercion.py @@ -67,11 +67,26 @@ class MethodNumber: candidates = [ 2, 4.0, 2L, 2+0j, [1], (2,), None, - MethodNumber(1), CoerceNumber(2)] + MethodNumber(2), CoerceNumber(2)] infix_binops = [ '+', '-', '*', '/', '**', '%' ] prefix_binops = [ 'divmod' ] +def format_float(value): + if abs(value) < 0.01: + return '0.0' + else: + return '%.1f' % value + +# avoid testing platform fp quirks +def format_result(value): + if isinstance(value, complex): + return '(%s + %sj)' % (format_float(value.real), + format_float(value.imag)) + elif isinstance(value, float): + return format_float(value) + return str(value) + def do_infix_binops(): for a in candidates: for b in candidates: @@ -83,7 +98,7 @@ def do_infix_binops(): error = sys.exc_info()[:2] print '... %s' % error[0] else: - print '=', x + print '=', format_result(x) try: z = copy.copy(a) except copy.Error: @@ -95,7 +110,7 @@ def do_infix_binops(): error = sys.exc_info()[:2] print '... %s' % error[0] else: - print '=>', z + print '=>', format_result(z) def do_prefix_binops(): for a in candidates: @@ -108,7 +123,7 @@ def do_prefix_binops(): error = sys.exc_info()[:2] print '... %s' % error[0] else: - print '=', x + print '=', format_result(x) warnings.filterwarnings("ignore", r'complex divmod\(\), // and % are deprecated', |