# StrSubject {.starlark-object} ## StrSubject.contains {.starlark-signature} StrSubject.contains([substr](#strsubject_contains_substr)) Assert that the subject contains the substring `substr`. Method: StrSubject.contains {#strsubject_contains_parameters} **PARAMETERS** [¶](#strsubject_contains_parameters){.headerlink} :[substr[¶](#strsubject_contains_substr){.headerlink}]{.span}: []{#strsubject_contains_substr} ([`str`]) the substring to check for. {.starlark-object} ## StrSubject.ends_with {.starlark-signature} StrSubject.ends_with([substr](#strsubject_ends_with_substr)) Assert that the subject starts with the substring `substr`. Method: StrSubject.ends_with {#strsubject_ends_with_parameters} **PARAMETERS** [¶](#strsubject_ends_with_parameters){.headerlink} :[substr[¶](#strsubject_ends_with_substr){.headerlink}]{.span}: []{#strsubject_ends_with_substr} ([`str`]) the substring to check for. {.starlark-object} ## StrSubject.equals {.starlark-signature} StrSubject.equals([other](#strsubject_equals_other)) Assert that the subject string equals the other string. Method: StrSubject.equals {#strsubject_equals_parameters} **PARAMETERS** [¶](#strsubject_equals_parameters){.headerlink} :[other[¶](#strsubject_equals_other){.headerlink}]{.span}: []{#strsubject_equals_other} ([`str`]) the expected value it should equal. {.starlark-object} ## StrSubject.matches {.starlark-signature} StrSubject.matches([matcher](#strsubject_matches_matcher)) Assert that the subject matches the predicate `matcher`. Method: StrSubject.matches {#strsubject_matches_parameters} **PARAMETERS** [¶](#strsubject_matches_parameters){.headerlink} :[matcher[¶](#strsubject_matches_matcher){.headerlink}]{.span}: []{#strsubject_matches_matcher} ([`Matcher`]) (see `matchers` struct). {.starlark-object} ## StrSubject.new {.starlark-signature} StrSubject.new([actual](#strsubject_new_actual), [meta](#strsubject_new_meta)) Creates a subject for asserting strings. Method: StrSubject.new {#strsubject_new_parameters} **PARAMETERS** [¶](#strsubject_new_parameters){.headerlink} {.params-box} :[actual[¶](#strsubject_new_actual){.headerlink}]{.span}: []{#strsubject_new_actual} ([`str`]) the string to check against. :[meta[¶](#strsubject_new_meta){.headerlink}]{.span}: []{#strsubject_new_meta} ([`ExpectMeta`]) of call chain information. {#strsubject_new_returns} RETURNS [¶](#strsubject_new_returns){.headerlink} : [`StrSubject`] object. {.starlark-object} ## StrSubject.not_contains {.starlark-signature} StrSubject.not_contains([substr](#strsubject_not_contains_substr)) Assert that the subject does not contain the substring `substr`. Method: StrSubject.not_contains {#strsubject_not_contains_parameters} **PARAMETERS** [¶](#strsubject_not_contains_parameters){.headerlink} :[substr[¶](#strsubject_not_contains_substr){.headerlink}]{.span}: []{#strsubject_not_contains_substr} ([`str`]) the substring to check for. {.starlark-object} ## StrSubject.not_equals {.starlark-signature} StrSubject.not_equals([unexpected](#strsubject_not_equals_unexpected)) Assert that the string is not equal to `unexpected`. Method: BoolSubject.not_equals {#strsubject_not_equals_parameters} **PARAMETERS** [¶](#strsubject_not_equals_parameters){.headerlink} :[unexpected[¶](#strsubject_not_equals_unexpected){.headerlink}]{.span}: []{#strsubject_not_equals_unexpected} ([`str`]) the value actual cannot equal. {.starlark-object} ## StrSubject.split {.starlark-signature} StrSubject.split([sep](#strsubject_split_sep)) Return a `CollectionSubject` for the actual string split by `sep`. Method: StrSubject.split {#strsubject_split_parameters} **PARAMETERS** [¶](#strsubject_split_parameters){.headerlink} :[sep[¶](#strsubject_split_sep){.headerlink}]{.span}: []{#strsubject_split_sep} _undocumented_ {.starlark-object} ## StrSubject.starts_with {.starlark-signature} StrSubject.starts_with([substr](#strsubject_starts_with_substr)) Assert that the subject starts with the substring `substr`. Method: StrSubject.starts_with {#strsubject_starts_with_parameters} **PARAMETERS** [¶](#strsubject_starts_with_parameters){.headerlink} :[substr[¶](#strsubject_starts_with_substr){.headerlink}]{.span}: []{#strsubject_starts_with_substr} ([`str`]) the substring to check for. [`Action`]: https://bazel.build/rules/lib/Action [`ActionSubject`]: /api/action_subject [`bool`]: https://bazel.build/rules/lib/bool [`BoolSubject`]: /api/bool_subject [`CollectionSubject`]: /api/collection_subject [`depset`]: https://bazel.build/rules/lib/depset [`DepsetFileSubject`]: /api/depset_file_subject [`dict`]: https://bazel.build/rules/lib/dict [`DictSubject`]: /api/dict_subject [`Expect`]: /api/expect [`ExpectMeta`]: /api/expect_meta [`File`]: https://bazel.build/rules/lib/File [`FileSubject`]: /api/file_subject [`format_str`]: /api/expect_meta.html#expectmeta-format-str [`IntSubject`]: /api/int_subject [`Label`]: https://bazel.build/rules/lib/Label [`LabelSubject`]: /api/label_subject [`list`]: https://bazel.build/rules/lib/list [`Ordered`]: /api/ordered [`RunfilesSubject`]: /api/runfiles_subject [`str`]: https://bazel.build/rules/lib/string [`struct`]: https://bazel.build/rules/lib/builtins/struct [`StrSubject`]: /api/str_subject [`StructSubject`]: /api/struct_subject [`Target`]: https://bazel.build/rules/lib/Target [`TargetSubject`]: /api/target_subject [target-name]: https://bazel.build/concepts/labels#target-names [attr-label]: https://bazel.build/concepts/labels