We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0d4b418 commit 9e81317Copy full SHA for 9e81317
pandas/tests/io/test_html.py
@@ -967,3 +967,27 @@ def test_importcheck_thread_safety():
967
while helper_thread1.is_alive() or helper_thread2.is_alive():
968
pass
969
assert None is helper_thread1.err is helper_thread2.err
970
+
971
972
+def test_parse_failure_unseekable():
973
+ # Issue #17975
974
+ _skip_if_no('lxml')
975
976
+ class UnseekableStringIO(StringIO):
977
+ def seekable(self):
978
+ return False
979
980
+ good = UnseekableStringIO('''
981
+ <table><tr><td>spam<br />eggs</td></tr></table>''')
982
+ bad = UnseekableStringIO('''
983
+ <table><tr><td>spam<foobr />eggs</td></tr></table>''')
984
985
+ assert read_html(good)
986
+ assert read_html(bad, flavor='bs4')
987
988
+ bad.seek(0)
989
990
+ with pytest.raises(ValueError,
991
+ match='passed a non-rewindable file object'):
992
+ read_html(bad)
993
0 commit comments