Skip to content

Commit

Permalink
Adds int_modulo tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ebertmi committed Oct 5, 2015
1 parent 724e9cf commit 9b3f5d7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/unit/test_int.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,21 @@ def test_conjugate(self):
self.assertEqual(bool(True).conjugate(), 1)
self.assertEqual(bool(False).conjugate(), 0)

def test_modulo(self):
# helper
def mod(a, b):
return a % b

self.assertRaises(ZeroDivisionError, mod, 5, 0)
self.assertEqual(mod(5, 1), 0)
self.assertEqual(mod(5, 2), 1)
self.assertEqual(mod(5, 4), 1)
self.assertEqual(mod(5, 5), 0)
self.assertEqual(mod(5, 6), 5)
self.assertEqual(mod(0, 1), 0)
self.assertEqual(mod(-5, 6), 1)
self.assertEqual(mod(-5, -2), -1)

class IntTest(unittest.TestCase):
def test_int_inherited(self):
class c:
Expand Down

0 comments on commit 9b3f5d7

Please sign in to comment.