def test_has_all_errors(self): # Test values not given as a list gender = self.example_data_A_data['gender'] for test_values in [1, 'wrong!']: # Test has version with self.assertRaises(TypeError) as error: func, values = has_all(test_values) self.assertEqual( error.exception.message[:54], "The values given to has_all() must be given as a list.") # Test not version with self.assertRaises(TypeError) as error: func, values = not_all(test_values) self.assertEqual( error.exception.message[:54], "The values given to not_all() must be given as a list.") # Test values inside the values are not int gender = self.example_data_A_data['gender'] for test_values in [['1'], [1.9, 2, 3]]: # Test has version with self.assertRaises(TypeError) as error: func, values = has_all(test_values) self.assertEqual( error.exception.message[:54], "The values given to has_all() are not correctly typed.") # Test not version with self.assertRaises(TypeError) as error: func, values = not_all(test_values) self.assertEqual( error.exception.message[:54], "The values given to not_all() are not correctly typed.")
def test_has_all(self): # Test has version test_values = [1, 3, 5] func, values, exclusive = has_all(test_values) self.assertEqual(func, _has_all) self.assertEqual(values, test_values) self.assertEqual(exclusive, False) # Test not version test_values = [1, 3, 5] func, values, exclusive = not_all(test_values) self.assertEqual(func, _not_all) self.assertEqual(values, test_values) self.assertEqual(exclusive, False)
def test_has_all(self): # Test has version test_values = [1, 3, 5] func, values, exclusive = has_all(test_values) self.assertEqual(func, _has_all) self.assertEqual(values, test_values) self.assertEqual(exclusive, False) # Test not version test_values = [1, 3, 5] func, values, exclusive = not_all(test_values) self.assertEqual(func, _not_all) self.assertEqual(values, test_values) self.assertEqual(exclusive, False)
def test_has_all_errors(self): # Test values not given as a list gender = self.example_data_A_data['gender'] for test_values in [1, 'wrong!']: # Test has version with self.assertRaises(TypeError) as error: func, values = has_all(test_values) self.assertEqual( error.exception.message[:54], "The values given to has_all() must be given as a list." ) # Test not version with self.assertRaises(TypeError) as error: func, values = not_all(test_values) self.assertEqual( error.exception.message[:54], "The values given to not_all() must be given as a list." ) # Test values inside the values are not int gender = self.example_data_A_data['gender'] for test_values in [['1'], [1.9, 2, 3]]: # Test has version with self.assertRaises(TypeError) as error: func, values = has_all(test_values) self.assertEqual( error.exception.message[:54], "The values given to has_all() are not correctly typed." ) # Test not version with self.assertRaises(TypeError) as error: func, values = not_all(test_values) self.assertEqual( error.exception.message[:54], "The values given to not_all() are not correctly typed." )