Esempio n. 1
0
 def test_left_outer_intersect_no_intersect(self):
     all_intersect = self.tb52
     all_intersect['str'].extend(['d', 'e'])
     all_intersect['int'].extend([4, 5])
     all_intersect['float'].extend([0.4, 0.5])
     test = man.left_outer_intersect(self.tb51, all_intersect,
                                     self.tb51_order, self.tb52_order)
     self.assertEqual(test[0], {})
Esempio n. 2
0
 def test_left_outer_intersect_no_intersect(self):
     all_intersect = self.tb52
     all_intersect['str'].extend(['d', 'e'])
     all_intersect['int'].extend([4, 5])
     all_intersect['float'].extend([0.4, 0.5])
     test = man.left_outer_intersect(self.tb51, all_intersect,
                                     self.tb51_order, self.tb52_order)
     self.assertEqual(test[0], {})
Esempio n. 3
0
 def join(res1, res2):
     conn = joins.pop(0)
     tb1 = res1[0]
     col_order_1 = res1[1]
     tb2 = res2[0]
     col_order_2 = res2[1]
     if conn == ' UNETELO CN ':
         return man.unite_tables(tb1, tb2, col_order_1, col_order_2, False)
     elif conn == ' UNETELO TODO CN ':
         return man.unite_tables(tb1, tb2, col_order_1, col_order_2, True)
     elif conn == ' COMUN CN ':
         return man.intersect_tables(tb1, tb2, col_order_1, col_order_2)
     elif conn == ' SACALE ':
         return man.left_outer_intersect(tb1, tb2, col_order_1, col_order_2)
     else:
         raise ValueError('Do not recognize connective')
Esempio n. 4
0
 def test_left_outer_intersect(self):
     expected = {'str': ['d', 'e'], 'int': [4, 5], 'float': [0.4, 0.5]}
     test = man.left_outer_intersect(self.tb51, self.tb52, self.tb51_order,
                                     self.tb52_order)
     test_tb = test[0]
     # Check column entries, row order may be different, but change is
     # uniform across all columns
     str_col = test_tb['str']
     int_col = test_tb['int']
     float_col = test_tb['float']
     i = str_col.index('d')
     j = str_col.index('e')
     # Same row as d
     self.assertEqual(int_col[i], 4)
     self.assertEqual(float_col[i], 0.4)
     # Same row as e
     self.assertEqual(int_col[j], 5)
     self.assertEqual(float_col[j], 0.5)
Esempio n. 5
0
 def test_left_outer_intersect(self):
     expected = {'str': ['d', 'e'],
                 'int': [4, 5],
                 'float': [0.4, 0.5]}
     test = man.left_outer_intersect(self.tb51, self.tb52,
                                     self.tb51_order, self.tb52_order)
     test_tb = test[0]
     # Check column entries, row order may be different, but change is
     # uniform across all columns
     str_col = test_tb['str']
     int_col = test_tb['int']
     float_col = test_tb['float']
     i = str_col.index('d')
     j = str_col.index('e')
     # Same row as d
     self.assertEqual(int_col[i], 4)
     self.assertEqual(float_col[i], 0.4)
     # Same row as e
     self.assertEqual(int_col[j], 5)
     self.assertEqual(float_col[j], 0.5)