def test_list_messages(self): """Test list_messages() can list known messages.""" messages = list_messages() self.assertEqual(messages, [ self.TestMessageA, self.TestMessageB, self.TestMessageC, self.TestMessageD ])
def test_list_messages(self): """Test list_messages() can list known messages.""" messages = list_messages() self.assertEqual(messages, [self.TestMessageA, self.TestMessageB, self.TestMessageC, self.TestMessageD])
def test_list_messages_include(self): """Test list_messages() can include only specified messages.""" # Test string input. messages = list_messages(include='TestMessageA') self.assertEqual(messages, [self.TestMessageA]) # Test list input. messages = list_messages(include=['TestMessageA', 'TestMessageB']) self.assertEqual(messages, [self.TestMessageA, self.TestMessageB]) # Ensure exception is raised on non-string input. with self.assertRaises(TypeError): list_messages(include=False) with self.assertRaises(TypeError): list_messages(include=['TestMessageA', False])
def test_list_messages_include_exclude(self): """Test list_messages() can include and excluded specified messages.""" messages = list_messages(include=['TestMessageA', 'TestMessageB'], exclude='TestMessageA') self.assertEqual(messages, [self.TestMessageB])