From 2c962edea5099c929124272a32e19a0fd243929c Mon Sep 17 00:00:00 2001 From: Alli-Oops Date: Thu, 1 Apr 2021 11:45:41 -0700 Subject: [PATCH 1/8] created Vendor class, constructor, 2 methods called add/remove that interact with items. Also made notes in test_wave_01.py - passed all test in wave 1. --- swap_meet/vendor.py | 24 ++++++++++++++++++++++++ tests/test_wave_01.py | 11 ++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 swap_meet/vendor.py diff --git a/swap_meet/vendor.py b/swap_meet/vendor.py new file mode 100644 index 000000000..c22a13fec --- /dev/null +++ b/swap_meet/vendor.py @@ -0,0 +1,24 @@ +class Vendor: + def __init__(self, inventory = None): + # you can't make an argument/parameter of a mutable data type + # In python, if the inventory is set to an empty list + # one instance update ...will change all the instances - + if inventory == None: + self.inventory = [] + else: + self.inventory = inventory + + def add(self, item): + self.inventory.append(item) + return item + + def remove(self, item): + if self.inventory == []: + return None + elif item not in self.inventory: + return False + else: + for remove_item in self.inventory: + if item == remove_item: + self.inventory.remove(remove_item) + return remove_item diff --git a/tests/test_wave_01.py b/tests/test_wave_01.py index 3af8d0eef..8ccbcc0df 100644 --- a/tests/test_wave_01.py +++ b/tests/test_wave_01.py @@ -2,12 +2,13 @@ # The following line imports the Vendor class from the module vendor inside the swap_meet package. from swap_meet.vendor import Vendor - +#### WAVE 1### +### test 1.1 PASSED ### def test_vendor_has_inventory(): vendor = Vendor() assert len(vendor.inventory) is 0 - +### test 1.2 PASSED ### def test_vendor_takes_optional_inventory(): inventory = ["a", "b", "c"] vendor = Vendor(inventory=inventory) @@ -16,7 +17,7 @@ def test_vendor_takes_optional_inventory(): assert "b" in inventory assert "c" in inventory - +### test 1.3 PASSED ### def test_adding_to_inventory(): vendor = Vendor() item = "new item" @@ -27,7 +28,7 @@ def test_adding_to_inventory(): assert item in vendor.inventory assert result is item - +### test 1.4 PASSED ### def test_removing_from_inventory_returns_item(): item = "item to remove" vendor = Vendor( @@ -40,7 +41,7 @@ def test_removing_from_inventory_returns_item(): assert item not in vendor.inventory assert result is item - +### test 1.5 PASSED ### def test_removing_not_found_is_false(): item = "item to remove" vendor = Vendor( From 01af45fe15ff7dfbd2635ea30d012d96752534d4 Mon Sep 17 00:00:00 2001 From: Alli-Oops Date: Sat, 3 Apr 2021 16:37:59 -0700 Subject: [PATCH 2/8] Created item.py- class Item w attribute str -category. New- vendor.py method, get_by_category() takes a str -category. loops, grabs matches in inventory with item.category. returns list. Passed Wave 2. --- swap_meet/item.py | 12 ++++++++++++ swap_meet/vendor.py | 29 +++++++++++++++++++++++++---- tests/test_wave_02.py | 7 ++++--- 3 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 swap_meet/item.py diff --git a/swap_meet/item.py b/swap_meet/item.py new file mode 100644 index 000000000..c64e27536 --- /dev/null +++ b/swap_meet/item.py @@ -0,0 +1,12 @@ +############### TEST WAVE 2 (3 tests) ############### +# from vendor.swap_meet import Vendor?? +# the instances/obects of the Item class will be components of the Vendor class' instance - vendor objects "have many" item objects + +### test 2.1 PASSED ### +class Item: + def __init__(self, category = None): + if category == None: + self.category = "" + else: + self.category = category +# setting the default argument to an empty string makes it optional to pass in a string with a keyword argument category diff --git a/swap_meet/vendor.py b/swap_meet/vendor.py index c22a13fec..49810f26c 100644 --- a/swap_meet/vendor.py +++ b/swap_meet/vendor.py @@ -1,13 +1,17 @@ +############### TEST WAVE 1 (5 tests) PASSED ############### +############### TEST WAVE 2 (3 tests) PASSED ############### +# from item.swap_meet import Item - why is this not needed? + class Vendor: - def __init__(self, inventory = None): + def __init__(self, inventory = None): #get_by_category, # you can't make an argument/parameter of a mutable data type - # In python, if the inventory is set to an empty list - # one instance update ...will change all the instances - + # In python, if the inventory default is set to an empty list as the paramenter - then one instance update ...will change all the instances - if inventory == None: self.inventory = [] else: self.inventory = inventory - + # self.get_by_category = get_by_category() -- this is a Vendor method and does not need to be an attribute. + def add(self, item): self.inventory.append(item) return item @@ -22,3 +26,20 @@ def remove(self, item): if item == remove_item: self.inventory.remove(remove_item) return remove_item + +### test 2.2 PASSED ### +### test 2.3 PASSED ### + def get_by_category(self, category): + items_by_category_list = [] + for item in self.inventory: + if category == item.category: # syntax that refers to an item object by its category "str" + items_by_category_list.append(item) + return items_by_category_list + +# tests 2.2 and 2.3 are looking at ^ this Vendor class method +# get_by_category() is a Vendor class method. +# ^^^It works with the many item-instances that belong to the Vendor-instance's inventory. +# tests 2.2 +# ^^^returns a list of item-instances that belong to the category passed in. +# tests 2.3 +#^^^returns an empty list if no item-instances belong to the category passed in. \ No newline at end of file diff --git a/tests/test_wave_02.py b/tests/test_wave_02.py index f65f72c37..fd8e00a08 100644 --- a/tests/test_wave_02.py +++ b/tests/test_wave_02.py @@ -2,12 +2,13 @@ from swap_meet.vendor import Vendor from swap_meet.item import Item - +#### WAVE 2### +### test 2.1 PASSED ### def test_items_have_blank_default_category(): item = Item() assert item.category == "" - +### test 2.2 PASSED ### def test_get_items_by_category(): item_a = Item(category="clothing") item_b = Item(category="electronics") @@ -23,7 +24,7 @@ def test_get_items_by_category(): assert item_c in items assert item_b not in items - +### test 2.3 PASSED ### def test_get_no_matching_items_by_category(): item_a = Item(category="clothing") item_b = Item(category="clothing") From b8dc46df92b813b7af1cd988d317d9351f73b11a Mon Sep 17 00:00:00 2001 From: Alli-Oops Date: Sat, 3 Apr 2021 22:42:25 -0700 Subject: [PATCH 3/8] added swap_items() method to vendor.py. Swaps items between two vendor objects. added strigify method to item.py that returns Hello World! Passed Wave 3 --- swap_meet/item.py | 8 ++++++++ swap_meet/vendor.py | 18 +++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/swap_meet/item.py b/swap_meet/item.py index c64e27536..f4d35bd69 100644 --- a/swap_meet/item.py +++ b/swap_meet/item.py @@ -10,3 +10,11 @@ def __init__(self, category = None): else: self.category = category # setting the default argument to an empty string makes it optional to pass in a string with a keyword argument category + +### test 3.1 PASSED ### +# override_to_string / stringify + def __str__(self): + return "Hello World!" # use str() to call this method and convert item to the str "Hello World" + # could also return "items category: {self.category}.format(self=self) + +# this function should turn an item instance into the string "Hello world" \ No newline at end of file diff --git a/swap_meet/vendor.py b/swap_meet/vendor.py index 49810f26c..ac8793f89 100644 --- a/swap_meet/vendor.py +++ b/swap_meet/vendor.py @@ -42,4 +42,20 @@ def get_by_category(self, category): # tests 2.2 # ^^^returns a list of item-instances that belong to the category passed in. # tests 2.3 -#^^^returns an empty list if no item-instances belong to the category passed in. \ No newline at end of file +#^^^returns an empty list if no item-instances belong to the category passed in. + +### test 3.2 PASSED ### +### test 3.3 PASSED ### +### test 3.4 PASSED ### +### test 3.5 PASSED ### +### test 3.6 PASSED ### + def swap_items(self, friendor, my_item, their_item): + if my_item not in self.inventory or their_item not in friendor.inventory: + return False + else: + self.inventory.remove(my_item) + friendor.inventory.append(my_item) + friendor.inventory.remove(their_item) + self.inventory.append(their_item) + return True + From 0ec21ff906f485f80ad39673bf00c13704a44145 Mon Sep 17 00:00:00 2001 From: Alli-Oops Date: Sat, 3 Apr 2021 23:31:14 -0700 Subject: [PATCH 4/8] added swap_first_item() method to vendor.py. Passed Wave 4. --- swap_meet/vendor.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/swap_meet/vendor.py b/swap_meet/vendor.py index ac8793f89..138afc408 100644 --- a/swap_meet/vendor.py +++ b/swap_meet/vendor.py @@ -1,5 +1,6 @@ ############### TEST WAVE 1 (5 tests) PASSED ############### ############### TEST WAVE 2 (3 tests) PASSED ############### +############### TEST WAVE 4 (3 tests) PASSED ############### # from item.swap_meet import Item - why is this not needed? class Vendor: @@ -59,3 +60,16 @@ def swap_items(self, friendor, my_item, their_item): self.inventory.append(their_item) return True + ### test 4.1 PASSED ### + ### test 4.2 PASSED ### + ### test 4.3 PASSED ### + def swap_first_item(self, friendor): + if self.inventory == [] or friendor.inventory == []: + return False + else: + print("something else") + friendor.inventory.append(self.inventory[0]) + self.inventory.remove(self.inventory[0]) + self.inventory.append(friendor.inventory[0]) + friendor.inventory.remove(friendor.inventory[0]) + return True From 580cb084c96bedc412813a614767ffe79f07684b Mon Sep 17 00:00:00 2001 From: Alli-Oops Date: Sun, 4 Apr 2021 13:53:30 -0700 Subject: [PATCH 5/8] passed tests 5.1 through 5.4. Getting my computer repaired and will update as soon as I can get back to work --- swap_meet/clothing.py | 28 +++++++++++++++++++++++++++ swap_meet/decor.py | 18 +++++++++++++++++ swap_meet/electronics.py | 18 +++++++++++++++++ swap_meet/item.py | 42 +++++++++++++++++++++++++++++++++------- swap_meet/vendor.py | 16 ++++++--------- 5 files changed, 105 insertions(+), 17 deletions(-) create mode 100644 swap_meet/clothing.py create mode 100644 swap_meet/decor.py create mode 100644 swap_meet/electronics.py diff --git a/swap_meet/clothing.py b/swap_meet/clothing.py new file mode 100644 index 000000000..64777d351 --- /dev/null +++ b/swap_meet/clothing.py @@ -0,0 +1,28 @@ +############### TEST WAVE 5 (5 tests) ############### +from .item import Item + +### test 5.1 PASSED ### +# Has an attribute category that is "Clothing" +# these subclasses are teaching me about the default-arguments/optional +# in this subclass - the argument "category" is "Clothing" - it is constant and not variable +# Clothing is a special type of item where the category is always "Clothing" +# Need to look out for when to make attributes default/optional/variable OR constant + +class Clothing(Item): + def __init__(self, condition = 0): + super().__init__("Clothing", condition) + + def __str__(self): + return "The finest clothing you could wear." +#stringify method returns "The finest clothing you could wear." + + def clothing_condition_description(self, condition): + super().condition_description() + +# All 3 classes and Item class have an attribute called condition, which can be default = 0 - rendering it optional in the initializer +# All 3 classes and Item class have an instance method: +# condition_description() describes the condition in words +# based on the value, assuming they all range from 0 to 5. These can be basic +# descriptions (eg. 'mint', 'heavily used') but feel free to have fun with these +# (e.g. 'You probably want a glove for this one..."). The one requirement is that +# the condition_description for all three classes above have the same behavior. \ No newline at end of file diff --git a/swap_meet/decor.py b/swap_meet/decor.py new file mode 100644 index 000000000..23566a10d --- /dev/null +++ b/swap_meet/decor.py @@ -0,0 +1,18 @@ +############### TEST WAVE 5 (5 tests) ############### +from .item import Item + +### test 5.2 PASSED ### +# Has an attribute category that is "Decor" +class Decor(Item): + def __init__(self, condition = 0): + super().__init__("Decor", condition) + + def __str__(self): + return "Something to decorate your space." + + def decor_condition_description(self, condition): + super().condition_description() +# stringify method returns "Something to decorate your space." +# All 3 classes and Item class have an attribute called condition, which can be default = 0 - rendering it optional in the initializer +# All 3 classes and Item class have an instance method: +# condition_description() describes the condition in words \ No newline at end of file diff --git a/swap_meet/electronics.py b/swap_meet/electronics.py new file mode 100644 index 000000000..0305bf2ae --- /dev/null +++ b/swap_meet/electronics.py @@ -0,0 +1,18 @@ +############### TEST WAVE 5 (5 tests) ############### +from .item import Item + +### test 5.3 PASSED ### +# Has an attribute category that is "Electronics" +class Electronics(Item): + def __init__(self, condition = 0): + super().__init__("Electronics", condition) + + def __str__(self): + return "A gadget full of buttons and secrets." +# stringify method returns "A gadget full of buttons and secrets." + + def elect_condition_description(self, condition): + super().condition_description() +# All 3 classes and Item class have an attribute called condition, which can be default = 0 - rendering it optional in the initializer +# All 3 classes and Item class have an instance method: +# condition_description() describes the condition in words \ No newline at end of file diff --git a/swap_meet/item.py b/swap_meet/item.py index f4d35bd69..b7a5d2321 100644 --- a/swap_meet/item.py +++ b/swap_meet/item.py @@ -1,20 +1,48 @@ ############### TEST WAVE 2 (3 tests) ############### +############### TEST WAVE 5 (5 tests) ############### # from vendor.swap_meet import Vendor?? # the instances/obects of the Item class will be components of the Vendor class' instance - vendor objects "have many" item objects -### test 2.1 PASSED ### +### test 2.1 PASSED ### setting the default argument makes it optional class Item: - def __init__(self, category = None): + def __init__(self, category = None, condition = None): if category == None: self.category = "" else: self.category = category -# setting the default argument to an empty string makes it optional to pass in a string with a keyword argument category +### test 5.4 PASSED ### +# make sure all conditions are a float + if condition is None: + self.condition = float(0) + else: + self.condition = float(condition) -### test 3.1 PASSED ### -# override_to_string / stringify +### test 3.1 PASSED ### override_to_string / stringify def __str__(self): return "Hello World!" # use str() to call this method and convert item to the str "Hello World" - # could also return "items category: {self.category}.format(self=self) +# could also return "items category: {self.category}".format(self=self) +# this method turns an item instance into the string "Hello world" + +### test 5.5 F ### + def condition_description(self, condition): + condition_description = "" + if condition < 0 or condition > 5: + return None + elif condition <= 1: + condition_description = "A hot mess" + elif condition <= 2 and condition > 1: + condition_description = "some wear and tear, the condition is fair" + elif condition <= 3 and condition > 2: + condition_description = "pleantifly medicore" + elif condition <= 4 and condition > 3: + condition_description = "pretty darn good" + elif condition <= 5 and condition > 4: + condition_description = "supreme" + return str(condition_description) -# this function should turn an item instance into the string "Hello world" \ No newline at end of file +# All three classes and the Item class have an instance method +# named condition_description, which should describe the condition in words +# based on the value, assuming they all range from 0 to 5. These can be basic +# descriptions (eg. 'mint', 'heavily used') but feel free to have fun with these +# (e.g. 'You probably want a glove for this one..."). The one requirement is that +# the condition_description for all three classes above have the same behavior. \ No newline at end of file diff --git a/swap_meet/vendor.py b/swap_meet/vendor.py index 138afc408..124dd65ec 100644 --- a/swap_meet/vendor.py +++ b/swap_meet/vendor.py @@ -3,6 +3,7 @@ ############### TEST WAVE 4 (3 tests) PASSED ############### # from item.swap_meet import Item - why is this not needed? +### test 1.1 PASSED ### test 1.2 PASSED ### class Vendor: def __init__(self, inventory = None): #get_by_category, # you can't make an argument/parameter of a mutable data type @@ -13,10 +14,12 @@ def __init__(self, inventory = None): #get_by_category, self.inventory = inventory # self.get_by_category = get_by_category() -- this is a Vendor method and does not need to be an attribute. +### test 1.3 PASSED ### def add(self, item): self.inventory.append(item) return item +### test 1.4 PASSED ### test 1.5 PASSED ### def remove(self, item): if self.inventory == []: return None @@ -28,8 +31,7 @@ def remove(self, item): self.inventory.remove(remove_item) return remove_item -### test 2.2 PASSED ### -### test 2.3 PASSED ### +### test 2.2 PASSED ### test 2.3 PASSED ### def get_by_category(self, category): items_by_category_list = [] for item in self.inventory: @@ -45,11 +47,7 @@ def get_by_category(self, category): # tests 2.3 #^^^returns an empty list if no item-instances belong to the category passed in. -### test 3.2 PASSED ### -### test 3.3 PASSED ### -### test 3.4 PASSED ### -### test 3.5 PASSED ### -### test 3.6 PASSED ### +## PASSED ## test 3.2 ## test 3.3 ## test 3.4 ## test 3.5 ## test 3.6 ## def swap_items(self, friendor, my_item, their_item): if my_item not in self.inventory or their_item not in friendor.inventory: return False @@ -60,9 +58,7 @@ def swap_items(self, friendor, my_item, their_item): self.inventory.append(their_item) return True - ### test 4.1 PASSED ### - ### test 4.2 PASSED ### - ### test 4.3 PASSED ### +### test 4.1 PASSED ### test 4.2 PASSED ### test 4.3 PASSED ### def swap_first_item(self, friendor): if self.inventory == [] or friendor.inventory == []: return False From cf49283cf515d4dbbf7e7973953a896d015e7ac9 Mon Sep 17 00:00:00 2001 From: Alli-Oops Date: Tue, 6 Apr 2021 21:24:16 -0700 Subject: [PATCH 6/8] added get_best_by_category() method and swap_best_by_category() method to the Vendor class. Passed all tests in Wave 6 --- swap_meet/clothing.py | 11 ++--------- swap_meet/decor.py | 5 ++--- swap_meet/electronics.py | 9 +++------ swap_meet/item.py | 34 ++++++++++++++++------------------ swap_meet/vendor.py | 22 ++++++++++++++++++++++ 5 files changed, 45 insertions(+), 36 deletions(-) diff --git a/swap_meet/clothing.py b/swap_meet/clothing.py index 64777d351..874c0aa0c 100644 --- a/swap_meet/clothing.py +++ b/swap_meet/clothing.py @@ -1,4 +1,4 @@ -############### TEST WAVE 5 (5 tests) ############### +############### TEST WAVE 5 (5 tests) PASSED ############### from .item import Item ### test 5.1 PASSED ### @@ -15,14 +15,7 @@ def __init__(self, condition = 0): def __str__(self): return "The finest clothing you could wear." #stringify method returns "The finest clothing you could wear." - def clothing_condition_description(self, condition): super().condition_description() - # All 3 classes and Item class have an attribute called condition, which can be default = 0 - rendering it optional in the initializer -# All 3 classes and Item class have an instance method: -# condition_description() describes the condition in words -# based on the value, assuming they all range from 0 to 5. These can be basic -# descriptions (eg. 'mint', 'heavily used') but feel free to have fun with these -# (e.g. 'You probably want a glove for this one..."). The one requirement is that -# the condition_description for all three classes above have the same behavior. \ No newline at end of file +# All 3 classes and Item class have an instance method: condition_description() describes the condition in words \ No newline at end of file diff --git a/swap_meet/decor.py b/swap_meet/decor.py index 23566a10d..c1474ae24 100644 --- a/swap_meet/decor.py +++ b/swap_meet/decor.py @@ -1,4 +1,4 @@ -############### TEST WAVE 5 (5 tests) ############### +############### TEST WAVE 5 (5 tests) PASSED ############### from .item import Item ### test 5.2 PASSED ### @@ -9,10 +9,9 @@ def __init__(self, condition = 0): def __str__(self): return "Something to decorate your space." - +# stringify method returns "Something to decorate your space." def decor_condition_description(self, condition): super().condition_description() -# stringify method returns "Something to decorate your space." # All 3 classes and Item class have an attribute called condition, which can be default = 0 - rendering it optional in the initializer # All 3 classes and Item class have an instance method: # condition_description() describes the condition in words \ No newline at end of file diff --git a/swap_meet/electronics.py b/swap_meet/electronics.py index 0305bf2ae..03a450cd5 100644 --- a/swap_meet/electronics.py +++ b/swap_meet/electronics.py @@ -1,6 +1,5 @@ -############### TEST WAVE 5 (5 tests) ############### +############### TEST WAVE 5 (5 tests) PASSED ############### from .item import Item - ### test 5.3 PASSED ### # Has an attribute category that is "Electronics" class Electronics(Item): @@ -9,10 +8,8 @@ def __init__(self, condition = 0): def __str__(self): return "A gadget full of buttons and secrets." -# stringify method returns "A gadget full of buttons and secrets." - +# stringify method returns "A gadget full of buttons and secrets." call it with str(instance) def elect_condition_description(self, condition): super().condition_description() # All 3 classes and Item class have an attribute called condition, which can be default = 0 - rendering it optional in the initializer -# All 3 classes and Item class have an instance method: -# condition_description() describes the condition in words \ No newline at end of file +# All 3 classes and Item class have an instance method: condition_description() describes the condition in words \ No newline at end of file diff --git a/swap_meet/item.py b/swap_meet/item.py index b7a5d2321..c9cd7198b 100644 --- a/swap_meet/item.py +++ b/swap_meet/item.py @@ -24,25 +24,23 @@ def __str__(self): # this method turns an item instance into the string "Hello world" ### test 5.5 F ### - def condition_description(self, condition): + def condition_description(self): condition_description = "" - if condition < 0 or condition > 5: - return None - elif condition <= 1: - condition_description = "A hot mess" - elif condition <= 2 and condition > 1: - condition_description = "some wear and tear, the condition is fair" - elif condition <= 3 and condition > 2: - condition_description = "pleantifly medicore" - elif condition <= 4 and condition > 3: - condition_description = "pretty darn good" - elif condition <= 5 and condition > 4: + # if self.condition < 0 or condition > 5: + # return None + if 4 < self.condition <= 5: condition_description = "supreme" + elif 3 <= self.condition <= 4: + condition_description = "pretty darn good" + elif 2 <= self.condition <= 3: + condition_description = "pleantifly medicore" + elif 1 <= self.condition <= 2: + condition_description = "some wear and tear, the condition is fair" + elif self.condition <= 1: + condition_description = "A hot mess" return str(condition_description) -# All three classes and the Item class have an instance method -# named condition_description, which should describe the condition in words -# based on the value, assuming they all range from 0 to 5. These can be basic -# descriptions (eg. 'mint', 'heavily used') but feel free to have fun with these -# (e.g. 'You probably want a glove for this one..."). The one requirement is that -# the condition_description for all three classes above have the same behavior. \ No newline at end of file +# if self.condition <= 5 and self.condition > 4: +# elif self.condition <= 4 and condition > 3: +# elif self.condition <= 3 and condition > 2: +# elif self.condition <= 2 and condition > 1: \ No newline at end of file diff --git a/swap_meet/vendor.py b/swap_meet/vendor.py index 124dd65ec..0d4d2ba50 100644 --- a/swap_meet/vendor.py +++ b/swap_meet/vendor.py @@ -1,6 +1,7 @@ ############### TEST WAVE 1 (5 tests) PASSED ############### ############### TEST WAVE 2 (3 tests) PASSED ############### ############### TEST WAVE 4 (3 tests) PASSED ############### +############### TEST WAVE 6 (6 tests) ############### # from item.swap_meet import Item - why is this not needed? ### test 1.1 PASSED ### test 1.2 PASSED ### @@ -69,3 +70,24 @@ def swap_first_item(self, friendor): self.inventory.append(friendor.inventory[0]) friendor.inventory.remove(friendor.inventory[0]) return True + +### test 6.1 PASSED ### test 6.2 PASSED ### test 6.3 PASSED ### + def get_best_by_category(self, category): + def get_condition(item): + return item.condition + items_by_category = self.get_by_category(category) + if len(items_by_category) > 0: + return max(items_by_category, key=get_condition) + else: + return None + + +### test 6.4 PASSED ### test 6.5 PASSED ### test 6.6 PASSED ### + def swap_best_by_category(self, other, my_priority, their_priority): + + my_category = self.get_best_by_category(their_priority) + their_category = other.get_best_by_category(my_priority) + success = self.swap_items(other, my_category, their_category) + return success + + From 5eb206b74ab233b755e0a9850b2ffe33b6bbaa72 Mon Sep 17 00:00:00 2001 From: Alli-Oops Date: Tue, 6 Apr 2021 21:56:41 -0700 Subject: [PATCH 7/8] Remove dot from import --- swap_meet/clothing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swap_meet/clothing.py b/swap_meet/clothing.py index 874c0aa0c..58b9a1eb0 100644 --- a/swap_meet/clothing.py +++ b/swap_meet/clothing.py @@ -1,5 +1,5 @@ ############### TEST WAVE 5 (5 tests) PASSED ############### -from .item import Item +from item import Item ### test 5.1 PASSED ### # Has an attribute category that is "Clothing" From b263b0f2c9f362151102b17d802be64abf7036ba Mon Sep 17 00:00:00 2001 From: Alli-Oops Date: Tue, 6 Apr 2021 22:01:13 -0700 Subject: [PATCH 8/8] Add swap_meet import --- swap_meet/clothing.py | 2 +- swap_meet/decor.py | 2 +- swap_meet/electronics.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/swap_meet/clothing.py b/swap_meet/clothing.py index 58b9a1eb0..3435de3f8 100644 --- a/swap_meet/clothing.py +++ b/swap_meet/clothing.py @@ -1,5 +1,5 @@ ############### TEST WAVE 5 (5 tests) PASSED ############### -from item import Item +from swap_meet.item import Item ### test 5.1 PASSED ### # Has an attribute category that is "Clothing" diff --git a/swap_meet/decor.py b/swap_meet/decor.py index c1474ae24..54c6a4b79 100644 --- a/swap_meet/decor.py +++ b/swap_meet/decor.py @@ -1,5 +1,5 @@ ############### TEST WAVE 5 (5 tests) PASSED ############### -from .item import Item +from swap_meet.item import Item ### test 5.2 PASSED ### # Has an attribute category that is "Decor" diff --git a/swap_meet/electronics.py b/swap_meet/electronics.py index 03a450cd5..d11e76af4 100644 --- a/swap_meet/electronics.py +++ b/swap_meet/electronics.py @@ -1,5 +1,6 @@ ############### TEST WAVE 5 (5 tests) PASSED ############### -from .item import Item +from swap_meet.item import Item + ### test 5.3 PASSED ### # Has an attribute category that is "Electronics" class Electronics(Item):