Ejemplo n.º 1
0
 def test_first_by_email_that_contains(self):
     my_file = "test_data.csv"
     expected = [
         'Diana Harris', 'lime', 'Martin-Barnes', '*****@*****.**',
         '1-860-251-9980x6941', '5354'
     ]
     self.assertEqual(first(my_file, email__contains="@gmail"), expected)
Ejemplo n.º 2
0
 def test_first_by_salary_gt_1000_and_lt_3000(self):
     my_file = "test_data.csv"
     expected = [
         'Michael Olson', 'olive', 'Scott, Young and King',
         '*****@*****.**', '114-116-1124x315', '2151'
     ]
     self.assertListEqual(first(my_file, salary__gt=1000, salary__lt=3000),
                          expected)
Ejemplo n.º 3
0
 def test_first_by_first_name_that_startswith(self):
     my_file = "test_data.csv"
     expected = [
         'Diana Harris', 'lime', 'Martin-Barnes', '*****@*****.**',
         '1-860-251-9980x6941', '5354'
     ]
     self.assertEqual(first(my_file, full_name__startswith="Diana Harris"),
                      expected)
Ejemplo n.º 4
0
 def test_first_by_salary_gt_1000_and_lt_3000_order_by_salary(self):
     my_file = "test_data.csv"
     expected = [
         'Patricia King', 'white', 'Gonzalez-Fuentes',
         '*****@*****.**', '1-512-204-5161', '1039'
     ]
     self.assertListEqual(
         first(my_file, salary__gt=1000, salary__lt=3000,
               order_by='salary'), expected)
Ejemplo n.º 5
0
 def test_first_by_first_name_and_favourite_color(self):
     my_file = "test_data.csv"
     expected = [
         'Diana Harris', 'lime', 'Martin-Barnes', '*****@*****.**',
         '1-860-251-9980x6941', '5354'
     ]
     self.assertEqual(
         first(my_file, full_name="Diana Harris", favourite_color="lime"),
         expected)
Ejemplo n.º 6
0
 def test_function_first_that_behaves_the_exact_same_way_as_filter_but_returns_only_first_element_of_result(
         self):
     expr = 'Diana'
     file = 'example_data.csv'
     expected_result = [
         'lime', 'Martin-Barnes', '5354', 'Diana Harris',
         '*****@*****.**', '1-860-251-9980x6941'
     ]
     self.assertEqual((queries.first(file,
                                     full_name_startswith=expr)).sort(),
                      expected_result.sort())