Пример #1
0
 def test_encode_decode(self):
     self.assertEquals(decode_variable(encode_variable('bar', None)),
                       ('bar', None))
     self.assertEquals(
         decode_variable(encode_variable('baz', [None, 1, {
             '3': 2
         }])), ('baz', [None, 1, {
             '3': 2
         }]))
Пример #2
0
    def test_encode(self):
        def r(buf):
            return buf.read(len(buf))

        self.assertEquals(r(encode_variable('foo', None)), p('0003666f6f 05'))
        self.assertEquals(r(encode_variable('foo', ['bar'])),
                          p('0003666f6f 0a00000001020003626172'))
        self.assertRaises(amf0.EncoderError, encode_variable, None, None)
        self.assertRaises(amf0.EncoderError, encode_variable, 'a' * 0x10000,
                          None)
Пример #3
0
    def test_encode(self):
        def r(buf):
            return buf.read(len(buf))

        self.assertEquals(r(encode_variable('foo', None)), p('0003666f6f 05'))
        self.assertEquals(r(encode_variable('foo', ['bar'])),
                          p('0003666f6f 0a00000001020003626172'))
        self.assertRaises(amf0.EncoderError, encode_variable, None, None)
        self.assertRaises(amf0.EncoderError, encode_variable, 'a' * 0x10000,
                          None)
Пример #4
0
 def test_encode_decode(self):
     self.assertEquals(decode_variable(encode_variable('bar', None)),
                       ('bar', None))
     self.assertEquals(decode_variable(encode_variable('baz', [None, 1,
                                                               {'3': 2}])),
                       ('baz', [None, 1, {'3': 2}]))