forked from australiaitgroup/learn-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_comparison.py
More file actions
47 lines (35 loc) · 833 Bytes
/
Copy pathtest_comparison.py
File metadata and controls
47 lines (35 loc) · 833 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""Comparison operators
比较运算符 (Comparison Operators)
@see: https://www.w3schools.com/python/python_operators.asp
Comparison operators are used to compare two values.
比较运算符用于比较两个值。
"""
def test_comparison_operators():
"""Comparison operators"""
# 比较运算符
# Equal.
# 等于。
number = 5
assert number == 5
# Not equal.
# 不等于。
number = 5
assert number != 3
# Greater than.
# 大于。
number = 5
assert number > 3
# Less than.
# 小于。
number = 5
assert number < 8
# Greater than or equal to
# 大于或等于。
number = 5
assert number >= 5
assert number >= 4
# Less than or equal to
# 小于或等于。
number = 5
assert number <= 5
assert number <= 6