forked from UWPCE-PythonCert/ProgrammingInPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_walnut_party.py
More file actions
63 lines (35 loc) · 1.2 KB
/
Copy pathtest_walnut_party.py
File metadata and controls
63 lines (35 loc) · 1.2 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python
"""
When squirrels get together for a party, they like to have walnuts.
A squirrel party is successful when the number of walnuts is between
40 and 60, inclusive. Unless it is the weekend, in which case there
is no upper bound on the number of walnuts.
Return True if the party with the given values is successful,
or False otherwise.
"""
# you can change this import to test different versions
from walnut_party import walnut_party
# from walnut_party import walnut_party2 as walnut_party
# from walnut_party import walnut_party3 as walnut_party
def test_1():
assert walnut_party(30, False) is False
def test_2():
assert walnut_party(50, False) is True
def test_3():
assert walnut_party(70, True) is True
def test_4():
assert walnut_party(30, True) is False
def test_5():
assert walnut_party(50, True) is True
def test_6():
assert walnut_party(60, False) is True
def test_7():
assert walnut_party(61, False) is False
def test_8():
assert walnut_party(40, False) is True
def test_9():
assert walnut_party(39, False) is False
def test_10():
assert walnut_party(40, True) is True
def test_11():
assert walnut_party(39, True) is False