示例#1
0
文件: test_query.py 项目: dirn/Simon
    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)
示例#2
0
文件: test_query.py 项目: dirn/Simon
    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)
示例#3
0
文件: test_query.py 项目: dirn/Simon
    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)
示例#4
0
文件: test_query.py 项目: dirn/Simon
    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)