File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -967,3 +967,27 @@ def test_importcheck_thread_safety():
967
967
while helper_thread1 .is_alive () or helper_thread2 .is_alive ():
968
968
pass
969
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
+
You can’t perform that action at this time.
0 commit comments