当前位置: 首页>>代码示例>>Python>>正文


Python pickle.LONG4属性代码示例

本文整理汇总了Python中pickle.LONG4属性的典型用法代码示例。如果您正苦于以下问题:Python pickle.LONG4属性的具体用法?Python pickle.LONG4怎么用?Python pickle.LONG4使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在pickle的用法示例。


在下文中一共展示了pickle.LONG4属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_long

# 需要导入模块: import pickle [as 别名]
# 或者: from pickle import LONG4 [as 别名]
def test_long(self):
        for proto in protocols:
            # 256 bytes is where LONG4 begins.
            for nbits in 1, 8, 8*254, 8*255, 8*256, 8*257:
                nbase = 1L << nbits
                for npos in nbase-1, nbase, nbase+1:
                    for n in npos, -npos:
                        pickle = self.dumps(n, proto)
                        got = self.loads(pickle)
                        self.assertEqual(n, got)
        # Try a monster.  This is quadratic-time in protos 0 & 1, so don't
        # bother with those.
        nbase = long("deadbeeffeedface", 16)
        nbase += nbase << 1000000
        for n in nbase, -nbase:
            p = self.dumps(n, 2)
            got = self.loads(p)
            self.assertEqual(n, got) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:20,代码来源:pickletester.py

示例2: test_long

# 需要导入模块: import pickle [as 别名]
# 或者: from pickle import LONG4 [as 别名]
def test_long(self):
        for proto in protocols:
            # 256 bytes is where LONG4 begins.
            for nbits in 1, 8, 8*254, 8*255, 8*256, 8*257:
                nbase = 1 << nbits
                for npos in nbase-1, nbase, nbase+1:
                    for n in npos, -npos:
                        pickle = self.dumps(n, proto)
                        got = self.loads(pickle)
                        self.assert_is_copy(n, got)
        # Try a monster.  This is quadratic-time in protos 0 & 1, so don't
        # bother with those.
        nbase = int("deadbeeffeedface", 16)
        nbase += nbase << 1000000
        for n in nbase, -nbase:
            p = self.dumps(n, 2)
            got = self.loads(p)
            # assert_is_copy is very expensive here as it precomputes
            # a failure message by computing the repr() of n and got,
            # we just do the check ourselves.
            self.assertIs(type(got), int)
            self.assertEqual(n, got) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:24,代码来源:pickletester.py

示例3: test_long

# 需要导入模块: import pickle [as 别名]
# 或者: from pickle import LONG4 [as 别名]
def test_long(self):
        for proto in protocols:
            # 256 bytes is where LONG4 begins.
            for nbits in 1, 8, 8*254, 8*255, 8*256, 8*257:
                nbase = 1L << nbits
                for npos in nbase-1, nbase, nbase+1:
                    for n in npos, -npos:
                        pickle = self.dumps(n, proto)
                        got = self.loads(pickle)
                        self.assertEqual(n, got)
        # Try a monster.  This is quadratic-time in protos 0 & 1, so don't
        # bother with those.
        if is_jython:#see http://jython.org/bugs/1754225
            return
        nbase = long("deadbeeffeedface", 16)
        nbase += nbase << 1000000
        for n in nbase, -nbase:
            p = self.dumps(n, 2)
            got = self.loads(p)
            self.assertEqual(n, got) 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:22,代码来源:pickletester.py

示例4: test_long4

# 需要导入模块: import pickle [as 别名]
# 或者: from pickle import LONG4 [as 别名]
def test_long4(self):
        x = 12345678910111213141516178920L << (256*8)
        for proto in protocols:
            s = self.dumps(x, proto)
            y = self.loads(s)
            self.assertEqual(x, y)
            self.assertEqual(opcode_in_pickle(pickle.LONG4, s), proto >= 2) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:9,代码来源:pickletester.py

示例5: test_long4

# 需要导入模块: import pickle [as 别名]
# 或者: from pickle import LONG4 [as 别名]
def test_long4(self):
        x = 12345678910111213141516178920 << (256*8)
        for proto in protocols:
            s = self.dumps(x, proto)
            y = self.loads(s)
            self.assert_is_copy(x, y)
            self.assertEqual(opcode_in_pickle(pickle.LONG4, s), proto >= 2) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:9,代码来源:pickletester.py


注:本文中的pickle.LONG4属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。