MCPcopy
hub / github.com/redis/redis-py / test_bitcount

Method test_bitcount

tests/test_commands.py:1590–1606  ·  view source on GitHub ↗
(self, r)

Source from the content-addressed store, hash-verified

1588
1589 @skip_if_server_version_lt("2.6.0")
1590 def test_bitcount(self, r):
1591 r.setbit("a", 5, True)
1592 assert r.bitcount("a") == 1
1593 r.setbit("a", 6, True)
1594 assert r.bitcount("a") == 2
1595 r.setbit("a", 5, False)
1596 assert r.bitcount("a") == 1
1597 r.setbit("a", 9, True)
1598 r.setbit("a", 17, True)
1599 r.setbit("a", 25, True)
1600 r.setbit("a", 33, True)
1601 assert r.bitcount("a") == 5
1602 assert r.bitcount("a", 0, -1) == 5
1603 assert r.bitcount("a", 2, 3) == 2
1604 assert r.bitcount("a", 2, -1) == 3
1605 assert r.bitcount("a", -2, -1) == 2
1606 assert r.bitcount("a", 1, 1) == 1
1607
1608 @skip_if_server_version_lt("7.0.0")
1609 def test_bitcount_mode(self, r):

Callers

nothing calls this directly

Calls 2

setbitMethod · 0.80
bitcountMethod · 0.80

Tested by

no test coverage detected