def test_object_references(self): x = pyamf.BaseContext() self.assertRaises(pyamf.ReferenceError, x.getObject, 62) x.exceptions = False self.assertEquals(x.getObject(62), None) x = pyamf.BaseContext() self.assertRaises(pyamf.ReferenceError, x.getObjectReference, object()) x.exceptions = False self.assertEquals(x.getObjectReference(object()), None)
def test_no_alias(self): x = pyamf.BaseContext() self.assertEquals(x.class_aliases, {}) class A: pass self.assertEquals(x.getClassAlias(A), None)
def test_registered_alias(self): x = pyamf.BaseContext() self.assertEquals(x.class_aliases, {}) class A: pass pyamf.register_class(A) alias = x.getClassAlias(A) self.assertTrue(isinstance(alias, pyamf.ClassAlias)) self.assertEquals(alias.__class__, pyamf.ClassAlias) self.assertEquals(alias.klass, A)
def test_registered_deep(self): x = pyamf.BaseContext() self.assertEquals(x.class_aliases, {}) class A: pass class B(A): pass pyamf.register_alias_type(DummyAlias, A) alias = x.getClassAlias(B) self.assertTrue(isinstance(alias, pyamf.ClassAlias)) self.assertEquals(alias.__class__, DummyAlias) self.assertEquals(alias.klass, B)
def test_create(self): x = pyamf.BaseContext() self.assertTrue(x.exceptions) self.assertFalse(x.objects.exceptions)