Skip to content

Behavior of contains_sequence with strings? #108

Description

@martinfrancois

The documentation really explains nicely how contains_sequence is supposed to behave with characters, strings with characters, but not strings with strings.

For example (expected):

# I would expect this to pass (needle and haystack appear as substrings in order)
assert_that("The needle is always in the haystack.").contains_sequence("needle", "haystack")

# I would expect this to fail (needle appears BEFORE haystack)
assert_that("The needle is always in the haystack.").contains_sequence("haystack", "needle")

Actual:

AssertionError: Expected <The needle is always in the haystack.> to contain sequence <'needle', 'haystack'>, but did not.

AssertionError: Expected <The needle is always in the haystack.> to contain sequence <'haystack', 'needle'>, but did not.

Now I'm not sure if I didn't understand it correctly or if this is a bug. Either way, it would be great to add some examples where there are two string sequences in the documentation.

No activity

Activity on this issue will appear here.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions