當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。