def readTypedObject(self): """ Reads an ActionScript object from the stream and attempts to 'cast' it. @see: L{load_class<pyamf.load_class>} """ classname = self.readString() alias = None try: alias = pyamf.load_class(classname) ret = alias.createInstance() except pyamf.UnknownClassAlias: if self.strict: raise ret = pyamf.TypedObject(classname) self.context.addObject(ret) self._readObject(ret, alias) return ret
def test_externalised(self): o = pyamf.TypedObject(None) self.assertRaises(pyamf.DecodeError, o.__readamf__, None) self.assertRaises(pyamf.EncodeError, o.__writeamf__, None)