def test_person(self):
pyamf.register_class(models.Person, 'Person')
person_key = ndb.Key('Contact', 'p')
person = models.Person(
key=person_key,
first_name='Foo',
last_name='Bar',
)
bytes = (
b'\n\x0b\rPerson', (
b'\t_key\x06Qagx0ZXN0YmVkLXRlc3RyDgsSB0NvbnRhY3QiAXAM',
b'\x19phone_number\x01',
b'\x0faddress\x01',
b'\x15first_name\x06\x07Foo',
b'\x13last_name\x06\x07Bar',
),
b'\x01'
)
self.assertEncodes(person, bytes)
def check_person(ret):
self.assertIsInstance(ret, models.Person)
self.assertEqual(ret, person)
self.assertDecodes(bytes, check_person)
评论列表
文章目录