Example #1
0
 def test_extend(self):
     dlist = DocumentList([{'a': 'b'}, {'a': 'c'}])
     dlist.extend([{'a': 'd'}, {'a': 'e'}])
     self.assertIsInstance(dlist[3], Document)
     self.assertEqual(dlist, [{
         'a': 'b'
     }, {
         'a': 'c'
     }, {
         'a': 'd'
     }, {
         'a': 'e'
     }])
Example #2
0
 def test_pop_with_index(self):
     dlist = DocumentList([{'a': 'b'}, {'a': 'c'}])
     dlist.pop(0)
     self.assertEquals(dlist, [{'a': 'c'}])
Example #3
0
 def test_remove(self):
     dlist = DocumentList([{'a': 'b'}, {'a': 'c'}])
     dlist.remove({'a': 'b'})
     self.assertEquals(dlist, [{'a': 'c'}])
Example #4
0
 def test_insert(self):
     dlist = DocumentList([{'a': 'b'}, {'a': 'c'}])
     dlist.insert(1, {'a': 'd'})
     self.assertIsInstance(dlist[1], Document)
     self.assertEquals(dlist, [{'a': 'b'}, {'a': 'd'}, {'a': 'c'}])
Example #5
0
 def test_append(self):
     dlist = DocumentList([{'a': 'b'}, {'a': 'c'}])
     dlist.append({'a': 'd'})
     self.assertIsInstance(dlist[2], Document)
     self.assertEquals(dlist, [{'a': 'b'}, {'a': 'c'}, {'a': 'd'}])
Example #6
0
 def test_extend(self):
     dlist = DocumentList([{'a': 'b'}, {'a': 'c'}])
     dlist.extend([{'a': 'd'}, {'a': 'e'}])
     self.assertIsInstance(dlist[3], Document)
     self.assertEquals(dlist, [{'a': 'b'}, {'a': 'c'}, {'a': 'd'}, {'a': 'e'}])
Example #7
0
 def test_pop_with_index(self):
     dlist = DocumentList([{'a': 'b'}, {'a': 'c'}])
     dlist.pop(0)
     self.assertEqual(dlist, [{'a': 'c'}])
Example #8
0
 def test_pop(self):
     dlist = DocumentList([{'a': 'b'}, {'a': 'c'}])
     dlist.pop()
     self.assertEqual(dlist, [{'a': 'b'}])
Example #9
0
 def test_remove(self):
     dlist = DocumentList([{'a': 'b'}, {'a': 'c'}])
     dlist.remove({'a': 'b'})
     self.assertEqual(dlist, [{'a': 'c'}])
Example #10
0
 def test_insert(self):
     dlist = DocumentList([{'a': 'b'}, {'a': 'c'}])
     dlist.insert(1, {'a': 'd'})
     self.assertIsInstance(dlist[1], Document)
     self.assertEqual(dlist, [{'a': 'b'}, {'a': 'd'}, {'a': 'c'}])
Example #11
0
 def test_append(self):
     dlist = DocumentList([{'a': 'b'}, {'a': 'c'}])
     dlist.append({'a': 'd'})
     self.assertIsInstance(dlist[2], Document)
     self.assertEqual(dlist, [{'a': 'b'}, {'a': 'c'}, {'a': 'd'}])
Example #12
0
 def test_wraps_dicts_in_document(self):
     dlist = DocumentList([{'a': 'b'}, {'a': 'c'}])
     self.assertIsInstance(dlist[0], Document)
Example #13
0
 def test_set_slice(self):
     dlist = DocumentList(['a', 'b', 'c', 'd'])
     dlist[1:3] = ['e', 'f']
     self.assertEqual(['a', 'e', 'f', 'd'], dlist)
Example #14
0
 def test_set_item(self):
     dlist = DocumentList(['a', 'b'])
     dlist[1] = 'c'
     self.assertEqual(['a', 'c'], dlist)
Example #15
0
 def test_equals_list(self):
     dlist = DocumentList(['a', 'b'])
     self.assertEqual(['a', 'b'], dlist)