test_ndb.py 文件源码

python
阅读 12 收藏 0 点赞 0 评论 0

项目:Tinychat-Bot--Discontinued 作者: Tinychat 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号