Skip to content

Duplicate case-sensitivity logic and mode string in ExactMatch and Contains #81

Description

@deyna256

ExactMatch and Contains share identical logic in two places:

1. validate() — case-insensitive comparison pattern:

if self.case_sensitive:
    passed = response == self.expected   # or: self.substring in response
else:
    passed = response.lower() == self.expected.lower()

This block is copy-pasted verbatim in both classes.

2. describe() — mode label string:

mode = "case-sensitive" if self.case_sensitive else "case-insensitive"

This expression is identical in both ExactMatch.describe() and Contains.describe().

Any change to the case-insensitive comparison logic or the mode label must be applied in two separate places.

Metadata

Metadata

Assignees

No one assigned

    Labels

    debtAccumulated shortcuts and workaroundsrefactoringCode structure, dead code, duplication

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions