本文整理匯總了Python中urlparse.spam方法的典型用法代碼示例。如果您正苦於以下問題:Python urlparse.spam方法的具體用法?Python urlparse.spam怎麽用?Python urlparse.spam使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類urlparse
的用法示例。
在下文中一共展示了urlparse.spam方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_files_checked
# 需要導入模塊: import urlparse [as 別名]
# 或者: from urlparse import spam [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)
示例2: test_multiple_imports_as
# 需要導入模塊: import urlparse [as 別名]
# 或者: from urlparse import spam [as 別名]
def test_multiple_imports_as(self):
b = """
import copy_reg as bar, HTMLParser as foo, urlparse
s = urlparse.spam(bar.foo())
"""
a = """
import copyreg as bar, html.parser as foo, urllib.parse
s = urllib.parse.spam(bar.foo())
"""
self.check(b, a)
示例3: test_comments_and_spacing
# 需要導入模塊: import urlparse [as 別名]
# 或者: from urlparse import spam [as 別名]
def test_comments_and_spacing(self):
b = """b = 0x12L"""
a = """b = 0x12"""
self.check(b, a)
b = """b = 0755 # spam"""
a = """b = 0o755 # spam"""
self.check(b, a)
示例4: test_future_builtins
# 需要導入模塊: import urlparse [as 別名]
# 或者: from urlparse import spam [as 別名]
def test_future_builtins(self):
a = "from future_builtins import spam, filter; filter(f, 'ham')"
self.unchanged(a)
b = """from future_builtins import spam; x = filter(f, 'abc')"""
a = """from future_builtins import spam; x = list(filter(f, 'abc'))"""
self.check(b, a)
a = "from future_builtins import *; filter(f, 'ham')"
self.unchanged(a)
示例5: test_from_as
# 需要導入模塊: import urlparse [as 別名]
# 或者: from urlparse import spam [as 別名]
def test_from_as(self):
b = "from green.eggs import ham as spam"
a = "from .green.eggs import ham as spam"
self.check_both(b, a)