Exemplo n.º 1
0
 def test_concatenate_vertical_with_column_names(self):
   column_names = ( 'one', 'two', 'three' )
   t1 = table(data = [
     ( 1, 2, 3 ),
     ( 4, 5, 6 ),
     ( 7, 8, 9 ),
   ], column_names = column_names)
   t2 = table(data = [
     ( 10, 11, 12 ),
     ( 13, 14, 15 ),
     ( 16, 17, 18 ),
   ])
   t3 = table(data = [
     ( 99, 98, 97 ),
   ], column_names = column_names)
   actual = table.concatenate_vertical([ t1, t2, t3 ])
   expected = table(data = [
     ( 1, 2, 3 ),
     ( 4, 5, 6 ),
     ( 7, 8, 9 ),
     ( 10, 11, 12 ),
     ( 13, 14, 15 ),
     ( 16, 17, 18 ),
     ( 99, 98, 97 ),
   ])
   self.assertEqual( 1, t1[0].one )
   self.assertEqual( 2, t1[0].two )
   self.assertEqual( 3, t1[0].three )
   self.assertEqual( 1, actual[0].one )
   self.assertEqual( 2, actual[0].two )
   self.assertEqual( 3, actual[0].three )
   self.assertEqual( expected, actual )
Exemplo n.º 2
0
 def test_concatenate_vertical_with_empty_table(self):
   t1 = table(data = [
     ( 1, 2, 3 ),
     ( 4, 5, 6 ),
     ( 7, 8, 9 ),
   ])
   t2 = table()
   t3 = table(data = [
     ( 99, 98, 97 ),
   ])
   t4 = table(data = [
     ( 1, 2, 3 ),
     ( 4, 5, 6 ),
     ( 7, 8, 9 ),
     ( 99, 98, 97 ),
   ])
   self.assertEqual( t4, table.concatenate_vertical([ t1, t2, t3 ]) )
Exemplo n.º 3
0
 def test_concatenate_vertical_one_table_with_column_names(self):
   column_names = ( 'one', 'two', 'three' )
   t1 = table(data = [
     ( 1, 2, 3 ),
     ( 4, 5, 6 ),
     ( 7, 8, 9 ),
   ], column_names = column_names)
   actual = table.concatenate_vertical([ t1 ])
   expected = table(data = [
     ( 1, 2, 3 ),
     ( 4, 5, 6 ),
     ( 7, 8, 9 ),
   ])
   self.assertEqual( 1, t1[0].one )
   self.assertEqual( 2, t1[0].two )
   self.assertEqual( 3, t1[0].three )
   self.assertEqual( 1, actual[0].one )
   self.assertEqual( 2, actual[0].two )
   self.assertEqual( 3, actual[0].three )
   self.assertEqual( expected, actual )
Exemplo n.º 4
0
 def test_concatenate_vertical(self):
   t1 = table(data = [
     ( 1, 2, 3 ),
     ( 4, 5, 6 ),
     ( 7, 8, 9 ),
   ])
   t2 = table(data = [
     ( 10, 11, 12 ),
     ( 13, 14, 15 ),
     ( 16, 17, 18 ),
   ])
   t3 = table(data = [
     ( 99, 98, 97 ),
   ])
   t4 = table(data = [
     ( 1, 2, 3 ),
     ( 4, 5, 6 ),
     ( 7, 8, 9 ),
     ( 10, 11, 12 ),
     ( 13, 14, 15 ),
     ( 16, 17, 18 ),
     ( 99, 98, 97 ),
   ])
   self.assertEqual( t4, table.concatenate_vertical([ t1, t2, t3 ]) )
Exemplo n.º 5
0
 def test_concatenate_vertical_all_empty(self):
   t1 = table()
   t2 = table()
   t3 = table()
   t4 = table()
   self.assertEqual( t4, table.concatenate_vertical([ t1, t2, t3 ]) )