當前位置: 首頁>>代碼示例>>Python>>正文


Python b.join方法代碼示例

本文整理匯總了Python中x.b.join方法的典型用法代碼示例。如果您正苦於以下問題:Python b.join方法的具體用法?Python b.join怎麽用?Python b.join使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在x.b的用法示例。


在下文中一共展示了b.join方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_import_from

# 需要導入模塊: from x import b [as 別名]
# 或者: from x.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 import b [as 別名]
# 或者: from x.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 import b [as 別名]
# 或者: from x.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 import b [as 別名]
# 或者: from x.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.b.join方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。