← GDG /

#297 gdtest_ref_include_inherited

#297 gdtest_ref_include_inherited OK CONFIG
Reference config with include_inherited: true flag.
Reference config using include_inherited: true on Circle. The renderer should automatically include inherited methods (describe) from Shape without the user listing them explicitly.
View Site → Build Log ๐Ÿงช Test Coverage

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

P10
P10include_inherited flagreference

Source Files

๐Ÿ“ gdtest_ref_include_inherited/
๐Ÿ“„ __init__.py
"""Package testing include_inherited flag."""

__version__ = "0.1.0"
__all__ = ["Shape", "Circle"]


class Shape:
    """
    Abstract base shape.

    Parameters
    ----------
    color : str
        Fill color.
    """

    def __init__(self, color: str = "red"):
        self.color = color

    def area(self) -> float:
        """
        Compute the area of the shape.

        Returns
        -------
        float
            Area value.
        """
        raise NotImplementedError

    def perimeter(self) -> float:
        """
        Compute the perimeter of the shape.

        Returns
        -------
        float
            Perimeter value.
        """
        raise NotImplementedError

    def describe(self) -> str:
        """
        Return a human-readable description.

        Returns
        -------
        str
            Description string.
        """
        return f"{self.__class__.__name__}(color={self.color})"


class Circle(Shape):
    """
    A circle shape.

    Parameters
    ----------
    radius : float
        Circle radius.
    color : str
        Fill color.
    """

    def __init__(self, radius: float, color: str = "blue"):
        super().__init__(color)
        self.radius = radius

    def area(self) -> float:
        """
        Compute the area of the circle.

        Returns
        -------
        float
            Pi * radius^2.
        """
        import math
        return math.pi * self.radius ** 2

    def perimeter(self) -> float:
        """
        Compute the circumference.

        Returns
        -------
        float
            2 * pi * radius.
        """
        import math
        return 2 * math.pi * self.radius
๐Ÿ“„ README.md
# gdtest-ref-include-inherited

Tests include_inherited: true flag for auto-documenting inherited methods.
๐Ÿ“„ great-docs.yml
reference:
  - title: Shapes
    desc: Shape hierarchy
    contents:
      - Shape
      - name: Circle
        include_inherited: true