File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -967,3 +967,26 @@ 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
+ _skip_if_no ('lxml' )
974
+
975
+ class UnseekableStringIO (StringIO ):
976
+ def seekable (self ):
977
+ return False
978
+
979
+ good = UnseekableStringIO ('''
980
+ <table><tr><td>spam<br />eggs</td></tr></table>''' )
981
+ bad = UnseekableStringIO ('''
982
+ <table><tr><td>spam<foobr />eggs</td></tr></table>''' )
983
+
984
+ assert read_html (good )
985
+ assert read_html (bad , flavor = 'bs4' )
986
+
987
+ bad .seek (0 )
988
+
989
+ with pytest .raises (ValueError ,
990
+ match = 'passed a non-rewindable file object' ):
991
+ read_html (bad )
992
+
You can’t perform that action at this time.
0 commit comments