Conversation
nancy-harris
left a comment
There was a problem hiding this comment.
Great job! You code looks good overall. There were a few functions that don't quite do what they're supposed to and there are a few places where code could be simpler. See comments below. For commits, remember to commit more often and make your commit messages more descriptive. Instead of talking about which wave was completed, maybe something like "Created Item class" or "Added swap_items function".
| pass No newline at end of file | ||
| from swap_meet.item import Item | ||
| class Clothing(Item): | ||
| def __init__(self, condition = 0, category = "Clothing" ): |
There was a problem hiding this comment.
It would be a good idea to remove category from the __init__ function. We don't want the user to be able to set the category. It should always be "Clothing" for the Clothing class. Instead, you can just add "Clothing" as the category when you call super.
| class Decor: | ||
| pass No newline at end of file | ||
| from swap_meet.item import Item | ||
| class Decor(Item): |
| class Electronics: | ||
| pass | ||
| from swap_meet.item import Item | ||
| class Electronics(Item): |
| @@ -1,2 +1,26 @@ | |||
|
|
|||
|
|
|||
| class Item: | |||
| from swap_meet.item import Item | ||
| from swap_meet.clothing import Clothing | ||
| from swap_meet.decor import Decor | ||
| from swap_meet.electronics import Electronics |
There was a problem hiding this comment.
These imports actually aren't needed! It's good practice once you're done coding to go back and check to see if you accidentally imported things you don't need and remove them.
| assert item_a not in items | ||
| assert item_b not in items | ||
| assert item_c not in items No newline at end of file |
There was a problem hiding this comment.
Great job! These asserts are actually not needed. Since the items list is empty, you already know these individual items are not in there.
| assert result | ||
| assert len(tai.inventory) == 3 | ||
| assert len(jesse.inventory) == 3 | ||
| assert item_f in tai.inventory | ||
| assert item_b in tai.inventory | ||
| assert item_a in tai.inventory | ||
| assert item_c in jesse.inventory | ||
| assert item_d in jesse.inventory | ||
| assert item_e in jesse.inventory |
| assert result | ||
| assert len(tai.inventory) == 3 | ||
| assert len(jesse.inventory) == 3 | ||
| assert item_f in tai.inventory | ||
| assert item_b in tai.inventory | ||
| assert item_a in tai.inventory | ||
| assert item_c in jesse.inventory | ||
| assert item_d in jesse.inventory | ||
| assert item_e in jesse.inventory |
| assert not result | ||
| assert len(tai.inventory) == 3 | ||
| assert len(jesse.inventory) == 3 | ||
| assert item_c in tai.inventory | ||
| assert item_b in tai.inventory | ||
| assert item_a in tai.inventory | ||
| assert item_f in jesse.inventory | ||
| assert item_d in jesse.inventory | ||
| assert item_e in jesse.inventory |
| assert not result | ||
| assert len(tai.inventory) == 3 | ||
| assert len(jesse.inventory) == 3 | ||
| assert item_c in tai.inventory | ||
| assert item_b in tai.inventory | ||
| assert item_a in tai.inventory | ||
| assert item_f in jesse.inventory | ||
| assert item_d in jesse.inventory | ||
| assert item_e in jesse.inventory |
Learned a lot about OOP through this project