def test_init_byte(self): entry = Entry(addr=None, command=b'SET snowman "is \xe2\x98\x83!"', responses=[]) self.assertEqual(entry.command, [ b'*3', b'$3', b'SET', b'$7', b'snowman', b'$7', b'is \xe2\x98\x83!' ])
def test_init_text(self): entry = Entry(addr=None, command='SET snowman "is ☃!"', responses=[]) self.assertEqual( entry.command, [ b"*3", b"$3", b"SET", b"$7", b"snowman", b"$7", b"is \xe2\x98\x83!" ], )
def test_can_handle(self): entry = Entry(addr=None, command='SET snowman "is ☃!"', responses=[]) self.assertTrue(entry.can_handle(b'*3\r\n$3\r\nSET\r\n$7\r\nsnowman\r\n$7\r\nis \xe2\x98\x83!'))