def test_lcm_compute_returns_correct_result_with_no_edge_case(self): self.assertEqual(lcm([10, 5]), 10) self.assertEqual(lcm([1, 0]), 0) self.assertEqual(lcm([2, 4, 16]), 16) self.assertEqual(lcm([2, 4, 16, 549]), 8784) self.assertEqual(lcm([202, 0, 567]), 0)
def test_lcm_raises_value_error_on_undefined_input_array(self): with self.assertRaises(ValueError): lcm(None)
def test_lcm_function_raises_type_error_if_input_array_contains_non_integer_element(self): with self.assertRaises(TypeError): self.assertEqual(lcm([2, 4, 16, 549, 'invalid input']), 8784)
def test_lcm_returns_zero_if_all_the_input_array_elements_is_zero(self): self.assertEqual(lcm([0, 0, 0, 0, 0, 0]), 0)
def test_lcm_returns_first_integer_on_a_single_element_input_array(self): self.assertEqual(lcm([100]), 100)
def test_lcm_returns_an_empty_array_if_input_array_is_empty(self): self.assertEqual(lcm([]), [])
def test_lcm_raises_type_error_on_a_non_list_type(self): with self.assertRaises(TypeError): lcm({})