def test_encode(self): buf = amf0.encode(1) self.assertTrue(isinstance(buf, util.BufferedByteStream)) self.assertEquals(amf0.encode(1).getvalue(), '\x00?\xf0\x00\x00\x00\x00\x00\x00') self.assertEquals(amf0.encode('foo', 'bar').getvalue(), '\x02\x00\x03foo\x02\x00\x03bar')
def test_encode_with_context(self): context = amf0.Context() obj = object() context.addObject(obj) self.assertEquals( amf0.encode(obj, context=context).getvalue(), '\x07\x00\x00')
def test_encode_with_context(self): context = amf0.Context() obj = object() context.addObject(obj) self.assertEquals(amf0.encode(obj, context=context).getvalue(), '\x07\x00\x00')