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