本文整理汇总了Python中pandas.io.common.URLError方法的典型用法代码示例。如果您正苦于以下问题:Python common.URLError方法的具体用法?Python common.URLError怎么用?Python common.URLError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandas.io.common
的用法示例。
在下文中一共展示了common.URLError方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_file
# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import URLError [as 别名]
def test_file(self):
# FILE
if sys.version_info[:2] < (2, 6):
raise nose.SkipTest("file:// not supported with Python < 2.6")
dirpath = tm.get_data_path()
localtable = os.path.join(dirpath, 'salary.table')
local_table = self.read_table(localtable)
try:
url_table = self.read_table('file://localhost/' + localtable)
except URLError:
# fails on some systems
raise nose.SkipTest("failing on %s" %
' '.join(platform.uname()).strip())
tm.assert_frame_equal(url_table, local_table)
示例2: test_read_from_file_url
# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import URLError [as 别名]
def test_read_from_file_url(self):
# FILE
if sys.version_info[:2] < (2, 6):
pytest.skip("file:// not supported with Python < 2.6")
localtable = os.path.join(self.dirpath, 'test1' + self.ext)
local_table = read_excel(localtable)
try:
url_table = read_excel('file://localhost/' + localtable)
except URLError:
# fails on some systems
import platform
pytest.skip("failing on %s" %
' '.join(platform.uname()).strip())
tm.assert_frame_equal(url_table, local_table)
示例3: test_bad_url_protocol
# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import URLError [as 别名]
def test_bad_url_protocol(self):
with pytest.raises(URLError):
self.read_html('git://github.com', match='.*Water.*')
示例4: test_invalid_url
# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import URLError [as 别名]
def test_invalid_url(self):
try:
with pytest.raises(URLError):
self.read_html('http://www.a23950sdfa908sd.com',
match='.*Water.*')
except ValueError as e:
assert 'No tables found' in str(e)
示例5: test_local_file
# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import URLError [as 别名]
def test_local_file(all_parsers, csv_dir_path):
parser = all_parsers
kwargs = dict(sep="\t")
local_path = os.path.join(csv_dir_path, "salaries.csv")
local_result = parser.read_csv(local_path, **kwargs)
url = "file://localhost/" + local_path
try:
url_result = parser.read_csv(url, **kwargs)
tm.assert_frame_equal(url_result, local_result)
except URLError:
# Fails on some systems.
pytest.skip("Failing on: " + " ".join(platform.uname()))
示例6: test_read_from_file_url
# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import URLError [as 别名]
def test_read_from_file_url(self, ext):
# FILE
localtable = os.path.join(self.dirpath, 'test1' + ext)
local_table = read_excel(localtable)
try:
url_table = read_excel('file://localhost/' + localtable)
except URLError:
# fails on some systems
import platform
pytest.skip("failing on %s" %
' '.join(platform.uname()).strip())
tm.assert_frame_equal(url_table, local_table)
示例7: test_invalid_url
# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import URLError [as 别名]
def test_invalid_url(self):
try:
with pytest.raises(URLError):
self.read_html('http://www.a23950sdfa908sd.com',
match='.*Water.*')
except ValueError as e:
assert str(e) == 'No tables found'
示例8: test_file
# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import URLError [as 别名]
def test_file(self, datapath):
localtable = datapath('io', 'parser', 'data', 'salaries.csv')
local_table = self.read_table(localtable)
try:
url_table = self.read_table('file://localhost/' + localtable)
except URLError:
# fails on some systems
pytest.skip("failing on %s" %
' '.join(platform.uname()).strip())
tm.assert_frame_equal(url_table, local_table)
示例9: test_bad_url_protocol
# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import URLError [as 别名]
def test_bad_url_protocol(self):
with tm.assertRaises(URLError):
self.read_html('git://github.com', match='.*Water.*')
示例10: test_invalid_url
# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import URLError [as 别名]
def test_invalid_url(self):
with tm.assertRaises(URLError):
self.read_html('http://www.a23950sdfa908sd.com', match='.*Water.*')
示例11: test_file
# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import URLError [as 别名]
def test_file(self):
dirpath = tm.get_data_path()
localtable = os.path.join(dirpath, 'salaries.csv')
local_table = self.read_table(localtable)
try:
url_table = self.read_table('file://localhost/' + localtable)
except URLError:
# fails on some systems
pytest.skip("failing on %s" %
' '.join(platform.uname()).strip())
tm.assert_frame_equal(url_table, local_table)