本文整理匯總了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)