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:
- Accept a list of substrings for
contains, all of which must be present.
- 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.
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:contains, all of which must be present.case_sensitive: bool = Trueparameter that, whenFalse, lowercases both sides before comparing.Example
Acceptance criteria
containsaccepts both astr(existing behavior) and alist[str](all must match).case_sensitivedefaults toTrue, so existing tests are unaffected.FinalOutputErrormessage names which substring was missing when a list is passed.equalsandmatchesbehavior is unchanged.