-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alexis Miller - Cheetahs #87
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic work on this project Lex! Really great use of helper methods throughout vendor. The code is very clean and easy to read. My only critical feedback is on the tests, I think being a bit more thorough and clear in what is being tested will take them to the next level. This project is green.
super().__init__("Clothing", condition) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
inventory = [] | ||
self.inventory = inventory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
if item.category == category: | ||
items.append(item) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
friend_vendor.add(my_item) | ||
friend_vendor.remove(their_item) | ||
self.add(their_item) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great use of helper methods!
my_first_item = self.inventory[0] | ||
their_first_item = friend_vendor.inventory[0] | ||
is_swapped = self.swap_items(friend_vendor, my_first_item, their_first_item) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
top_condition = item.condition | ||
return_item = item | ||
return return_item |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great solution!
their_best = other.get_best_by_category(my_priority) | ||
return self.swap_items(other, my_best, their_best) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍
@@ -49,7 +49,9 @@ def test_removing_not_found_is_false(): | |||
|
|||
result = vendor.remove(item) | |||
|
|||
raise Exception("Complete this test according to comments below.") | |||
#added assert | |||
assert result == False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest adding a check to verify that the inventory wasn't changed by the remove action:
assert result == False | |
assert result == False | |
assert len(vendor.inventory) == 3 |
assert len(tai.inventory) == len(jesse.inventory) == 3 | ||
assert len(tai.get_by_category("Clothing")) == 1 | ||
assert len(jesse.get_by_category("Clothing")) == 1 | ||
assert len(tai.get_by_category("Decor")) == 1 | ||
assert len(jesse.get_by_category("Decor")) == 2 | ||
assert tai.get_by_category("Decor")[0].condition == 2.0 | ||
assert tai.get_by_category("Clothing")[0].condition == 4.0 | ||
assert jesse.get_by_category("Clothing")[0].condition == 2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend restructuring these tests to make sure the correct elements are swapped. It will make the asserts themselves a little simpler, but also check the specific action in the act step. Also, removing get_by_category
reduces the possibility that a bug in that function will falsely register a bug here.
assert len(tai.inventory) == len(jesse.inventory) == 3 | |
assert len(tai.get_by_category("Clothing")) == 1 | |
assert len(jesse.get_by_category("Clothing")) == 1 | |
assert len(tai.get_by_category("Decor")) == 1 | |
assert len(jesse.get_by_category("Decor")) == 2 | |
assert tai.get_by_category("Decor")[0].condition == 2.0 | |
assert tai.get_by_category("Clothing")[0].condition == 4.0 | |
assert jesse.get_by_category("Clothing")[0].condition == 2.0 | |
assert item_a in tai.inventory | |
assert item_b in tai.inventory | |
assert item_f in tai.inventory | |
assert item_d in jesse.inventory | |
assert item_e in jesse.inventory | |
assert item_c in jesse.inventory |
assert item_f in tai.inventory | ||
assert item_c in jesse.inventory | ||
assert item_c not in tai.inventory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend checking all of the items here, rather than just the ones that were swapped.
No description provided.