Skip to content

Commit 440d1e5

Browse files
committed
test errors
1 parent dac5f83 commit 440d1e5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_extruct.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,19 @@ def _microdata_custom_url(self, test_file):
4949
get_testdata('schema.org', test_file)
5050
.decode('UTF-8'))}
5151
return body, expected
52+
53+
def test_errors(self):
54+
body = ''
55+
56+
# raise exceptions
57+
with pytest.raises(Exception):
58+
data = extruct.extract(body)
59+
60+
# ignore exceptions
61+
expected = {}
62+
data = extruct.extract(body, errors='ignore')
63+
assert data == expected
64+
65+
# ignore exceptions
66+
data = extruct.extract(body, errors='log')
67+
assert data == expected

0 commit comments

Comments
 (0)