-
Notifications
You must be signed in to change notification settings - Fork 637
Expand file tree
/
Copy pathtest_wave_01.py
More file actions
58 lines (47 loc) · 1.61 KB
/
test_wave_01.py
File metadata and controls
58 lines (47 loc) · 1.61 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
# The following line imports the Vendor class from the module vendor inside the swap_meet package.
import pytest
from swap_meet.vendor import Vendor
# @pytest.mark.skip
def test_vendor_has_inventory():
vendor = Vendor()
assert len(vendor.inventory) == 0
# @pytest.mark.skip
def test_vendor_takes_optional_inventory():
inventory = ["a", "b", "c"]
vendor = Vendor(inventory=inventory)
assert len(vendor.inventory) == 3
assert "a" in vendor.inventory
assert "b" in vendor.inventory
assert "c" in vendor.inventory
# @pytest.mark.skip
def test_adding_to_inventory():
vendor = Vendor()
item = "new item"
result = vendor.add(item)
assert len(vendor.inventory) == 1
assert item in vendor.inventory
assert result == item
# @pytest.mark.skip
def test_removing_from_inventory_returns_item():
item = "item to remove"
vendor = Vendor(
inventory=["a", "b", "c", item]
)
result = vendor.remove(item)
assert len(vendor.inventory) == 3
assert item not in vendor.inventory
assert result == item
# @pytest.mark.skip
def test_removing_not_found_is_false():
item = "item to remove"
vendor = Vendor(
inventory=["a", "b", "c"]
)
result = vendor.remove(item)
# raise Exception("Complete this test according to comments below.")
# *********************************************************************
# ****** Complete Assert Portion of this test **********
assert len(vendor.inventory) == 3
assert item not in vendor.inventory
assert result == False
# *********************************************************************