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


Python UserString.MutableString方法代码示例

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


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

示例1: test_extended_set_del_slice

# 需要导入模块: import UserString [as 别名]
# 或者: from UserString import MutableString [as 别名]
def test_extended_set_del_slice(self):
        indices = (0, None, 1, 3, 19, 100, -1, -2, -31, -100)
        orig = string.ascii_letters + string.digits
        for start in indices:
            for stop in indices:
                # Use indices[1:] when MutableString can handle real
                # extended slices
                for step in (None, 1, -1):
                    s = self.type2test(orig)
                    L = list(orig)
                    # Make sure we have a slice of exactly the right length,
                    # but with (hopefully) different data.
                    data = L[start:stop:step]
                    data.reverse()
                    L[start:stop:step] = data
                    s[start:stop:step] = "".join(data)
                    self.assertEqual(s, "".join(L))

                    del L[start:stop:step]
                    del s[start:stop:step]
                    self.assertEqual(s, "".join(L)) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:23,代码来源:test_userstring.py

示例2: test_mutablestring_removal

# 需要导入模块: import UserString [as 别名]
# 或者: from UserString import MutableString [as 别名]
def test_mutablestring_removal(self):
        # UserString.MutableString has been removed in 3.0.
        import UserString
        # UserString tests may have already triggered this warning
        reset_module_registry(UserString)
        with warnings.catch_warnings():
            warnings.filterwarnings("error", ".*MutableString",
                                    DeprecationWarning)
            self.assertRaises(DeprecationWarning, UserString.MutableString) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:test_py3kwarn.py

示例3: test_main

# 需要导入模块: import UserString [as 别名]
# 或者: from UserString import MutableString [as 别名]
def test_main():
    with warnings.catch_warnings():
        warnings.filterwarnings("ignore", ".*MutableString has been removed",
                                DeprecationWarning)
        warnings.filterwarnings("ignore",
                                ".*__(get|set|del)slice__ has been removed",
                                DeprecationWarning)
        test_support.run_unittest(UserStringTest, MutableStringTest) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:test_userstring.py

示例4: isstringtype

# 需要导入模块: import UserString [as 别名]
# 或者: from UserString import MutableString [as 别名]
def isstringtype( obj ):
    """Is the object of a Python string type?"""
    if isinstance(obj, basestring):
        return True
    # Must also check for some other pseudo-string types
    import types, UserString
    return isinstance(obj, types.StringTypes) \
           or isinstance(obj, UserString.UserString) \
           or isinstance(obj, UserString.MutableString)


# ----------------------------------------------------------------------
# Numeric helpers 
开发者ID:teamtachyon,项目名称:Quillpad-Server,代码行数:15,代码来源:demjson.py


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