Skip to content

feat: list[str] + case-insensitive support for assert_final_output(contains=...) - #4

Merged
simukappu merged 1 commit into
simukappu:mainfrom
Neohu-ceo:fix/contains-list-ci
Oct 18, 2026
Merged

simukappu merged 1 commit into
simukappu:mainfrom
Neohu-ceo:fix/contains-list-ci

Conversation

@Neohu-ceo

Copy link
Copy Markdown
Contributor

Summary

Extends assert_final_output(contains=...) with backward-compatible features (fixes #2):

  1. list[str] — contains now accepts a list; all substrings must match
  2. case_sensitive=False — case-insensitive substring matching

Examples

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

# Case-insensitive
assert_final_output(result, contains="tokyo", case_sensitive=False)

equals and matches unchanged. Default case_sensitive=True — existing tests unaffected.

@simukappu

Copy link
Copy Markdown
Owner

Thanks for the PR, and for picking up a good first issue! The implementation looks correct and is backward-compatible. Single-string input with the default case_sensitive=True keeps the existing behavior and error message.

CI is failing on the coverage check, which points at the missing tests. The new branches (the case_sensitive path and the missing / single-vs-multiple formatting) aren't exercised yet. Could you add tests under tests/test_assertions.py covering: single string (existing), list with all present, list with one missing, case-insensitive hit, and case-insensitive miss? Once those are in and CI is green, this is good to merge.

No need to touch the CHANGELOG. I'll handle that on the maintainer side. Thanks again!

@simukappu simukappu added the enhancement New feature or request label Jun 19, 2026
@simukappu

Copy link
Copy Markdown
Owner

Thanks for the contribution, and sorry for the long wait. I've merged your commit into develop as-is and added a follow-up with the tests from #2, a ValueError for an empty contains, case-insensitive matching via str.casefold(), and README docs. case_sensitive stays scoped to contains, as #2 specifies. It will ship in 0.5.0, and this PR will close automatically when main is updated at release.

@simukappu
simukappu merged commit 7fa2ba2 into simukappu:main Oct 18, 2026
1 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants