Example #1
0
 def test_gcd_2_4(self):
     self.assertEqual(rational_math.gcd(2, 4), 2)
Example #2
0
 def test_gcd_1_1(self):
     self.assertEqual(rational_math.gcd(1, 1), 1)
 def __init__(self, p=0, q=1):
     if q == 0:
         raise InvalidFractionError('q cannot be equal to zero')
     common_divisor = rational_math.gcd(p, q)
     self.p = p / common_divisor
     self.q = q / common_divisor
Example #4
0
 def test_gcd_81_35(self):
     self.assertEqual(rational_math.gcd(81, 35), 1)
 def __init__(self, p=0, q=1):
     if q == 0:
         raise InvalidFractionError('q cannot be equal to zero')
     common_divisor = rational_math.gcd(p, q)
     self.p = p / common_divisor
     self.q = q / common_divisor