From 4de8df92e93ef2dd08064f6b8ebea59738f189c5 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Wed, 29 Aug 2001 17:50:27 +0000 Subject: Add tests for augmented floor division --- Lib/test/output/test_augassign | 3 +++ Lib/test/test_augassign.py | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Lib/test/output/test_augassign b/Lib/test/output/test_augassign index ceffd59..2a461f6 100644 --- a/Lib/test/output/test_augassign +++ b/Lib/test/output/test_augassign @@ -25,6 +25,9 @@ __imul__ called __div__ called __rdiv__ called __idiv__ called +__floordiv__ called +__rfloordiv__ called +__ifloordiv__ called __mod__ called __rmod__ called __imod__ called diff --git a/Lib/test/test_augassign.py b/Lib/test/test_augassign.py index a37b4e1..e9e5b23 100644 --- a/Lib/test/test_augassign.py +++ b/Lib/test/test_augassign.py @@ -6,6 +6,7 @@ x *= 2 x **= 2 x -= 8 x /= 2 +x //= 1 x %= 12 x &= 2 x |= 5 @@ -19,6 +20,7 @@ x[0] *= 2 x[0] **= 2 x[0] -= 8 x[0] /= 2 +x[0] //= 2 x[0] %= 12 x[0] &= 2 x[0] |= 5 @@ -32,6 +34,7 @@ x[0] *= 2 x[0] **= 2 x[0] -= 8 x[0] /= 2 +x[0] //= 1 x[0] %= 12 x[0] &= 2 x[0] |= 5 @@ -128,6 +131,23 @@ class testall: print "__idiv__ called" return self + def __floordiv__(self, val): + print "__floordiv__ called" + return self + def __ifloordiv__(self, val): + print "__ifloordiv__ called" + return self + def __rfloordiv__(self, val): + print "__rfloordiv__ called" + return self + + def __truediv__(self, val): + print "__truediv__ called" + return self + def __itruediv__(self, val): + print "__itruediv__ called" + return self + def __mod__(self, val): print "__mod__ called" def __rmod__(self, val): @@ -201,6 +221,10 @@ x / 1 1 / x x /= 1 +x // 1 +1 // x +x //= 1 + x % 1 1 % x x %= 1 -- cgit v0.12