#104
gdtest_parser_sphinx
OK
CONFIG
Tests parser: sphinx config
Tests parser: 'sphinx' with Sphinx :param:/:returns: docstrings. Three functions and one class. Parser should correctly handle Sphinx field list format.
Build Mode
● Has great-docs.yml
This package ships a pre-supplied config.
The great-docs init step is skipped and
great-docs build uses the spec-defined configuration directly.
Tests specific config options and their rendered output.
Dimensions
K11
K11parser: sphinxconfig
Source Files
gdtest_parser_sphinx/
__init__.py
"""Package testing parser sphinx config."""
__version__ = "0.1.0"
__all__ = ["Timer", "create_timer", "format_duration"]
class Timer:
"""A simple timer for measuring elapsed time.
:param name: The name of the timer.
:type name: str
"""
def __init__(self, name: str = "default"):
self.name = name
self._start = None
self._end = None
def start(self):
"""Start the timer.
:returns: None
"""
self._start = 0.0
def stop(self):
"""Stop the timer.
:returns: None
"""
self._end = 1.0
def elapsed(self) -> float:
"""Return the elapsed time in seconds.
:returns: The elapsed time.
:rtype: float
:raises RuntimeError: If the timer has not been started.
"""
if self._start is None:
raise RuntimeError("Timer not started")
return (self._end or 0.0) - self._start
def create_timer(name: str) -> "Timer":
"""Create a new Timer instance.
:param name: The name for the new timer.
:type name: str
:returns: A new Timer instance.
:rtype: Timer
"""
return Timer(name=name)
def format_duration(seconds: float) -> str:
"""Format a duration in seconds as a human-readable string.
:param seconds: The duration in seconds.
:type seconds: float
:returns: A formatted duration string.
:rtype: str
"""
return f"{seconds:.2f}s"README.md
# gdtest-parser-sphinx Tests parser: sphinx config.
great-docs.yml
parser: sphinx