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' }])
def test_pop_with_index(self): dlist = DocumentList([{'a': 'b'}, {'a': 'c'}]) dlist.pop(0) self.assertEquals(dlist, [{'a': 'c'}])
def test_remove(self): dlist = DocumentList([{'a': 'b'}, {'a': 'c'}]) dlist.remove({'a': 'b'}) self.assertEquals(dlist, [{'a': 'c'}])
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'}])
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'}])
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'}])
def test_pop_with_index(self): dlist = DocumentList([{'a': 'b'}, {'a': 'c'}]) dlist.pop(0) self.assertEqual(dlist, [{'a': 'c'}])
def test_pop(self): dlist = DocumentList([{'a': 'b'}, {'a': 'c'}]) dlist.pop() self.assertEqual(dlist, [{'a': 'b'}])
def test_remove(self): dlist = DocumentList([{'a': 'b'}, {'a': 'c'}]) dlist.remove({'a': 'b'}) self.assertEqual(dlist, [{'a': 'c'}])
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'}])
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'}])
def test_wraps_dicts_in_document(self): dlist = DocumentList([{'a': 'b'}, {'a': 'c'}]) self.assertIsInstance(dlist[0], Document)
def test_set_slice(self): dlist = DocumentList(['a', 'b', 'c', 'd']) dlist[1:3] = ['e', 'f'] self.assertEqual(['a', 'e', 'f', 'd'], dlist)
def test_set_item(self): dlist = DocumentList(['a', 'b']) dlist[1] = 'c' self.assertEqual(['a', 'c'], dlist)
def test_equals_list(self): dlist = DocumentList(['a', 'b']) self.assertEqual(['a', 'b'], dlist)