def test_fractions_add(self): '''Testing __add__ method''' assert self.frac1 + self.frac2 == Fraction(1, 1)
def test_fractions_sub(self): '''Testing __sub__ method''' assert self.frac1 - self.frac2 == Fraction(-1, 3)
def test_init_simplification(self): '''Testing init with gcd''' assert self.frac2 == Fraction(2, 3)
def test_init_denom_error_2(self): '''Testing TypeError''' with pytest.raises(TypeError) as excinfo: Fraction(1, '2') exception_msg = excinfo.value.args[0] assert exception_msg == 'Numerator and denominator must be integers'
def setup_class(cls): '''Setting up''' cls.frac1 = Fraction(1, 3) cls.frac2 = Fraction(4, 6) cls.frac3 = Fraction(6, 4)
def test_init(self): '''Testing init''' assert self.frac1 == Fraction(1, 3)
def test_fractions_mult(self): """Testing __mult__ method""" assert self.frac1 * self.frac2 == Fraction(2, 9)
def setup_class(self): """Setting up""" self.frac1 = Fraction(1, 3) self.frac2 = Fraction(4, 6) self.frac3 = Fraction(6, 4)
def test_fractions_add(self): """Testing __add__ method""" assert self.frac1 + self.frac2 == Fraction(1, 1)
def test_fractions_sub(self): """Testing __sub__ method""" assert self.frac1 - self.frac2 == Fraction(-1, 3)
def test_init_denom_error(self): """Testing TypeError""" with pytest.raises(TypeError) as excinfo: Fraction(1, 2.5) exception_msg = excinfo.value.args[0] assert exception_msg == "Numerator and denominator must be integers"
def test_init_simplification(self): """Testing init with gcd""" assert self.frac2 == Fraction(2, 3)
def test_init(self): """Testing init""" assert self.frac1 == Fraction(1, 3)
def test_fractions_mult(self): '''Testing __mult__ method''' assert self.frac1 * self.frac2 == Fraction(2, 9)
def test_fractions_truediv(self): """Testing __truediv__ method""" assert self.frac1 / self.frac2 == Fraction(1, 2)
def test_fractions_truediv(self): '''Testing __truediv__ method''' assert self.frac1 / self.frac2 == Fraction(1, 2)
def setup_class(self): '''Setting up''' self.frac1 = Fraction(1, 3) self.frac2 = Fraction(4, 6) self.frac3 = Fraction(6, 4)