Exemplo n.º 1
0
 def test_ReductionOfAnswer(self):
     a = Rational(2, 3)
     b = Rational(3, 4)
     result = a.__div__(b)
     self.assertTrue(result == Rational(1, 2))
Exemplo n.º 2
0
 def test_DivisionByZero(self):
     a = Rational(4, 3)
     b = Rational(0, 1)
     with self.assertRaises(ZeroDivisionError):
         a.__div__(b)
Exemplo n.º 3
0
 def test_DivisionOfTwoDifferentRationalNumbers(self):
     a = Rational(2, 3)
     b = Rational(5, 8)
     result = a.__div__(b)
     self.assertTrue(result == Rational(16, 15))
Exemplo n.º 4
0
 def test_DivisionOfTwoIntegers(self):
     a = Rational(3, 1)
     b = Rational(5, 1)
     result = a.__div__(b)
     self.assertTrue(result == Rational(3, 5))
Exemplo n.º 5
0
 def test_DivisionBySelf(self):
     a = Rational(7, 2)
     b = Rational(7, 2)
     result = a.__div__(b)
     self.assertTrue(result == Rational(1, 1))