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

Method test_get_and_set

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

Source from the content-addressed store, hash-verified

2198 assert d is None or len(d) == 16
2199
2200 def test_get_and_set(self, r):
2201 # get and set can't be tested independently of each other
2202 assert r.get("a") is None
2203 byte_string = b"value"
2204 integer = 5
2205 unicode_string = chr(3456) + "abcd" + chr(3421)
2206 assert r.set("byte_string", byte_string)
2207 assert r.set("integer", 5)
2208 assert r.set("unicode_string", unicode_string)
2209 assert r.get("byte_string") == byte_string
2210 assert r.get("integer") == str(integer).encode()
2211 assert r.get("unicode_string").decode("utf-8") == unicode_string
2212
2213 @skip_if_server_version_lt("6.2.0")
2214 def test_getdel(self, r):

Callers

nothing calls this directly

Calls 4

encodeMethod · 0.80
decodeMethod · 0.80
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected