pickletester.py 文件源码

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

项目:kbe_server 作者: xiaohaoppy 项目源码 文件源码
def test_simple_newobj(self):
        x = object.__new__(SimpleNewObj)  # avoid __init__
        x.abc = 666
        for proto in protocols:
            s = self.dumps(x, proto)
            self.assertEqual(opcode_in_pickle(pickle.NEWOBJ, s),
                             2 <= proto < 4)
            self.assertEqual(opcode_in_pickle(pickle.NEWOBJ_EX, s),
                             proto >= 4)
            y = self.loads(s)   # will raise TypeError if __init__ called
            self.assert_is_copy(x, y)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号