How to use the pottery.RedisSet 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_set.py View on Github external
def test_init(self):
        set_ = RedisSet()
        assert set_ == set()
github brainix / pottery / tests / test_set.py View on Github external
def test_difference_update_with_range_and_set(self):
        ramanujans_friends = RedisSet()
        ramanujans_friends.difference_update(range(4), {6, 7, 8, 9})
        assert ramanujans_friends == set()

        ramanujans_friends = RedisSet(range(10))
        ramanujans_friends.difference_update(range(4), {6, 7, 8, 9})
        assert ramanujans_friends == {4, 5}
github brainix / pottery / tests / test_set.py View on Github external
def test_issubset(self):
        a = RedisSet('abc')
        b = RedisSet('abc')
        # assert a.issubset(b)
        # assert b.issubset(a)
        assert a <= b
        assert b <= a
        assert not a < b
        assert not b < a
        c = RedisSet('abcd')
        # assert a.issubset(c)
        # assert not c.issubset(a)
        assert a <= c
        assert not c <= a
        assert a < c
        assert not c < a
        d = RedisSet('def')
        # assert not a.issubset(d)
        # assert not d.issubset(a)
        assert not a <= d
        assert not d <= a
        assert not a < d
        assert not d < a
github brainix / pottery / tests / test_set.py View on Github external
def test_repr(self):
        basket = RedisSet({'apple'})
        assert repr(basket) == "RedisSet{'apple'}"

        basket = RedisSet({'apple', 'orange'})
        assert repr(basket) in {
            "RedisSet{'apple', 'orange'}",
            "RedisSet{'orange', 'apple'}",
        }
github brainix / pottery / tests / test_set.py View on Github external
def test_update_with_range(self):
        ramanujans_friends = RedisSet()
        ramanujans_friends.update(range(10))
        assert ramanujans_friends == {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
github brainix / pottery / tests / test_set.py View on Github external
def test_difference_update_with_empty_set(self):
        ramanujans_friends = RedisSet()
        ramanujans_friends.difference_update(set())
        assert ramanujans_friends == set()

        ramanujans_friends = RedisSet(range(10))
        ramanujans_friends.difference_update(set())
        assert ramanujans_friends == {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
github brainix / pottery / tests / test_set.py View on Github external
def test_keyexistserror(self):
        fruits = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}
        basket = RedisSet(fruits, key='pottery:basket')
        basket  # Workaround for Pyflakes.  :-(
        with self.assertRaises(KeyExistsError):
            RedisSet(fruits, key='pottery:basket')
github brainix / pottery / tests / test_set.py View on Github external
def test_remove(self):
        basket = RedisSet({'apple', 'orange'})
        basket.remove('orange')
        assert basket == {'apple'}

        basket.remove('apple')
        assert basket == set()

        with self.assertRaises(KeyError):
            basket.remove('apple')
github brainix / pottery / tests / test_set.py View on Github external
def test_update_with_no_arguments(self):
        s = RedisSet()
        s.update()
        assert s == set()

        s = RedisSet('abcd')
        s.update()
        assert s == {'a', 'b', 'c', 'd'}
github brainix / pottery / tests / test_set.py View on Github external
def test_issuperset(self):
        a = RedisSet('abc')
        b = RedisSet('abc')
        # assert a.issuperset(b)
        # assert b.issuperset(a)
        assert a >= b
        assert b >= a
        assert not a > b
        assert not b > a
        c = RedisSet('abcd')
        # assert not a.issuperset(c)
        # assert c.issuperset(a)
        assert not a >= c
        assert c >= a
        assert not a > c
        assert c > a
        d = RedisSet('def')
        # assert not a.issuperset(d)