コード例 #1
0
 def test_filter_by_neq(self):
     poke_tb = self.pokemon_tb['pokemon']
     poke_col = poke_tb['pokemon_id']
     test = consult.filter_by_val('pokemon', poke_col, '!=', 2)
     test_col = test['pokemon']
     # pokemon_id 2 is at index 1, since it goes 0, 1, 2...
     self.assertNotIn(1, test_col)
コード例 #2
0
 def test_filter_by_val_gt(self):
     # greater than 10
     gt = 190
     test = consult.filter_by_val(self.col1_name, self.col1_vals,
                                  '>', gt)
     expected = [i for i in range(91, 100)]
     self.assertEqual(test[self.col1_name], expected)
コード例 #3
0
 def test_filter_by_val_neq(self):
     # not equal 105
     neq = 105
     test = consult.filter_by_val(self.col1_name, self.col1_vals, '!=', neq)
     expected = [i for i in range(0, 100)]
     expected.pop(5)
     self.assertEqual(test[self.col1_name], expected)
コード例 #4
0
 def test_filter_by_val_like(self):
     # like
     like = 'Hello'
     num = 30
     expected = []
     # Add like words into list
     list_len = len(self.col3_vals)
     start_index = rand.randint(0, list_len)
     for i in range(0, num):
         word = ''
         if i % 2 == 0:
             word = like
         else:
             word = str(i) + like + str(i + 2)
         index = start_index + i*i
         expected.append(index)
         self.col3_vals.insert(index, word)
     test = consult.filter_by_val(self.col3_name, self.col3_vals,
                                  'PARECIO A', like)
     self.assertEqual(test[self.col3_name], expected)
コード例 #5
0
 def test_filter_by_val_lt(self):
     # less than 10
     lt = 110
     test = consult.filter_by_val(self.col1_name, self.col1_vals, '<', lt)
     expected = [i for i in range(0, 10)]
     self.assertEqual(test[self.col1_name], expected)
コード例 #6
0
 def test_filter_by_val_eq(self):
     # equal 125
     eq = 125
     test = consult.filter_by_val(self.col1_name, self.col1_vals, '=', eq)
     expected = [25]
     self.assertEqual(test[self.col1_name], expected)