Skip to content

Commit 17ee782

Browse files
committed
tests(register_django_docutils_role): More coverage
1 parent 7509879 commit 17ee782

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/test_docutils_roles.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,22 @@ class RoleContentFixture(t.NamedTuple):
4848
expected_html: str
4949

5050

51-
def test_register_django_docutils_roles() -> None:
51+
def test_register_django_docutils_roles(monkeypatch: pytest.MonkeyPatch) -> None:
5252
"""Assertions for register_django_docutils_roles()."""
53+
from django_docutils.lib import roles as roles_package
54+
55+
assert roles_package.DJANGO_DOCUTILS_LIB_RST, ( # type:ignore[attr-defined]
56+
"Sanity-check, something truthy should be set." ""
57+
)
58+
register_django_docutils_roles()
59+
60+
monkeypatch.setattr(roles_package, "DJANGO_DOCUTILS_LIB_RST", {})
61+
register_django_docutils_roles()
62+
63+
monkeypatch.setattr(roles_package, "DJANGO_DOCUTILS_LIB_RST", {"other": None})
64+
register_django_docutils_roles()
65+
66+
monkeypatch.setattr(roles_package, "DJANGO_DOCUTILS_LIB_RST", {"roles": {}})
5367
register_django_docutils_roles()
5468

5569

0 commit comments

Comments
 (0)