Open
Conversation
jbieniosek
reviewed
Oct 13, 2022
jbieniosek
left a comment
There was a problem hiding this comment.
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.
Comment on lines
+4
to
+5
| def __init__(self, condition = 0, age = 0): | ||
| super().__init__(category = "Clothing", condition = condition, age = age) |
| elif self.condition <= 4.0: | ||
| return "heavily used" | ||
| elif self.condition <= 5.0: | ||
| return "You probably want a glove for this one..." |
Comment on lines
+15
to
+17
| if item in self.inventory: | ||
| self.inventory.remove(item) | ||
| return item |
Comment on lines
+22
to
+24
| for item in self.inventory: | ||
| if item.category == category: | ||
| result.append(item) |
Comment on lines
+31
to
+34
| self.remove(my_item) | ||
| other.add(my_item) | ||
| other.remove(their_item) | ||
| self.add(their_item) |
Comment on lines
+63
to
+68
| my_best = self.get_best_by_category(their_priority) | ||
| 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) |
Comment on lines
+75
to
+77
| my_newest_aged_item = min(self.inventory, key=lambda item: item.age) | ||
| their_newest_aged_item = min(other.inventory, key=lambda item: item.age) | ||
| self.swap_items(other, my_newest_aged_item, their_newest_aged_item) |
Comment on lines
+56
to
+58
| assert len(vendor.inventory) == 3 | ||
| assert item not in vendor.inventory | ||
| assert result == False No newline at end of file |
| assert item_f in tai.inventory | ||
| assert item_d in jesse.inventory | ||
| assert item_e in jesse.inventory | ||
| assert item_c in jesse.inventory |
| #### Optional tests #### | ||
|
|
||
| pytest.mark.skip | ||
| def test_swap_by_newest_return_true(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.