Commit 602aa455 authored by xa's avatar xa

almost 100% test for aiodisque.util package

parent 4577f80f
Pipeline #655 passed with stages
......@@ -42,4 +42,4 @@ def encode_command(*args):
continue
raise TypeError("Argument {!r} expected to be of bytes,"
" str, int or float type".format(arg))
return buf
return bytes(buf)
47085f92d651661eab5409c84772c786e82acaaa :0 myself 0 0 connected
import pytest
from aiodisque.util import encode_command
def test_encode_command():
data = encode_command('foo')
assert data == b'*1\r\n$3\r\nfoo\r\n'
data = encode_command(42)
assert data == b'*1\r\n$2\r\n42\r\n'
with pytest.raises(TypeError):
encode_command(None)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment