How to use the pottery.HyperLogLog 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_hyper.py View on Github external
def test_update(self):
        hll1 = HyperLogLog({'foo', 'bar', 'zap', 'a'})
        hll2 = HyperLogLog({'a', 'b', 'c', 'foo'})
        hll1.update(hll2)
        assert len(hll1) == 6

        hll1 = HyperLogLog({'foo', 'bar', 'zap', 'a'})
        hll1.update({'b', 'c', 'd', 'foo'})
        assert len(hll1) == 7

        hll1 = HyperLogLog({'foo', 'bar', 'zap', 'a'})
        hll1.update(hll2, {'b', 'c', 'd', 'baz'})
        assert len(hll1) == 8
github brainix / pottery / tests / test_hyper.py View on Github external
def test_update(self):
        hll1 = HyperLogLog({'foo', 'bar', 'zap', 'a'})
        hll2 = HyperLogLog({'a', 'b', 'c', 'foo'})
        hll1.update(hll2)
        assert len(hll1) == 6

        hll1 = HyperLogLog({'foo', 'bar', 'zap', 'a'})
        hll1.update({'b', 'c', 'd', 'foo'})
        assert len(hll1) == 7

        hll1 = HyperLogLog({'foo', 'bar', 'zap', 'a'})
        hll1.update(hll2, {'b', 'c', 'd', 'baz'})
        assert len(hll1) == 8
github brainix / pottery / tests / test_hyper.py View on Github external
def test_union(self):
        hll1 = HyperLogLog({'foo', 'bar', 'zap', 'a'})
        hll2 = HyperLogLog({'a', 'b', 'c', 'foo'})
        assert len(hll1.union(hll2)) == 6
        assert len(hll1.union({'b', 'c', 'd', 'foo'})) == 7
        assert len(hll1.union(hll2, {'b', 'c', 'd', 'baz'})) == 8
github brainix / pottery / tests / test_hyper.py View on Github external
def test_union(self):
        hll1 = HyperLogLog({'foo', 'bar', 'zap', 'a'})
        hll2 = HyperLogLog({'a', 'b', 'c', 'foo'})
        assert len(hll1.union(hll2)) == 6
        assert len(hll1.union({'b', 'c', 'd', 'foo'})) == 7
        assert len(hll1.union(hll2, {'b', 'c', 'd', 'baz'})) == 8
github brainix / pottery / tests / test_hyper.py View on Github external
def test_init_without_iterable(self):
        hll = HyperLogLog()
        assert len(hll) == 0
github brainix / pottery / tests / test_hyper.py View on Github external
def test_repr(self):
        'Test HyperLogLog.__repr__()'
        hll = HyperLogLog({'foo', 'bar', 'zap', 'a'}, key=self._KEY)
        assert repr(hll) == ''.format(self._KEY)
github brainix / pottery / tests / test_hyper.py View on Github external
def test_add(self):
        hll = HyperLogLog()
        hll.add('foo')
        assert len(hll) == 1

        hll.add('bar')
        assert len(hll) == 2

        hll.add('zap')
        assert len(hll) == 3

        hll.add('a')
        assert len(hll) == 4

        hll.add('a')
        assert len(hll) == 4

        hll.add('b')
github brainix / pottery / tests / test_hyper.py View on Github external
def test_init_with_iterable(self):
        hll = HyperLogLog({'foo', 'bar', 'zap', 'a'})
        assert len(hll) == 4