def test_given_neither_slash_nor_dash_separated_then_exception_raised_with_correct_message(self): with self.assertRaises(ParsingError) as e: get_mc.split_ioc_module_name("this_has_no_separator") self.assertTrue("this_has_no_separator" in str(e.exception)) self.assertTrue(all(x in str(e.exception) for x in ["'-'", "'/'"]))
def test_given_neither_slash_nor_dash_separated_then_exception_raised_with_correct_message( self): with self.assertRaises(ParsingError) as e: get_mc.split_ioc_module_name("this_has_no_separator") self.assertTrue("this_has_no_separator" in str(e.exception))
def test_given_module_name_slash_separated_with_second_part_empty_then_function_raises_exception_with_correct_message( self): with self.assertRaises(ParsingError) as e: get_mc.split_ioc_module_name("part_one/") self.assertTrue("part_one/" in str(e.exception))
def test_given_module_name_slash_separated_with_second_part_not_empty_then_function_returns_correctly( self): dash_sep, cols = get_mc.split_ioc_module_name("part_one/part_two") self.assertFalse(dash_sep) self.assertEqual(cols, ["part_one", "part_two"])
def test_given_module_name_dash_separated_with_second_part_empty_then_function_returns_correctly(self): dash_sep, cols = get_mc.split_ioc_module_name("part_one-") self.assertTrue(dash_sep) self.assertEqual(cols, ["part_one", ""])
def test_given_module_name_slash_separated_with_second_part_empty_then_function_raises_exception_with_correct_message(self): with self.assertRaises(ParsingError) as e: get_mc.split_ioc_module_name("part_one/") self.assertTrue("part_one/" in str(e.exception))
def test_given_module_name_dash_separated_without_technical_area_raises_exception( self): with self.assertRaises(ParsingError) as e: get_mc.split_ioc_module_name("part_one-part_two") self.assertTrue("part_one-part_two" in str(e.exception))
def test_given_module_name_slash_separated_with_more_than_one_slash_raises_exception( self): with self.assertRaises(ParsingError) as e: get_mc.split_ioc_module_name("part_one/part_two/part_three") self.assertTrue("part_one/part_two/part_three" in str(e.exception))