Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not (yet) in the Beartype documentation, but the explanation for it is in beartype/beartype#485.

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

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