How to use the pottery.RedisDeque function in pottery

To help you get started, we’ve selected a few pottery examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brainix / pottery / tests / test_deque.py View on Github external
def test_repr(self):
        d = RedisDeque()
        assert repr(d) == 'RedisDeque([])'

        d = RedisDeque('ghi')
        assert repr(d) == "RedisDeque(['g', 'h', 'i'])"

        d = RedisDeque(maxlen=2)
        assert repr(d) == 'RedisDeque([], maxlen=2)'

        d = RedisDeque('ghi', maxlen=2)
        assert repr(d) == "RedisDeque(['h', 'i'], maxlen=2)"
github brainix / pottery / tests / test_deque.py View on Github external
def test_rotate_zero_steps(self):
        d = RedisDeque(('g', 'h', 'i', 'j', 'k', 'l'))
        d.rotate(0)
        assert d == ['g', 'h', 'i', 'j', 'k', 'l']
github brainix / pottery / tests / test_deque.py View on Github external
def test_append_trims_when_full(self):
        d = RedisDeque('gh', maxlen=3)
        d.append('i')
        assert d == ['g', 'h', 'i']
        d.append('j')
        assert d == ['h', 'i', 'j']
        d.appendleft('g')
        assert d == ['g', 'h', 'i']
github brainix / pottery / tests / test_deque.py View on Github external
def test_repr(self):
        d = RedisDeque()
        assert repr(d) == 'RedisDeque([])'

        d = RedisDeque('ghi')
        assert repr(d) == "RedisDeque(['g', 'h', 'i'])"

        d = RedisDeque(maxlen=2)
        assert repr(d) == 'RedisDeque([], maxlen=2)'

        d = RedisDeque('ghi', maxlen=2)
        assert repr(d) == "RedisDeque(['h', 'i'], maxlen=2)"
github brainix / pottery / tests / test_deque.py View on Github external
def test_repr(self):
        d = RedisDeque()
        assert repr(d) == 'RedisDeque([])'

        d = RedisDeque('ghi')
        assert repr(d) == "RedisDeque(['g', 'h', 'i'])"

        d = RedisDeque(maxlen=2)
        assert repr(d) == 'RedisDeque([], maxlen=2)'

        d = RedisDeque('ghi', maxlen=2)
        assert repr(d) == "RedisDeque(['h', 'i'], maxlen=2)"
github brainix / pottery / tests / test_deque.py View on Github external
def test_repr(self):
        d = RedisDeque()
        assert repr(d) == 'RedisDeque([])'

        d = RedisDeque('ghi')
        assert repr(d) == "RedisDeque(['g', 'h', 'i'])"

        d = RedisDeque(maxlen=2)
        assert repr(d) == 'RedisDeque([], maxlen=2)'

        d = RedisDeque('ghi', maxlen=2)
        assert repr(d) == "RedisDeque(['h', 'i'], maxlen=2)"
github brainix / pottery / tests / test_deque.py View on Github external
def test_persistent_deque_bigger_than_maxlen(self):
        d1 = RedisDeque('ghi')
        d1  # Workaround for Pyflakes.  :-(
        with self.assertRaises(IndexError):
            RedisDeque(key=d1.key, maxlen=0)
github brainix / pottery / tests / test_deque.py View on Github external
def test_insert_into_full(self):
        d = RedisDeque('gh', maxlen=3)
        d.insert(len(d), 'i')
        assert d == ['g', 'h', 'i']

        with self.assertRaises(IndexError):
            d.insert(len(d), 'j')
github brainix / pottery / tests / test_deque.py View on Github external
def test_extend(self):
        d = RedisDeque('ghi', maxlen=4)
        d.extend('jkl')
        assert d == ['i', 'j', 'k', 'l']
        d.extendleft('hg')
        assert d == ['g', 'h', 'i', 'j']
github brainix / pottery / tests / test_deque.py View on Github external
def test_persistent_deque_bigger_than_maxlen(self):
        d1 = RedisDeque('ghi')
        d1  # Workaround for Pyflakes.  :-(
        with self.assertRaises(IndexError):
            RedisDeque(key=d1.key, maxlen=0)