當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。