

def test_behaviour(self):
    p = models.Publication(id=None, title='The Python Journal')
    a = models.Article(id=None, headline='Django lets you build Web apps easily')
    self.assertRaises(ValueError, (lambda a, p: a.publications.add(p)), a, p)
    p.save()
    a.save()
    self.addCleanup(p.delete)
    self.addCleanup(a.delete)
    self.assertEqual(a.id, 1)
    article_alias = adapter.DjangoClassAlias(models.Article, None)
    x = models.Article()
    article_alias.applyAttributes(x, {
        'headline': 'Foo bar!',
        'id': 1,
        'publications': [p],
    })
    self.assertEqual(x.headline, 'Foo bar!')
    self.assertEqual(x.id, 1)
    self.assertEqual(list(x.publications.all()), [p])

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/PyAMF-0.6.1/pyamf/tests/adapters/test_django.py PKTestCase.test_behaviour/original