False == 'c' in 'apple'
is not interpreted as
False == ('c' in 'apple')
but,
(False == 'c') and ('c' in apple)
becaue of comparison chaining.
To get what you want, put parentheses explicitly.
False == ('c' in 'apple')
or more preferably use in
/ not in
:
def test_string_membership():
assert 'c' not in 'apple'
assert 'a' in 'apple'
assert 'app' in 'apple'