forked from trekhleb/learn-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_membership.py
More file actions
25 lines (16 loc) · 782 Bytes
/
test_membership.py
File metadata and controls
25 lines (16 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""Membership operators
@see: https://www.w3schools.com/python/python_operators.asp
Membership operators are used to test if a sequence is presented in an object.
"""
def test_membership_operators():
"""Membership operators"""
# Let's use the following fruit list to illustrate membership concept.
fruit_list = ["apple", "banana"]
# in
# Returns True if a sequence with the specified value is present in the object.
# Returns True because a sequence with the value "banana" is in the list
assert "banana" in fruit_list
# not in
# Returns True if a sequence with the specified value is not present in the object
# Returns True because a sequence with the value "pineapple" is not in the list.
assert "pineapple" not in fruit_list