diff --git a/swap_meet/clothing.py b/swap_meet/clothing.py index b8afdeb1e..62cbf22ee 100644 --- a/swap_meet/clothing.py +++ b/swap_meet/clothing.py @@ -1,2 +1,12 @@ -class Clothing: - pass \ No newline at end of file +from .item import Item + + +class Clothing(Item): + def __init__(self, id = None, age = 0.0, condition = 0.0, fabric = "Unknown"): + super().__init__(id= id, age = age, condition = condition) + self.fabric = fabric + + + def __str__(self): + parent_str = super().__str__() + return (f'{parent_str} It is made from {self.fabric} fabric.') \ No newline at end of file diff --git a/swap_meet/decor.py b/swap_meet/decor.py index eab7a9dbe..f0cae1a4b 100644 --- a/swap_meet/decor.py +++ b/swap_meet/decor.py @@ -1,2 +1,12 @@ -class Decor: - pass \ No newline at end of file +from .item import Item + +class Decor(Item): + def __init__(self, id = None, age = 0.0, condition = 0.0, width = 0, length = 0): + super().__init__(id = id, age = age, condition = condition) + self.width = width + self.length = length + + + def __str__(self): + parent_str = super().__str__() + return (f'{parent_str} It takes up a {self.width} by {self.length} sized space.') \ No newline at end of file diff --git a/swap_meet/electronics.py b/swap_meet/electronics.py index 2f9dff68a..d0059584e 100644 --- a/swap_meet/electronics.py +++ b/swap_meet/electronics.py @@ -1,2 +1,13 @@ -class Electronics: - pass +from .item import Item + +class Electronics(Item): + + def __init__(self, id = None, age = 0.0, condition = 0.0, type = "Unknown"): + super().__init__(id = id, age = age, condition = condition) + self.type = type + + def __str__(self): + parent_str = super().__str__() + return (f'{parent_str} This is a {self.type} device.') + + \ No newline at end of file diff --git a/swap_meet/item.py b/swap_meet/item.py index 560d759c2..527d06675 100644 --- a/swap_meet/item.py +++ b/swap_meet/item.py @@ -1,2 +1,48 @@ +import uuid + class Item: - pass \ No newline at end of file + def __init__(self, age = 0.0 , id = None, condition = 0.0): + if id is None: + self.id = uuid.uuid4().int + else: + self.id = id + self.condition = condition + self.age = age + + def __str__(self): + return f'An object of type {self.__class__.__name__} with id {self.id}.' + + def get_category(self): + return self.__class__.__name__ + + def get_age(self): + return self.age + + def condition_description(self): + if self.condition >= 0.0 and self.condition < 1.0: + return "Should you get this? IT DEPENDS! ʕ •ᴥ• ʔ" + elif self.condition >= 1.0 and self.condition < 2.0: + return "One person's garbage is another's treasure." + elif self.condition >= 2.0 and self.condition < 3.0: + return "If you squint, you can't even tell." + elif self.condition >= 3.0 and self.condition < 4.0: + return "This is a bargan for the price." + elif self.condition >= 4.0 and self.condition < 5.0: + return "This item has been well cared for, but you can tell you're not the first owner." + elif self.condition >= 5.0: + return "This item is immaculate. If you don't buy it, I will!" + + def age_description(self): + if self.age >= 0.0 and self.age < 1.0: + return "I've had this for less than a year!" + elif self.age >= 1.0 and self.age < 2.0: + return "I've had this for a little over a year!" + elif self.age >= 2.0 and self.age < 3.0: + return "I've had this for over two years but not more than three!" + elif self.age >= 3.0 and self.age < 4.0: + return "I've had this for over three years but not more than four!" + elif self.age >= 4.0 and self.age < 5.0: + return "I've had this for over four years but not more than five!" + elif self.age >= 5.0: + return "I've had this for over five years!" + \ No newline at end of file diff --git a/swap_meet/vendor.py b/swap_meet/vendor.py index 87302c056..330250f41 100644 --- a/swap_meet/vendor.py +++ b/swap_meet/vendor.py @@ -1,2 +1,92 @@ +from .item import Item +from .decor import Decor +from .electronics import Electronics +from .clothing import Clothing + class Vendor: - pass \ No newline at end of file + def __init__(self, inventory = None): + self.inventory = [] if inventory is None else inventory + + def add(self, item): + self.inventory.append(item) + return item + + def remove(self, item): + if item not in self.inventory: + return False + else: + self.inventory.remove(item) + return item + + def get_by_id(self, id): + for item in self.inventory: + if item.id == id: + return item + if isinstance(id, Item): + raise ValueError("id should be an int!") + + + def swap_items(self, other_vendor, my_item, their_item): + if not self.inventory or not other_vendor.inventory: + return False + if their_item not in self.inventory and my_item not in other_vendor.inventory: + my_index, their_index = self.inventory.index(my_item), other_vendor.inventory.index(their_item) + self.inventory[my_index], other_vendor.inventory[their_index] = their_item, my_item + return True + return False + + + def swap_first_item(self, other_vendor): + if not self.inventory or not other_vendor.inventory: + return False + self.inventory[0], other_vendor.inventory[0] = (other_vendor.inventory[0], self.inventory[0]) + return True + + def get_by_category(self, category): + matching_items = [] + matching_items = [item for item in self.inventory if item.get_category() == category] + if matching_items: + return matching_items + else: + return [] + + def get_best_by_category(self, category): + items = self.get_by_category(category) + if not items: + return None + return max(items, key=lambda item: item.condition) + + def swap_best_by_category(self, other_vendor, my_priority, their_priority): + my_best_item = self.get_best_by_category(their_priority) + their_best_item = other_vendor.get_best_by_category(my_priority) + if my_best_item and their_best_item: + if self.swap_items(other_vendor, my_best_item, their_best_item): + return True + return False + + def get_by_age(self, age): + matching_items = [] + matching_items = [item for item in self.inventory if item.get_age() == age] + if matching_items: + return matching_items + else: + return None + + def get_best_by_age(self, vendor): + items = vendor.inventory + if not items: + return None + return min(items, key=lambda item: item.age) + + def swap_best_by_age(self, other_vendor): + my_newest_item = self.get_best_by_age(self) + their_newest_item = other_vendor.get_best_by_age(other_vendor) + if my_newest_item and their_newest_item: + if self.swap_items(other_vendor, my_newest_item, their_newest_item): + return True + return False + + + + + diff --git a/tests/integration_tests/test_wave_01_02_03.py b/tests/integration_tests/test_wave_01_02_03.py index 0e521771a..f9528c79a 100644 --- a/tests/integration_tests/test_wave_01_02_03.py +++ b/tests/integration_tests/test_wave_01_02_03.py @@ -2,8 +2,8 @@ from swap_meet.vendor import Vendor from swap_meet.item import Item -@pytest.mark.skip -@pytest.mark.integration_test +# @pytest.mark.skip +# @pytest.mark.integration_test def test_integration_wave_01_02_03(): # make a vendor vendor = Vendor() diff --git a/tests/integration_tests/test_wave_04_05_06.py b/tests/integration_tests/test_wave_04_05_06.py index c5953b7f8..efb2e9380 100644 --- a/tests/integration_tests/test_wave_04_05_06.py +++ b/tests/integration_tests/test_wave_04_05_06.py @@ -4,8 +4,8 @@ from swap_meet.decor import Decor from swap_meet.electronics import Electronics -@pytest.mark.skip -@pytest.mark.integration_test +# @pytest.mark.skip +# @pytest.mark.integration_test def test_integration_wave_04_05_06(): camila = Vendor() valentina = Vendor() diff --git a/tests/unit_tests/test_age_functions.py b/tests/unit_tests/test_age_functions.py new file mode 100644 index 000000000..91e2e4fe0 --- /dev/null +++ b/tests/unit_tests/test_age_functions.py @@ -0,0 +1,110 @@ +import pytest +from swap_meet.item import Item +from swap_meet.vendor import Vendor +from swap_meet.clothing import Clothing +from swap_meet.decor import Decor +from swap_meet.electronics import Electronics + +def test_age_is_assigned_to_item_instances(): + # Act + item_a = Clothing(age=2.0) + item_b = Decor(age=3.0) + item_c = Electronics(age=4.0) + tai = Vendor( + inventory=[item_a, item_b] + ) + + item_a_age, item_b_age, item_c_age = item_a.age, item_b.age, item_c.age + + assert item_a_age == 2.0 + assert item_b_age == 3.0 + assert item_c_age == 4.0 + +def test_get_age_returns_correct_age_value(): + item_a = Clothing(age=2.0) + item_b = Decor(age=3.0) + tai = Vendor( + inventory=[item_a, item_b] + ) + result = item_a.get_age() + + assert result == 2.0 + +def test_get_by_age_returns_items_with_matching_age(): + item_a = Clothing() + item_a.age = 2.0 + item_b = Electronics() + item_b.age = 3.0 + item_c = Decor() + item_c.age = 3.0 + vendor = Vendor( + inventory=[item_a, item_b, item_c] + ) + + + items = vendor.get_by_age(3.0) + + assert item_b in items + assert item_c in items + assert item_a not in items + +def test_get_best_by_age_return_newest_item(): + item_a = Clothing() + item_a.age = 2.0 + item_b = Clothing() + item_b.age = 3.0 + item_c = Clothing() + item_c.age = 4.0 + item_d = Electronics() + item_d.age = 1.0 + vendor = Vendor( + inventory=[item_a, item_b, item_c, item_d] + ) + + result = vendor.get_best_by_age(vendor) + + assert result == item_d + +def test_swap_best_by_age_returns_True(): + item_a = Clothing() + item_a.age = 2.0 + item_b = Clothing() + item_b.age = 3.0 + item_c = Clothing() + item_c.age = 4.0 + vendor = Vendor( + inventory=[item_a, item_b, item_c] + ) + item_d = Clothing() + item_d.age = 4.0 + item_e = Clothing() + item_e.age = 3.0 + item_f = Clothing() + item_f.age = 2.0 + james = Vendor( + inventory=[item_d, item_e, item_f] + ) + result = vendor.swap_best_by_age(james) + + assert result + assert item_a in james.inventory + assert item_f in vendor.inventory + +def test_items_have_age_descriptions_that_are_the_same_regardless_of_type(): + items = [ + Clothing(age=5), + Decor(age=5), + Electronics(age=5) + ] + five_age_description = items[0].age_description() + assert isinstance(five_age_description, str) + for item in items: + assert item.age_description() == five_age_description + items[0].age = 1 + one_age_description = items[0].age_description() + assert isinstance(one_age_description, str) + for item in items: + item.age = 1 + assert item.age_description() == one_age_description + + assert one_age_description != five_age_description diff --git a/tests/unit_tests/test_wave_01.py b/tests/unit_tests/test_wave_01.py index 58478ccf9..fa8d81472 100644 --- a/tests/unit_tests/test_wave_01.py +++ b/tests/unit_tests/test_wave_01.py @@ -2,12 +2,12 @@ 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) @@ -16,7 +16,7 @@ def test_vendor_takes_optional_inventory(): assert "b" in vendor.inventory assert "c" in vendor.inventory -@pytest.mark.skip + def test_adding_to_inventory(): vendor = Vendor() item = "new item" @@ -27,7 +27,7 @@ def test_adding_to_inventory(): assert item in vendor.inventory assert result == item -@pytest.mark.skip + def test_removing_from_inventory_returns_item(): item = "item to remove" vendor = Vendor( @@ -40,7 +40,7 @@ def test_removing_from_inventory_returns_item(): 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( @@ -49,7 +49,4 @@ def test_removing_not_found_is_false(): result = vendor.remove(item) - raise Exception("Complete this test according to comments below.") - # ********************************************************************* - # ****** Complete Assert Portion of this test ********** - # ********************************************************************* + assert result == False \ No newline at end of file diff --git a/tests/unit_tests/test_wave_02.py b/tests/unit_tests/test_wave_02.py index 229165c75..c683f6b62 100644 --- a/tests/unit_tests/test_wave_02.py +++ b/tests/unit_tests/test_wave_02.py @@ -2,30 +2,30 @@ from swap_meet.vendor import Vendor from swap_meet.item import Item -@pytest.mark.skip +# @pytest.mark.skip def test_items_have_default_uuid_length_id(): item = Item() assert isinstance(item.id, int) assert len(str(item.id)) >= 32 -@pytest.mark.skip +# @pytest.mark.skip def test_item_instances_have_different_default_ids(): item_a = Item() item_b = Item() assert item_a.id != item_b.id -@pytest.mark.skip +# @pytest.mark.skip def test_items_use_custom_id_if_passed(): item = Item(id=12345) assert isinstance(item.id, int) assert item.id == 12345 -@pytest.mark.skip +# @pytest.mark.skip def test_item_obj_returns_text_item_for_category(): item = Item() assert item.get_category() == "Item" -@pytest.mark.skip +# @pytest.mark.skip def test_get_item_by_id(): test_id = 12345 item_custom_id = Item(id=test_id) @@ -36,7 +36,7 @@ def test_get_item_by_id(): result_item = vendor.get_by_id(test_id) assert result_item is item_custom_id -@pytest.mark.skip +# @pytest.mark.skip def test_get_item_by_id_no_matching(): test_id = 12345 item_a = Item() diff --git a/tests/unit_tests/test_wave_03.py b/tests/unit_tests/test_wave_03.py index c85da6797..19571e628 100644 --- a/tests/unit_tests/test_wave_03.py +++ b/tests/unit_tests/test_wave_03.py @@ -2,7 +2,7 @@ from swap_meet.vendor import Vendor from swap_meet.item import Item -@pytest.mark.skip +# @pytest.mark.skip def test_item_overrides_to_string(): test_id = 12345 item = Item(id=test_id) @@ -12,7 +12,7 @@ def test_item_overrides_to_string(): expected_result = f"An object of type Item with id {test_id}." assert item_as_string == expected_result -@pytest.mark.skip +# @pytest.mark.skip def test_swap_items_returns_true(): item_a = Item() item_b = Item() @@ -40,7 +40,7 @@ def test_swap_items_returns_true(): assert item_b in jolie.inventory assert result -@pytest.mark.skip +# @pytest.mark.skip def test_swap_items_when_my_item_is_missing_returns_false(): item_a = Item() item_b = Item() @@ -67,7 +67,7 @@ def test_swap_items_when_my_item_is_missing_returns_false(): assert item_e in jolie.inventory assert not result -@pytest.mark.skip +# @pytest.mark.skip def test_swap_items_when_their_item_is_missing_returns_false(): item_a = Item() item_b = Item() @@ -94,7 +94,7 @@ def test_swap_items_when_their_item_is_missing_returns_false(): assert item_e in jolie.inventory assert not result -@pytest.mark.skip +# @pytest.mark.skip def test_swap_items_from_my_empty_returns_false(): fatimah = Vendor( inventory=[] @@ -114,7 +114,7 @@ def test_swap_items_from_my_empty_returns_false(): assert len(jolie.inventory) == 2 assert not result -@pytest.mark.skip +# @pytest.mark.skip def test_swap_items_from_their_empty_returns_false(): item_a = Item() item_b = Item() @@ -131,7 +131,6 @@ def test_swap_items_from_their_empty_returns_false(): result = fatimah.swap_items(jolie, item_b, nobodys_item) - raise Exception("Complete this test according to comments below.") - # ********************************************************************* - # ****** Complete Assert Portion of this test ********** - # ********************************************************************* + assert len(fatimah.inventory) == 3 + assert len(jolie.inventory) == 0 + assert not result diff --git a/tests/unit_tests/test_wave_04.py b/tests/unit_tests/test_wave_04.py index 87addbbf6..135388335 100644 --- a/tests/unit_tests/test_wave_04.py +++ b/tests/unit_tests/test_wave_04.py @@ -2,7 +2,7 @@ from swap_meet.vendor import Vendor from swap_meet.item import Item -@pytest.mark.skip +# @pytest.mark.skip def test_swap_first_item_returns_true(): item_a = Item() item_b = Item() @@ -30,7 +30,7 @@ def test_swap_first_item_returns_true(): assert item_a in jolie.inventory assert result -@pytest.mark.skip +# @pytest.mark.skip def test_swap_first_item_from_my_empty_returns_false(): fatimah = Vendor( inventory=[] @@ -48,7 +48,7 @@ def test_swap_first_item_from_my_empty_returns_false(): assert len(jolie.inventory) == 2 assert not result -@pytest.mark.skip +# @pytest.mark.skip def test_swap_first_item_from_their_empty_returns_false(): item_a = Item() item_b = Item() diff --git a/tests/unit_tests/test_wave_05.py b/tests/unit_tests/test_wave_05.py index 46e208237..b7f451e1a 100644 --- a/tests/unit_tests/test_wave_05.py +++ b/tests/unit_tests/test_wave_05.py @@ -7,17 +7,17 @@ # ~~~~~ Clothing Tests ~~~~~ -@pytest.mark.skip +# @pytest.mark.skip def test_clothing_has_default_uuid_length_id(): clothing = Clothing() check_for_default_uuid_length_id(clothing) -@pytest.mark.skip +# @pytest.mark.skip def test_clothing_has_expected_category_and_custom_id(): clothing = Clothing(id=TEST_CUSTOM_ID) check_category_and_custom_id(clothing, TEST_CUSTOM_ID, "Clothing") -@pytest.mark.skip +# @pytest.mark.skip def test_clothing_has_expected_default_to_str(): clothing = Clothing(id=TEST_CUSTOM_ID) expected_str = ( @@ -26,7 +26,7 @@ def test_clothing_has_expected_default_to_str(): ) assert str(clothing) == expected_str -@pytest.mark.skip +# @pytest.mark.skip def test_clothing_has_expected_to_str_with_custom_fabric(): clothing = Clothing(id=TEST_CUSTOM_ID, fabric="Pinstriped") expected_str = ( @@ -37,17 +37,17 @@ def test_clothing_has_expected_to_str_with_custom_fabric(): # ~~~~~ Decor Tests ~~~~~ -@pytest.mark.skip +# @pytest.mark.skip def test_decor_has_default_uuid_length_id(): decor = Decor() check_for_default_uuid_length_id(decor) -@pytest.mark.skip +# @pytest.mark.skip def test_decor_has_expected_category_and_custom_id(): decor = Decor(id=TEST_CUSTOM_ID) check_category_and_custom_id(decor, TEST_CUSTOM_ID, "Decor") -@pytest.mark.skip +# @pytest.mark.skip def test_decor_has_expected_default_to_str(): decor = Decor(id=TEST_CUSTOM_ID) expected_str = ( @@ -56,7 +56,7 @@ def test_decor_has_expected_default_to_str(): ) assert str(decor) == expected_str -@pytest.mark.skip +# @pytest.mark.skip def test_decor_has_expected_to_str_with_custom_size(): decor = Decor(id=TEST_CUSTOM_ID, width=3, length=12) expected_str = ( @@ -67,17 +67,17 @@ def test_decor_has_expected_to_str_with_custom_size(): # ~~~~~ Electronics Tests ~~~~~ -@pytest.mark.skip +# @pytest.mark.skip def test_electronics_has_default_uuid_length_id(): electronics = Electronics() check_for_default_uuid_length_id(electronics) -@pytest.mark.skip +# @pytest.mark.skip def test_electronics_has_expected_category_and_custom_id(): electronics = Electronics(id=TEST_CUSTOM_ID) check_category_and_custom_id(electronics, TEST_CUSTOM_ID, "Electronics") -@pytest.mark.skip +# @pytest.mark.skip def test_electronics_has_expected_default_to_str(): electronics = Electronics(id=TEST_CUSTOM_ID) expected_str = ( @@ -86,7 +86,7 @@ def test_electronics_has_expected_default_to_str(): ) assert str(electronics) == expected_str -@pytest.mark.skip +# @pytest.mark.skip def test_electronics_has_expected_to_str_with_custom_type(): electronics = Electronics(id=TEST_CUSTOM_ID, type="Mobile Phone") expected_str = ( @@ -98,7 +98,7 @@ def test_electronics_has_expected_to_str_with_custom_type(): # ~~~~~ Item Tests ~~~~~ -@pytest.mark.skip +# @pytest.mark.skip def test_items_have_condition_as_float(): items = [ Clothing(condition=3.5), @@ -108,7 +108,7 @@ def test_items_have_condition_as_float(): for item in items: assert item.condition == pytest.approx(3.5) -@pytest.mark.skip +# @pytest.mark.skip def test_items_have_condition_descriptions_that_are_the_same_regardless_of_type(): items = [ Clothing(condition=5), diff --git a/tests/unit_tests/test_wave_06.py b/tests/unit_tests/test_wave_06.py index ad51bf42d..a853eed52 100644 --- a/tests/unit_tests/test_wave_06.py +++ b/tests/unit_tests/test_wave_06.py @@ -5,7 +5,7 @@ from swap_meet.decor import Decor from swap_meet.electronics import Electronics -@pytest.mark.skip +# @pytest.mark.skip def test_get_items_by_category(): item_a = Clothing() item_b = Electronics() @@ -22,7 +22,7 @@ def test_get_items_by_category(): assert item_a in items assert item_c in items -@pytest.mark.skip +# @pytest.mark.skip def test_get_no_matching_items_by_category(): item_a = Clothing() item_b = Item() @@ -33,12 +33,9 @@ def test_get_no_matching_items_by_category(): items = vendor.get_by_category("Electronics") - raise Exception("Complete this test according to comments below.") - # ********************************************************************* - # ****** Complete Assert Portion of this test ********** - # ********************************************************************* + assert not items -@pytest.mark.skip +# @pytest.mark.skip def test_best_by_category(): item_a = Clothing(condition=2.0) item_b = Decor(condition=2.0) @@ -54,7 +51,7 @@ def test_best_by_category(): assert best_item.get_category() == "Clothing" assert best_item.condition == pytest.approx(4.0) -@pytest.mark.skip +# @pytest.mark.skip def test_best_by_category_no_matches_is_none(): item_a = Decor(condition=2.0) item_b = Decor(condition=2.0) @@ -67,7 +64,7 @@ def test_best_by_category_no_matches_is_none(): assert best_item is None -@pytest.mark.skip +# @pytest.mark.skip def test_best_by_category_with_duplicates(): # Arrange item_a = Clothing(condition=2.0) @@ -84,7 +81,7 @@ def test_best_by_category_with_duplicates(): assert best_item.get_category() == "Clothing" assert best_item.condition == pytest.approx(4.0) -@pytest.mark.skip +# @pytest.mark.skip def test_swap_best_by_category(): # Arrange # me @@ -110,7 +107,6 @@ def test_swap_best_by_category(): their_priority="Decor" ) - raise Exception("Complete this test according to comments below.") # ********************************************************************* # ****** Complete Assert Portion of this test ********** # ********************************************************************* @@ -118,8 +114,12 @@ def test_swap_best_by_category(): # - That the results is truthy # - That tai and jesse's inventories are the correct length # - That all the correct items are in tai and jesse's inventories, including the items which were swapped from one vendor to the other + assert result + assert len(tai.inventory) == 3 + assert len(jesse.inventory) == 3 + -@pytest.mark.skip +# @pytest.mark.skip def test_swap_best_by_category_reordered(): # Arrange item_a = Decor(condition=2.0) @@ -143,7 +143,7 @@ def test_swap_best_by_category_reordered(): their_priority="Decor" ) - raise Exception("Complete this test according to comments below.") + # ********************************************************************* # ****** Complete Assert Portion of this test ********** # ********************************************************************* @@ -151,8 +151,14 @@ def test_swap_best_by_category_reordered(): # - That result is truthy # - That tai and jesse's inventories are the correct length # - That all the correct items are in tai and jesse's inventories, and that the items that were swapped are not there + assert result + assert len(tai.inventory) == 3 + assert len(jesse.inventory) == 3 + assert item_f in tai.inventory + assert item_c in jesse.inventory + -@pytest.mark.skip +# @pytest.mark.skip def test_swap_best_by_category_no_inventory_is_false(): tai = Vendor( inventory=[] @@ -178,7 +184,7 @@ def test_swap_best_by_category_no_inventory_is_false(): assert item_b in jesse.inventory assert item_c in jesse.inventory -@pytest.mark.skip +# @pytest.mark.skip def test_swap_best_by_category_no_other_inventory_is_false(): item_a = Clothing(condition=2.0) item_b = Decor(condition=4.0) @@ -204,7 +210,7 @@ def test_swap_best_by_category_no_other_inventory_is_false(): assert item_b in tai.inventory assert item_c in tai.inventory -@pytest.mark.skip +# @pytest.mark.skip def test_swap_best_by_category_no_match_is_false(): # Arrange item_a = Decor(condition=2.0) @@ -228,7 +234,6 @@ def test_swap_best_by_category_no_match_is_false(): their_priority="Clothing" ) - raise Exception("Complete this test according to comments below.") # ********************************************************************* # ****** Complete Assert Portion of this test ********** # ********************************************************************* @@ -236,8 +241,18 @@ def test_swap_best_by_category_no_match_is_false(): # - That result is falsy # - That tai and jesse's inventories are the correct length # - That all the correct items are in tai and jesse's inventories + assert not result + assert len(tai.inventory) == 3 + assert len(jesse.inventory) == 3 + assert item_d in jesse.inventory + assert item_e in jesse.inventory + assert item_f in jesse.inventory + assert item_a in tai.inventory + assert item_b in tai.inventory + assert item_c in tai.inventory -@pytest.mark.skip + +# @pytest.mark.skip def test_swap_best_by_category_no_other_match_is_false(): # Arrange item_a = Decor(condition=2.0) @@ -261,7 +276,6 @@ def test_swap_best_by_category_no_other_match_is_false(): their_priority="Decor" ) - raise Exception("Complete this test according to comments below.") # ********************************************************************* # ****** Complete Assert Portion of this test ********** # ********************************************************************* @@ -269,3 +283,14 @@ def test_swap_best_by_category_no_other_match_is_false(): # - That result is falsy # - That tai and jesse's inventories are the correct length # - That all the correct items are in tai and jesse's inventories + assert not result + assert len(tai.inventory) == 3 + assert len(jesse.inventory) == 3 + assert item_d in jesse.inventory + assert item_e in jesse.inventory + assert item_f in jesse.inventory + assert item_a in tai.inventory + assert item_b in tai.inventory + assert item_c in tai.inventory + +