def test_token(self): self.assertEqual( Redisizer.tokens(["SET", "snowman", "is ☃!"]), [ b"*3", b"$3", b"SET", b"$7", b"snowman", b"$7", b"is \xe2\x98\x83!" ], )
def test_redisize_command(self): self.assertEqual( Redisizer.redisize(Redisizer.command('OK')), b'+OK\r\n' )
def test_redisize_byte(self): self.assertEqual( Redisizer.redisize(b'\xe2\x98\x83'), b'$3\r\n\xe2\x98\x83\r\n' )
def test_redisize_text(self): self.assertEqual( Redisizer.redisize('☃'), b'$3\r\n\xe2\x98\x83\r\n' )
def test_error(self): self.assertEqual(Redisizer.error("ERR: ☃ summer"), b"-ERR: \xe2\x98\x83 summer\r\n")
def test_redisize_dict(self): self.assertEqual( Redisizer.redisize({'snowman': '☃'}), b'*2\r\n$7\r\nsnowman\r\n$3\r\n\xe2\x98\x83\r\n' )
def test_redisize_int(self): self.assertEqual(Redisizer.redisize(10), b':10\r\n')
def test_token(self): self.assertEqual( Redisizer.tokens(['SET', 'snowman', 'is ☃!']), [b'*3', b'$3', b'SET', b'$7', b'snowman', b'$7', b'is \xe2\x98\x83!'] )
def test_redisize_command(self): self.assertEqual(Redisizer.redisize(Redisizer.command("OK")), b"+OK\r\n")
def test_redisize_byte(self): self.assertEqual(Redisizer.redisize(b"\xe2\x98\x83"), b"$3\r\n\xe2\x98\x83\r\n")
def test_redisize_text(self): self.assertEqual(Redisizer.redisize("☃"), b"$3\r\n\xe2\x98\x83\r\n")
def test_redisize_dict(self): self.assertEqual( Redisizer.redisize({"snowman": "☃"}), b"*2\r\n$7\r\nsnowman\r\n$3\r\n\xe2\x98\x83\r\n", )
def test_redisize_list(self): self.assertEqual( Redisizer.redisize(["snowman", "☃"]), b"*2\r\n$7\r\nsnowman\r\n$3\r\n\xe2\x98\x83\r\n", )
def test_error(self): self.assertEqual( Redisizer.error('ERR: ☃ summer'), b'-ERR: \xe2\x98\x83 summer\r\n' )
def test_redisize_list(self): self.assertEqual( Redisizer.redisize(['snowman', '☃']), b'*2\r\n$7\r\nsnowman\r\n$3\r\n\xe2\x98\x83\r\n' )