def _lcm(integer_a: int, integer_b: int) -> int: """ Private function for calculating LCM [least common multiple] of 2 integers Args: integer_a: first integer integer_b: second integer Returns: Least common multiple of 2 positive integers. """ # Move here to have extra check that we have in GCD _gcd = gcd(integer_a, integer_b) return int(abs(integer_a * integer_b) / _gcd)
def test_multi_digits(self): assert gcd(2, 4, 6, 8, 16) == 2, "GCD of 2, 4, 6, 8, 16 is not 2"
def test_simple(self): assert gcd(54, 24) == 6, "GCD of 54 x 23 is not 6"
def test_large_numbers(self): assert gcd(978, 89798763754892653453379597352537489494736) == 6, \ "GCD of 978 x 89798763754892653453379597352537489494736 is not 6"
def test_minimum_result(self): assert gcd(7, 3) == 1, "GCD of 7 x 3 is not 1"
def test_type_error(self, x1, x2): with pytest.raises(TypeError): gcd(x1, x2)
def test_value_error(self, x1, x2): with pytest.raises(ValueError): gcd(x1, x2)