Skip to content

Commit

Permalink
Enable using MockInliner in place of Inliner for runtime type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
adamtheturtle committed Jan 21, 2025
1 parent fbb7f1d commit c537182
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions myst_parser/mocking.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ class MockInliner:
This is parsed to role functions.
"""

# Override the ``__class__`` attribute to enable runtime type checking.
# See https://beartype.readthedocs.io/en/latest/faq/#mock-types.
@property
def __class__(self) -> type:
return Inliner

@__class__.setter
def __class__(self, value: type) -> None:
raise NotImplementedError

def __init__(self, renderer: DocutilsRenderer):
"""Initialize the mock inliner."""
self._renderer = renderer
Expand Down

0 comments on commit c537182

Please sign in to comment.