Changeset 1493
- Timestamp:
- 07/09/08 10:48:41 (3 months ago)
- Location:
- pyamf/branches/amf3-encoder-unsupported-311/pyamf
- Files:
-
- 2 modified
-
amf3.py (modified) (3 diffs)
-
tests/test_amf3.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pyamf/branches/amf3-encoder-unsupported-311/pyamf/amf3.py
r1432 r1493 1204 1204 # Unsupported types go first 1205 1205 ((types.BuiltinFunctionType, types.BuiltinMethodType,), 1206 "write Unsupported"),1206 "writeFunc"), 1207 1207 ((bool,), "writeBoolean"), 1208 1208 ((types.NoneType,), "writeNull"), … … 1217 1217 ] 1218 1218 1219 def writeFunc(self, obj): 1220 """ 1221 Functions are unencodeable .. 1222 """ 1223 raise pyamf.EncodeError("Unable to encode function/methods") 1224 1219 1225 def writeElement(self, data, use_references=True): 1220 1226 """ … … 1230 1236 1231 1237 if func is None: 1232 # XXX nick: Should we be generating a warning here? 1233 self.writeUnsupported(data) 1238 raise pyamf.EncodeError("Cannot find encoder func for %r" % (data,)) 1234 1239 else: 1235 1240 try: -
pyamf/branches/amf3-encoder-unsupported-311/pyamf/tests/test_amf3.py
r1432 r1493 267 267 self._run([(ord, '\x00')]) 268 268 269 self.assertRaises( AttributeError, x)269 self.assertRaises(pyamf.EncodeError, x) 270 270 271 271 self._run([(pyamf.Undefined, '\x00')]) … … 583 583 '\n\x0b\x01\ttext\x06\x07bar\ttail\x01\x07tag\x06\x07foo\x01') 584 584 585 def test_unknown_func(self): 586 self.encoder._writeElementFunc = lambda x: None 587 588 self.assertRaises(pyamf.EncodeError, self.encoder.writeElement, None) 589 585 590 class DecoderTestCase(_util.ClassCacheClearingTestCase): 586 591 """
