Skip to content

Validator implementations use manual __slots__ inconsistently with the rest of the codebase #84

Description

@deyna256

ExactMatch, Contains, Regex, and JsonSchema are defined with manual __slots__ and __init__:

class ExactMatch(Validator):
    __slots__ = ("expected", "case_sensitive")

    def __init__(self, expected: str, case_sensitive: bool = True) -> None:
        self.expected = expected
        self.case_sensitive = case_sensitive

Every other data-holding class in the codebase — Metrics, RetryConfig, Prompt, TestResult, Summary, Report — uses @dataclass(frozen=True, slots=True). The validator classes were explicitly converted to __slots__-based form in #68, moving them away from the pattern used everywhere else. There is no documented reason for this asymmetry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    debtAccumulated shortcuts and workarounds

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions