当前位置: 首页>>代码示例>>Python>>正文


Python common.URLError方法代码示例

本文整理汇总了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) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:19,代码来源:test_parsers.py

示例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) 
开发者ID:securityclippy,项目名称:elasticintel,代码行数:20,代码来源:test_excel.py

示例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.*') 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:5,代码来源:test_html.py

示例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) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:9,代码来源:test_html.py

示例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())) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:16,代码来源:test_common.py

示例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) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:17,代码来源:test_excel.py

示例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' 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:9,代码来源:test_html.py

示例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) 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:14,代码来源:common.py

示例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.*') 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:test_html.py

示例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.*') 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:test_html.py

示例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) 
开发者ID:securityclippy,项目名称:elasticintel,代码行数:15,代码来源:common.py


注:本文中的pandas.io.common.URLError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。