Skip to content

Commit 58b56c5

Browse files
committed
test: Add hypothesis tests
1 parent 863ed15 commit 58b56c5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

python/tests-py/test_inlining.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
from contextlib import suppress
2+
13
import pytest
4+
from hypothesis import given, provisional, settings
5+
from hypothesis import strategies as st
26

37
import css_inline
48

@@ -58,3 +62,18 @@ def test_inline_many_wrong_type():
5862
def test_invalid_base_url():
5963
with pytest.raises(ValueError):
6064
css_inline.CSSInliner(base_url="foo")
65+
66+
67+
@given(
68+
document=st.text(),
69+
remove_style_tags=st.booleans(),
70+
base_url=provisional.urls(),
71+
load_remote_stylesheets=st.booleans(),
72+
)
73+
@settings(max_examples=1000)
74+
def test_random_input(document, remove_style_tags, base_url, load_remote_stylesheets):
75+
with suppress(ValueError):
76+
inliner = css_inline.CSSInliner(
77+
remove_style_tags=remove_style_tags, base_url=base_url, load_remote_stylesheets=load_remote_stylesheets
78+
)
79+
inliner.inline(document)

0 commit comments

Comments
 (0)