-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(runtime): Impl and register CDATA and content-only element gener…
…ation strategies
- Loading branch information
1 parent
29c5cc9
commit 921e569
Showing
2 changed files
with
99 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Register hypothesis strategies for generating lxml | ||
# elements and various auxiliary types. | ||
|
||
from __future__ import annotations | ||
|
||
import hypothesis.strategies as st | ||
import lxml.etree as _e | ||
import pytest | ||
|
||
from ._testutils import strategy as _st | ||
|
||
|
||
def pytest_collection_finish(session: pytest.Session) -> None: | ||
pluginmanager = session.config.pluginmanager | ||
if not pluginmanager.has_plugin("hypothesis"): | ||
return | ||
|
||
st.register_type_strategy(_e.CDATA, _st.cdata()) | ||
st.register_type_strategy(_e._ProcessingInstruction, _st.processing_instruction()) | ||
st.register_type_strategy(_e._Comment, _st.comment()) | ||
st.register_type_strategy(_e._Entity, _st.entity()) |