Skip to content

Case-insensitive and multi-substring matching for assert_final_output(contains=...) #2

Description

@simukappu

assert_final_output(result, contains="Tokyo") currently does a case-sensitive substring check against a single string. Two small, backward-compatible additions would make it more useful:

  1. Accept a list of substrings for contains, all of which must be present.
  2. Add a case_sensitive: bool = True parameter that, when False, lowercases both sides before comparing.

Example

# all substrings must be present
assert_final_output(result, contains=["Tokyo", "22°C"])

# case-insensitive substring check
assert_final_output(result, contains="tokyo", case_sensitive=False)

Acceptance criteria

  • contains accepts both a str (existing behavior) and a list[str] (all must match).
  • case_sensitive defaults to True, so existing tests are unaffected.
  • The FinalOutputError message names which substring was missing when a list is passed.
  • New tests cover: single string (existing), list with all present, list with one missing, case-insensitive hit, case-insensitive miss.
  • equals and matches behavior is unchanged.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions