← GDG /

#292 gdtest_inline_methods

#292 gdtest_inline_methods OK INIT
Tests inline_methods config (default threshold of 5)
Tests the inline_methods config with the default threshold of 5. SmallWidget (3 methods) stays inline while BigProcessor (8 methods) gets split into a separate method section.
View Site → Build Log ๐Ÿงช Test Coverage

Build Mode

○ No great-docs.yml

This package has no pre-supplied config. It tests the full great-docs initgreat-docs build pipeline from scratch, relying entirely on auto-detection of the package layout, docstring style, and exports.

Dimensions

K54
K54inline_methods: default (5)config

Source Files

๐Ÿ“ gdtest_inline_methods/
๐Ÿ“„ __init__.py
"""Package testing inline_methods config option."""

__version__ = "0.1.0"
__all__ = ["SmallWidget", "BigProcessor", "helper_func"]


class SmallWidget:
    """
    A widget with few methods (should stay inline with default threshold).

    Parameters
    ----------
    name
        The widget name.
    """

    def __init__(self, name: str):
        self.name = name

    def render(self) -> str:
        """
        Render the widget as HTML.

        Returns
        -------
        str
            HTML representation of the widget.
        """
        return f"<widget>{self.name}</widget>"

    def resize(self, width: int, height: int) -> None:
        """
        Resize the widget.

        Parameters
        ----------
        width
            New width in pixels.
        height
            New height in pixels.
        """
        pass

    def toggle(self) -> bool:
        """
        Toggle the widget visibility.

        Returns
        -------
        bool
            New visibility state.
        """
        return True


class BigProcessor:
    """
    A processor with many methods (should split with default threshold).

    Parameters
    ----------
    config
        Configuration dictionary.

    Examples
    --------
    >>> proc = BigProcessor({"verbose": True})
    >>> proc.validate()
    True
    """

    def __init__(self, config: dict):
        self.config = config
        self._data = None

    def load(self, path: str) -> None:
        """
        Load data from a file.

        Parameters
        ----------
        path
            Path to the data file.
        """
        self._data = path

    def transform(self, func) -> "BigProcessor":
        """
        Apply a transformation.

        Parameters
        ----------
        func
            A callable to apply.

        Returns
        -------
        BigProcessor
            Self for chaining.
        """
        return self

    def filter(self, predicate) -> "BigProcessor":
        """
        Filter data by predicate.

        Parameters
        ----------
        predicate
            Filter function returning bool.

        Returns
        -------
        BigProcessor
            Self for chaining.
        """
        return self

    def sort(self, key: str) -> "BigProcessor":
        """
        Sort data by key.

        Parameters
        ----------
        key
            The sort key.

        Returns
        -------
        BigProcessor
            Self for chaining.
        """
        return self

    def aggregate(self, func, column: str) -> "BigProcessor":
        """
        Aggregate data.

        Parameters
        ----------
        func
            Aggregation function.
        column
            Column to aggregate.

        Returns
        -------
        BigProcessor
            Self for chaining.
        """
        return self

    def validate(self) -> bool:
        """
        Validate current state.

        Returns
        -------
        bool
            True if valid.
        """
        return self._data is not None

    def export(self, path: str, fmt: str = "csv") -> None:
        """
        Export data to file.

        Parameters
        ----------
        path
            Output path.
        fmt
            Output format.
        """
        pass

    def summary(self) -> dict:
        """
        Get a data summary.

        Returns
        -------
        dict
            Summary statistics.
        """
        return {"has_data": self._data is not None}


def helper_func(x: int, y: int) -> int:
    """
    Add two numbers.

    Parameters
    ----------
    x
        First number.
    y
        Second number.

    Returns
    -------
    int
        Sum of x and y.
    """
    return x + y
๐Ÿ“„ README.md
# gdtest-inline-methods

Package testing the `inline_methods` config option with default
threshold of 5. SmallWidget (3 methods) stays inline; BigProcessor
(8 methods) gets split to separate pages.
๐Ÿ“„ great-docs.yml
{}