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


Python b.join方法代码示例

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


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

示例1: test_import_from

# 需要导入模块: from x.a import b [as 别名]
# 或者: from x.a.b import join [as 别名]
def test_import_from(self):
        for old, changes in self.modules.items():
            all_members = []
            for new, members in changes:
                for member in members:
                    all_members.append(member)
                    b = "from %s import %s" % (old, member)
                    a = "from %s import %s" % (new, member)
                    self.check(b, a)

                    s = "from foo import %s" % member
                    self.unchanged(s)

                b = "from %s import %s" % (old, ", ".join(members))
                a = "from %s import %s" % (new, ", ".join(members))
                self.check(b, a)

                s = "from foo import %s" % ", ".join(members)
                self.unchanged(s)

            # test the breaking of a module into multiple replacements
            b = "from %s import %s" % (old, ", ".join(all_members))
            a = "\n".join(["from %s import %s" % (new, ", ".join(members))
                            for (new, members) in changes])
            self.check(b, a) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:27,代码来源:test_fixers.py

示例2: test_import_module_usage

# 需要导入模块: from x.a import b [as 别名]
# 或者: from x.a.b import join [as 别名]
def test_import_module_usage(self):
        for old, changes in self.modules.items():
            for new, members in changes:
                for member in members:
                    new_import = ", ".join([n for (n, mems)
                                            in self.modules[old]])
                    b = """
                        import %s
                        foo(%s.%s)
                        """ % (old, old, member)
                    a = """
                        import %s
                        foo(%s.%s)
                        """ % (new_import, new, member)
                    self.check(b, a)
                    b = """
                        import %s
                        %s.%s(%s.%s)
                        """ % (old, old, member, old, member)
                    a = """
                        import %s
                        %s.%s(%s.%s)
                        """ % (new_import, new, member, new, member)
                    self.check(b, a) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:26,代码来源:test_fixers.py

示例3: test_files_checked

# 需要导入模块: from x.a import b [as 别名]
# 或者: from x.a.b import join [as 别名]
def test_files_checked(self):
        def p(path):
            # Takes a unix path and returns a path with correct separators
            return os.path.pathsep.join(path.split("/"))

        self.always_exists = False
        self.present_files = set(['__init__.py'])
        expected_extensions = ('.py', os.path.sep, '.pyc', '.so', '.sl', '.pyd')
        names_to_test = (p("/spam/eggs.py"), "ni.py", p("../../shrubbery.py"))

        for name in names_to_test:
            self.files_checked = []
            self.filename = name
            self.unchanged("import jam")

            if os.path.dirname(name):
                name = os.path.dirname(name) + '/jam'
            else:
                name = 'jam'
            expected_checks = set(name + ext for ext in expected_extensions)
            expected_checks.add("__init__.py")

            self.assertEqual(set(self.files_checked), expected_checks) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:25,代码来源:test_fixers.py

示例4: warns

# 需要导入模块: from x.a import b [as 别名]
# 或者: from x.a.b import join [as 别名]
def warns(self, before, after, message, unchanged=False):
        tree = self._check(before, after)
        self.assertIn(message, "".join(self.fixer_log))
        if not unchanged:
            self.assertTrue(tree.was_changed) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:7,代码来源:test_fixers.py


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