-
Notifications
You must be signed in to change notification settings - Fork 110
Cheetahs - Wanjun Lan #79
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
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 Wanjun! The code is very clean and easy to read. Good work using helper methods in the vendor class. Nice work on the age extension! This project is green.
super().__init__(category = "Clothing", condition = condition, age = age) |
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.
👍
return "heavily used" | ||
elif self.condition <= 5.0: | ||
return "You probably want a glove for this one..." |
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 work!
self.inventory.remove(item) | ||
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.
💯
if item.category == category: | ||
result.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.
Great solution!
other.add(my_item) | ||
other.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.
Good use of helper methods!
their_best = other.get_best_by_category(my_priority) | ||
if not my_best or not their_best: | ||
return False | ||
|
||
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.
Fantastic use of helper methods!
their_newest_aged_item = min(other.inventory, key=lambda item: item.age) | ||
self.swap_items(other, my_newest_aged_item, their_newest_aged_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.
🎉 Fantastic, great use of lambda!
assert len(vendor.inventory) == 3 | ||
assert item not in vendor.inventory | ||
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.
👍
assert item_f in tai.inventory | ||
assert item_d in jesse.inventory | ||
assert item_e in jesse.inventory | ||
assert item_c in jesse.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.
💯
#### Optional tests #### | ||
|
||
pytest.mark.skip | ||
def test_swap_by_newest_return_true(): |
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 addition!
No description provided.