def test___getitem__(self): """Test the `__getitem__()` method.""" self.cursor.count.return_value = 3 # qs._fill_to() would normally populate qs._items self.qs._items = range(3) with mock.patch.object(self.qs, "_fill_to") as _fill_to: for x in range(3): self.assertEqual(self.qs[x], self.qs._items[x]) _fill_to.assert_called_with(x)
def test___getitem__(self): """Test the `__getitem__()` method.""" self.cursor.count.return_value = 3 # qs._fill_to() would normally populate qs._items self.qs._items = range(3) with mock.patch.object(self.qs, '_fill_to') as _fill_to: for x in range(3): self.assertEqual(self.qs[x], self.qs._items[x]) _fill_to.assert_called_with(x)
def test__fill_to_indexes(self): ("Test that `_fill_to()` property fills to the specified " "index.") self.cursor.count.return_value = 3 for x in range(3): self.qs._fill_to(x) self.assertEqual(len(self.qs._items), x + 1)