Skip to content

Commit 0523dc6

Browse files
committed
Merge pull request #4009 from jtratner/add-network-label-to-test-html
TST: Change test_html to use stored data + mark other
2 parents 795004d + 6bc060b commit 0523dc6

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

pandas/io/tests/test_html.py

+9-14
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ def test_to_html_compat(self):
9191
assert_frame_equal(res, df)
9292

9393
@network
94-
@slow
9594
def test_banklist_url(self):
9695
url = 'http://www.fdic.gov/bank/individual/failed/banklist.html'
9796
df1 = self.run_read_html(url, 'First Federal Bank of Florida',
@@ -101,7 +100,6 @@ def test_banklist_url(self):
101100
assert_framelist_equal(df1, df2)
102101

103102
@network
104-
@slow
105103
def test_spam_url(self):
106104
url = ('http://ndb.nal.usda.gov/ndb/foods/show/1732?fg=&man=&'
107105
'lfacet=&format=&count=&max=25&offset=&sort=&qlookup=spam')
@@ -332,15 +330,14 @@ def test_negative_skiprows_banklist(self):
332330
self.assertRaises(AssertionError, self.run_read_html, url, 'Florida',
333331
skiprows=-1)
334332

335-
@slow
333+
@network
336334
def test_multiple_matches(self):
337335
url = 'http://code.google.com/p/pythonxy/wiki/StandardPlugins'
338336
dfs = self.run_read_html(url, match='Python',
339337
attrs={'class': 'wikitable'})
340338
self.assertGreater(len(dfs), 1)
341339

342340
@network
343-
@slow
344341
def test_pythonxy_plugins_table(self):
345342
url = 'http://code.google.com/p/pythonxy/wiki/StandardPlugins'
346343
dfs = self.run_read_html(url, match='Python',
@@ -438,8 +435,9 @@ def test_invalid_flavor():
438435
flavor='not a* valid**++ flaver')
439436

440437

441-
def get_elements_from_url(url, element='table'):
438+
def get_elements_from_url(url, element='table', base_url="file://"):
442439
_skip_if_none_of(('bs4', 'html5lib'))
440+
url = "".join([base_url, url])
443441
from bs4 import BeautifulSoup, SoupStrainer
444442
strainer = SoupStrainer(element)
445443
with closing(urlopen(url)) as f:
@@ -449,11 +447,10 @@ def get_elements_from_url(url, element='table'):
449447

450448
@slow
451449
def test_bs4_finds_tables():
452-
url = ('http://ndb.nal.usda.gov/ndb/foods/show/1732?fg=&man=&'
453-
'lfacet=&format=&count=&max=25&offset=&sort=&qlookup=spam')
450+
filepath = os.path.join(DATA_PATH, "spam.html")
454451
with warnings.catch_warnings():
455452
warnings.filterwarnings('ignore')
456-
assert get_elements_from_url(url, 'table')
453+
assert get_elements_from_url(filepath, 'table')
457454

458455

459456
def get_lxml_elements(url, element):
@@ -465,13 +462,11 @@ def get_lxml_elements(url, element):
465462

466463
@slow
467464
def test_lxml_finds_tables():
468-
url = ('http://ndb.nal.usda.gov/ndb/foods/show/1732?fg=&man=&'
469-
'lfacet=&format=&count=&max=25&offset=&sort=&qlookup=spam')
470-
assert get_lxml_elements(url, 'table')
465+
filepath = os.path.join(DATA_PATH, "spam.html")
466+
assert get_lxml_elements(filepath, 'table')
471467

472468

473469
@slow
474470
def test_lxml_finds_tbody():
475-
url = ('http://ndb.nal.usda.gov/ndb/foods/show/1732?fg=&man=&'
476-
'lfacet=&format=&count=&max=25&offset=&sort=&qlookup=spam')
477-
assert get_lxml_elements(url, 'tbody')
471+
filepath = os.path.join(DATA_PATH, "spam.html")
472+
assert get_lxml_elements(filepath, 'tbody')

0 commit comments

Comments
 (0)