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


Python string_tests.py方法代码示例

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


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

示例1: test_rsplit_bytearray

# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import py [as 别名]
def test_rsplit_bytearray(self):
        self.assertEqual(b'a b'.rsplit(memoryview(b' ')), [b'a', b'b'])

    # Optimizations:
    # __iter__? (optimization)
    # __reversed__? (optimization)

    # XXX More string methods?  (Those that don't use character properties)

    # There are tests in string_tests.py that are more
    # comprehensive for things like partition, etc.
    # Unfortunately they are all bundled with tests that
    # are not appropriate for bytes

    # I've started porting some of those into bytearray_tests.py, we should port
    # the rest that make sense (the code can be cleaned up to use modern
    # unittest methods at the same time). 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:19,代码来源:test_bytes.py

示例2: test_rsplit_bytearray

# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import py [as 别名]
def test_rsplit_bytearray(self):
        self.assertEqual(b'a b'.rsplit(memoryview(b' ')), [b'a', b'b'])

    # Optimizations:
    # __iter__? (optimization)
    # __reversed__? (optimization)

    # XXX More string methods?  (Those that don't use character properties)

    # There are tests in string_tests.py that are more
    # comprehensive for things like split, partition, etc.
    # Unfortunately they are all bundled with tests that
    # are not appropriate for bytes

    # I've started porting some of those into bytearray_tests.py, we should port
    # the rest that make sense (the code can be cleaned up to use modern
    # unittest methods at the same time). 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:19,代码来源:test_bytes.py

示例3: test_compare

# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import py [as 别名]
def test_compare(self):
        if sys.flags.bytes_warning:
            def bytes_warning():
                return test.support.check_warnings(('', BytesWarning))
            with bytes_warning():
                b'' == ''
            with bytes_warning():
                b'' != ''
            with bytes_warning():
                bytearray(b'') == ''
            with bytes_warning():
                bytearray(b'') != ''
        else:
            self.skipTest("BytesWarning is needed for this test: use -bb option")

    # Optimizations:
    # __iter__? (optimization)
    # __reversed__? (optimization)

    # XXX More string methods?  (Those that don't use character properties)

    # There are tests in string_tests.py that are more
    # comprehensive for things like split, partition, etc.
    # Unfortunately they are all bundled with tests that
    # are not appropriate for bytes

    # I've started porting some of those into bytearray_tests.py, we should port
    # the rest that make sense (the code can be cleaned up to use modern
    # unittest methods at the same time). 
开发者ID:IronLanguages,项目名称:ironpython3,代码行数:31,代码来源:test_bytes.py

示例4: test_compare

# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import py [as 别名]
def test_compare(self):
        def bytes_warning():
            return test.support.check_warnings(('', BytesWarning))
        with bytes_warning():
            b'' == ''
        with bytes_warning():
            '' == b''
        with bytes_warning():
            b'' != ''
        with bytes_warning():
            '' != b''
        with bytes_warning():
            bytearray(b'') == ''
        with bytes_warning():
            '' == bytearray(b'')
        with bytes_warning():
            bytearray(b'') != ''
        with bytes_warning():
            '' != bytearray(b'')
        with bytes_warning():
            b'\0' == 0
        with bytes_warning():
            0 == b'\0'
        with bytes_warning():
            b'\0' != 0
        with bytes_warning():
            0 != b'\0'

    # Optimizations:
    # __iter__? (optimization)
    # __reversed__? (optimization)

    # XXX More string methods?  (Those that don't use character properties)

    # There are tests in string_tests.py that are more
    # comprehensive for things like split, partition, etc.
    # Unfortunately they are all bundled with tests that
    # are not appropriate for bytes

    # I've started porting some of those into bytearray_tests.py, we should port
    # the rest that make sense (the code can be cleaned up to use modern
    # unittest methods at the same time). 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:44,代码来源:test_bytes.py

示例5: test_compare

# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import py [as 别名]
def test_compare(self):
        def bytes_warning():
            return test.support.check_warnings(('', BytesWarning))
        with bytes_warning():
            b'' == ''
        with bytes_warning():
            '' == b''
        with bytes_warning():
            b'' != ''
        with bytes_warning():
            '' != b''
        with bytes_warning():
            bytearray(b'') == ''
        with bytes_warning():
            '' == bytearray(b'')
        with bytes_warning():
            bytearray(b'') != ''
        with bytes_warning():
            '' != bytearray(b'')
        with bytes_warning():
            b'\0' == 0
        with bytes_warning():
            0 == b'\0'
        with bytes_warning():
            b'\0' != 0
        with bytes_warning():
            0 != b'\0'

    # Optimizations:
    # __iter__? (optimization)
    # __reversed__? (optimization)

    # XXX More string methods?  (Those that don't use character properties)

    # There are tests in string_tests.py that are more
    # comprehensive for things like partition, etc.
    # Unfortunately they are all bundled with tests that
    # are not appropriate for bytes

    # I've started porting some of those into bytearray_tests.py, we should port
    # the rest that make sense (the code can be cleaned up to use modern
    # unittest methods at the same time). 
开发者ID:ShikyoKira,项目名称:Project-New-Reign---Nemesis-Main,代码行数:44,代码来源:test_bytes.py


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