Exemplo n.º 1
0
 def test_append_list_with_same_num_words(self):
     data1 = [1, 3, 'a1','a2',1]
     data2 = [1, 3, 'b1','b2',2]
     # check both data lists make valid MapListBlock individually
     mlb1 = MapListBlock(data1)
     self.assertEqual(1, len(mlb1))
     mlb2 = MapListBlock(data2)
     self.assertEqual(1, len(mlb2))
     # check both 2nd list can be appended to the 1st one.
     mlb3 = MapListBlock(data1)
     mlb3.append(data2)
     # check new list length
     self.assertEqual(len(mlb1) + len(mlb2), len(mlb3))
Exemplo n.º 2
0
 def test_append_list_with_same_num_words(self):
     data1 = [1, 3, 'a1', 'a2', 1]
     data2 = [1, 3, 'b1', 'b2', 2]
     # check both data lists make valid MapListBlock individually
     mlb1 = MapListBlock(data1)
     self.assertEqual(1, len(mlb1))
     mlb2 = MapListBlock(data2)
     self.assertEqual(1, len(mlb2))
     # check both 2nd list can be appended to the 1st one.
     mlb3 = MapListBlock(data1)
     mlb3.append(data2)
     # check new list length
     self.assertEqual(len(mlb1) + len(mlb2), len(mlb3))
Exemplo n.º 3
0
 def test_append_list_with_different_num_words(self):
     data1 = [1, 3, 'a1','a2',1]
     data2 = [1, 4, 'b1','b2',1,'b4']
     # check both data lists make valid MapListBlock individually
     self.assertEqual(1, len(MapListBlock(data1)))
     self.assertEqual(1, len(MapListBlock(data2)))
     # check both 2nd list cannot be appended to the 1st one.
     mlb1 = MapListBlock(data1)
     self.assertEqual(3, mlb1._num_words)
     try:
         mlb1.append(data2)
     except MapListBlockError, err:
         self.assertIn('cannot append data', str(err), "expecting error message to contain 'cannot append data' but got %r instead" % err)
 def test_append_list_with_different_num_words(self):
     data1 = [1, 3, 'a1','a2',1]
     data2 = [1, 4, 'b1','b2',1,'b4']
     # check both data lists make valid MapListBlock individually
     self.assertEqual(1, len(MapListBlock(data1)))
     self.assertEqual(1, len(MapListBlock(data2)))
     # check both 2nd list cannot be appended to the 1st one.
     mlb1 = MapListBlock(data1)
     self.assertEqual(3, mlb1._num_words)
     try:
         mlb1.append(data2)
     except MapListBlockError, err:
         self.assertIn('cannot append data', str(err), "expecting error message to contain 'cannot append data' but got %r instead" % err)