Exemple #1
0
 def test_check_tuples_in_list_for_types_multi_errors_multi_tuple(self):
     tuple_list = [(1, 'oops'), ('a', 2.), (2., 'f**k')]
     data_types_list = [(int, ), (str, ), (float, )]
     self.assertEqual(
         'error',
         fh.check_tuples_in_list_for_types(tuple_list, data_types_list,
                                           'error'))
Exemple #2
0
 def test_check_tuples_in_list_for_types_one_error(self):
     tuple_list = [(1, 'oops'), ('a', 'hi'), (2., 5.)]
     data_types_list = [(int, ), (str, ), (float, )]
     self.assertEqual(
         'error',
         fh.check_tuples_in_list_for_types(tuple_list, data_types_list,
                                           'error'))
Exemple #3
0
 def test_check_tuples_in_list_for_types_no_error_empty_list(self):
     empty_list = []
     data_types_list = [(int, float), (str, list), (float, )]
     self.assertEqual(
         '',
         fh.check_tuples_in_list_for_types(empty_list, data_types_list,
                                           'error'))
Exemple #4
0
 def test_check_tuples_in_list_for_types_no_error_multi_types(self):
     tuple_list = [(1, 2), ('a', 'hi'), (2., 5.)]
     data_types_list = [(int, float), (str, list), (float, )]
     self.assertEqual(
         '',
         fh.check_tuples_in_list_for_types(tuple_list, data_types_list,
                                           'error'))
Exemple #5
0
 def test_check_tuples_in_list_for_types_no_error_multi_types_different_elements(
         self):
     tuple_list = [(1, 3., 10**1000), ([], 'hi', 'hi'), (2., 5., 0.23)]
     data_types_list = [(int, float), (str, list), (float, )]
     self.assertEqual(
         '',
         fh.check_tuples_in_list_for_types(tuple_list, data_types_list,
                                           'error'))
Exemple #6
0
 def test_check_tuples_in_list_for_types_error_when_not_tuple_list(self):
     message = fh.check_tuples_in_list_for_types([1, 2], [(int, )], 'error')
     self.assertEqual(message, 'error')
     self.assertEqual(
         'error', fh.check_tuples_in_list_for_types(1, [(int, )], 'error'))