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


Python test_support.MAX_Py_ssize_t方法代码示例

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


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

示例1: test_optimized_concat

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import MAX_Py_ssize_t [as 别名]
def test_optimized_concat(self):
        x = 'x' * MAX_Py_ssize_t
        try:
            x = x + '?'     # this statement uses a fast path in ceval.c
        except OverflowError:
            pass
        else:
            self.fail("should have raised OverflowError")
        try:
            x += '?'        # this statement uses a fast path in ceval.c
        except OverflowError:
            pass
        else:
            self.fail("should have raised OverflowError")
        self.assertEqual(len(x), MAX_Py_ssize_t)

    ### the following test is pending a patch
    #   (http://mail.python.org/pipermail/python-dev/2006-July/067774.html)
    #@bigaddrspacetest
    #def test_repeat(self):
    #    self.assertRaises(OverflowError, operator.mul, 'x', MAX_Py_ssize_t + 1) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:23,代码来源:test_bigaddrspace.py

示例2: test_optimized_concat

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import MAX_Py_ssize_t [as 别名]
def test_optimized_concat(self):
        x = 'x' * MAX_Py_ssize_t
        try:
            x = x + '?'     # this statement uses a fast path in ceval.c
        except OverflowError:
            pass
        else:
            self.fail("should have raised OverflowError")
        try:
            x += '?'        # this statement uses a fast path in ceval.c
        except OverflowError:
            pass
        else:
            self.fail("should have raised OverflowError")
        self.assertEquals(len(x), MAX_Py_ssize_t)

    ### the following test is pending a patch
    #   (http://mail.python.org/pipermail/python-dev/2006-July/067774.html)
    #@bigaddrspacetest
    #def test_repeat(self):
    #    self.assertRaises(OverflowError, operator.mul, 'x', MAX_Py_ssize_t + 1) 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:23,代码来源:test_bigaddrspace.py

示例3: test_setslice

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import MAX_Py_ssize_t [as 别名]
def test_setslice(self):
        a = range(4)
        self.assertRaises(TypeError, operator.setslice, a)
        self.assertRaises(TypeError, operator.setslice, a, None, None, None)
        self.assertTrue(operator.setslice(a, 1, 3, [2, 1]) is None)
        self.assertTrue(a == [0, 2, 1, 3])
        operator.setslice(a, 0, test_support.MAX_Py_ssize_t, [])
        self.assertTrue(a == []) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:test_operator.py

示例4: test_delslice

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import MAX_Py_ssize_t [as 别名]
def test_delslice(self):
        a = range(10)
        self.assertRaises(TypeError, operator.delslice, a)
        self.assertRaises(TypeError, operator.delslice, a, None, None)
        self.assertTrue(operator.delslice(a, 2, 8) is None)
        self.assertTrue(a == [0, 1, 8, 9])
        operator.delslice(a, 0, test_support.MAX_Py_ssize_t)
        self.assertTrue(a == []) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:test_operator.py

示例5: test_getslice

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import MAX_Py_ssize_t [as 别名]
def test_getslice(self):
        a = range(10)
        self.assertRaises(TypeError, operator.getslice)
        self.assertRaises(TypeError, operator.getslice, a, None, None)
        self.assertTrue(operator.getslice(a, 4, 6) == [4, 5])
        b = operator.getslice(a, 0, test_support.MAX_Py_ssize_t)
        self.assertTrue(b == a) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:9,代码来源:test_operator.py

示例6: test_concat

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import MAX_Py_ssize_t [as 别名]
def test_concat(self):
        s1 = 'x' * MAX_Py_ssize_t
        self.assertRaises(OverflowError, operator.add, s1, '?') 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:5,代码来源:test_bigaddrspace.py

示例7: test_delslice

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import MAX_Py_ssize_t [as 别名]
def test_delslice(self):
        a = range(10)
        self.failUnlessRaises(TypeError, operator.delslice, a)
        self.failUnlessRaises(TypeError, operator.delslice, a, None, None)
        self.failUnless(operator.delslice(a, 2, 8) is None)
        self.assert_(a == [0, 1, 8, 9])
        operator.delslice(a, 0, test_support.MAX_Py_ssize_t)
        self.assert_(a == []) 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:10,代码来源:test_operator.py

示例8: test_getslice

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import MAX_Py_ssize_t [as 别名]
def test_getslice(self):
        a = range(10)
        self.failUnlessRaises(TypeError, operator.getslice)
        self.failUnlessRaises(TypeError, operator.getslice, a, None, None)
        self.failUnless(operator.getslice(a, 4, 6) == [4, 5])
        b = operator.getslice(a, 0, test_support.MAX_Py_ssize_t)
        self.assert_(b == a) 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:9,代码来源:test_operator.py

示例9: test_setslice

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import MAX_Py_ssize_t [as 别名]
def test_setslice(self):
        a = range(4)
        self.failUnlessRaises(TypeError, operator.setslice, a)
        self.failUnlessRaises(TypeError, operator.setslice, a, None, None, None)
        self.failUnless(operator.setslice(a, 1, 3, [2, 1]) is None)
        self.assert_(a == [0, 2, 1, 3])
        operator.setslice(a, 0, test_support.MAX_Py_ssize_t, [])
        self.assert_(a == []) 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:10,代码来源:test_operator.py


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