本文整理汇总了Python中test.test_urllib2.sanepathname2url函数的典型用法代码示例。如果您正苦于以下问题:Python sanepathname2url函数的具体用法?Python sanepathname2url怎么用?Python sanepathname2url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sanepathname2url函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_file
def test_file(self):
TESTFN = test_support.TESTFN
f = open(TESTFN, 'w')
try:
f.write('hi there\n')
f.close()
urls = [
'file:'+sanepathname2url(os.path.abspath(TESTFN)),
('file:///nonsensename/etc/passwd', None, urllib2.URLError),
]
self._test_urls(urls, self._extra_handlers(), retry=True)
finally:
os.remove(TESTFN)
开发者ID:Crowdbooster,项目名称:gevent,代码行数:13,代码来源:test_urllib2net.py
示例2: test_file
def test_file(self):
TESTFN = support.TESTFN
f = open(TESTFN, "w")
try:
f.write("hi there\n")
f.close()
urls = [
"file:" + sanepathname2url(os.path.abspath(TESTFN)),
("file:///nonsensename/etc/passwd", None, urllib.error.URLError),
]
self._test_urls(urls, self._extra_handlers(), retry=True)
finally:
os.remove(TESTFN)
开发者ID:469306621,项目名称:Languages,代码行数:13,代码来源:test_urllib2net.py
示例3: test_file
def test_file(self):
TESTFN = test_support.TESTFN
f = open(TESTFN, "w")
try:
f.write("hi there\n")
f.close()
urls = [
"file:" + sanepathname2url(os.path.abspath(TESTFN)),
("file:///nonsensename/etc/passwd", None, urllib2.URLError),
]
self._test_urls(urls, self._extra_handlers(), retry=True)
finally:
os.remove(TESTFN)
self.assertRaises(ValueError, urllib2.urlopen, "./relative_path/to/file")
开发者ID:Zekom,项目名称:pypyjs,代码行数:15,代码来源:test_urllib2net.py
示例4: test_file
def test_file(self):
TESTFN = support.TESTFN
f = open(TESTFN, 'w')
try:
f.write('hi there\n')
f.close()
urls = [
'file:'+sanepathname2url(os.path.abspath(TESTFN)),
('file:///nonsensename/etc/passwd', None, urllib.error.URLError),
]
self._test_urls(urls, self._extra_handlers(), retry=True)
finally:
os.remove(TESTFN)
self.assertRaises(ValueError, urllib.request.urlopen, './relative_path/to/file')
开发者ID:isaiah,项目名称:jython3,代码行数:15,代码来源:test_urllib2net.py
示例5: test_file
def test_file(self):
TESTFN = test_support.TESTFN
f = open(TESTFN, 'w')
try:
f.write('hi there\n')
f.close()
urls = [
'file:'+sanepathname2url(os.path.abspath(TESTFN)),
# XXX bug, should raise URLError
#('file://nonsensename/etc/passwd', None, urllib2.URLError)
('file://nonsensename/etc/passwd', None, (EnvironmentError, socket.error))
]
self._test_urls(urls, self._extra_handlers())
finally:
os.remove(TESTFN)
开发者ID:Alex-CS,项目名称:sonify,代码行数:16,代码来源:test_urllib2net.py
注:本文中的test.test_urllib2.sanepathname2url函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论