def testParseArray(): parser = Parser() el1 = RespBulkString(4, 'ping') el2 = RespBulkString(6, 'foobar') expected = [el1, el2] expected = ['ping', 'foobar'] output = parser.decodeArray(b'*2\r\n$4\r\nping\r\n$6\r\nfoobar\r\n') assert output == expected
def testParseArrayEmptyArg(): parser = Parser() output = parser.decodeArray(b'*1\r\n$4\r\nping\r\n') expected = Ping('') cmdOutput = parser.parseCommands(output) assert cmdOutput == expected
def testParseCommands(): parser = Parser() expected = Ping('foobar') output = parser.decodeArray(b'*2\r\n$4\r\nping\r\n$6\r\nfoobar\r\n') o = parser.parseCommands(output) assert o == expected