Skip to content

CI: Revive Banklist Tests #42889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions doc/source/user_guide/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2464,14 +2464,16 @@ Read a URL with no options:

.. ipython:: python

url = (
"https://raw.githubusercontent.com/pandas-dev/pandas/master/"
"pandas/tests/io/data/html/spam.html"
)
url = "https://www.fdic.gov/resources/resolutions/bank-failures/failed-bank-list/index.html"
dfs = pd.read_html(url)
dfs

Read in the content of the "banklist.html" file and pass it to ``read_html``
.. note::

The data from the above URL changes every Monday so the resulting data above
and the data below may be slightly different.

Read in the content of the file from the above URL and pass it to ``read_html``
as a string:

.. ipython:: python
Expand Down
14 changes: 6 additions & 8 deletions pandas/tests/io/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,28 +134,26 @@ def test_to_html_compat(self):
res = self.read_html(out, attrs={"class": "dataframe"}, index_col=0)[0]
tm.assert_frame_equal(res, df)

@pytest.mark.xfail(reason="Html file was removed")
@tm.network
def test_banklist_url_positional_match(self):
url = "https://www.fdic.gov/bank/individual/failed/banklist.html"
url = "http://www.fdic.gov/resources/resolutions/bank-failures/failed-bank-list/index.html" # noqa E501
# Passing match argument as positional should cause a FutureWarning.
with tm.assert_produces_warning(FutureWarning):
df1 = self.read_html(
url, "First Federal Bank of Florida", attrs={"id": "table"}
url, "First Federal Bank of Florida", attrs={"class": "dataTable"}
)
with tm.assert_produces_warning(FutureWarning):
df2 = self.read_html(url, "Metcalf Bank", attrs={"id": "table"})
df2 = self.read_html(url, "Metcalf Bank", attrs={"class": "dataTable"})

assert_framelist_equal(df1, df2)

@pytest.mark.xfail(reason="Html file was removed")
@tm.network
def test_banklist_url(self):
url = "https://www.fdic.gov/bank/individual/failed/banklist.html"
url = "http://www.fdic.gov/resources/resolutions/bank-failures/failed-bank-list/index.html" # noqa E501
df1 = self.read_html(
url, match="First Federal Bank of Florida", attrs={"id": "table"}
url, match="First Federal Bank of Florida", attrs={"class": "dataTable"}
)
df2 = self.read_html(url, match="Metcalf Bank", attrs={"id": "table"})
df2 = self.read_html(url, match="Metcalf Bank", attrs={"class": "dataTable"})

assert_framelist_equal(df1, df2)

Expand Down