Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6e277cf

Browse files
committed
Christian Tismer: added test to ensure that multiplication commutes.
[The test is in a slightly odd place, in test_division_2; but it exercises the recent change to long_mult(), and that's all we really ask for. --GvR]
1 parent ba71a24 commit 6e277cf

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Lib/test/test_long.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ def getran2(ndigits):
7777
def test_division_2(x, y):
7878
q, r = divmod(x, y)
7979
q2, r2 = x/y, x%y
80+
pab, pba = x*y, y*x
81+
check(pab == pba, "multiplication does not commute for", x, y)
8082
check(q == q2, "divmod returns different quotient than / for", x, y)
8183
check(r == r2, "divmod returns different mod than % for", x, y)
8284
check(x == q*y + r, "x != q*y + r after divmod on", x, y)

0 commit comments

Comments
 (0)