Kate - Lion - #20
Conversation
nancy-harris
left a comment
There was a problem hiding this comment.
Excellent job! Your code was good overall. There are a few places where it could have been simpler/cleaner and there was a small logical error in one of the functions. See comments below.
For commits, it would be great if the commit messages could be more descriptive. Instead of writing which wave you completed, it would be good to see something like "Created Item class" or "Added swap_item function".
| from swap_meet.item import Item | ||
|
|
||
| class Clothing(Item): | ||
| def __init__(self, category = "Clothing", condition = 0.0, age = None): |
There was a problem hiding this comment.
We actually do not want to have category in the __init__ function. We want the category to always be "Clothing", but if we put category here, the user can set category to whatever they want, which isn't good!
| pass No newline at end of file | ||
| from swap_meet.item import Item | ||
|
|
||
| class Decor(Item): |
| pass | ||
| from swap_meet.item import Item | ||
|
|
||
| class Electronics(Item): |
| 5: "Excellent" | ||
| } | ||
|
|
||
| return rating_description[self.condition] |
There was a problem hiding this comment.
Excellent! So clean and simple! =D
| return "Hello World!" | ||
|
|
||
| def condition_description(self): | ||
| rating_description = { |
There was a problem hiding this comment.
It might be a good idea to have this dictionary outside of the function so that it doesn't have to be recreated every time the function is called.
| assert result == True | ||
| assert len(tai.inventory) == 3 | ||
| assert len(jesse.inventory) == 3 | ||
| assert all(item in [item_f, item_a, item_b] for item in tai.inventory) | ||
| assert all(item in [item_d, item_e, item_c] for item in jesse.inventory) |
| assert tai.inventory == [item_a, item_b, item_c] | ||
| assert jesse.inventory == [item_d, item_e, item_f] |
There was a problem hiding this comment.
It would be better for these that you use a similar assert to what you did for the other tests. == will fail if the two lists are not in the same order but contain the same elements.
| assert result == False | ||
| assert len(tai.inventory) == 3 | ||
| assert len(jesse.inventory) == 3 | ||
| assert tai.inventory == [item_c, item_b, item_a] | ||
| assert jesse.inventory == [item_f, item_e, item_d] |
| from swap_meet.electronics import Electronics | ||
|
|
||
| ''' | ||
| **** TEST ADDED FOR [OPTIONAL] SWAP BY NEWEST FUNCTION *** |
|
|
||
| return newest_item | ||
|
|
||
| def swap_by_newest(self, another_vendor): |
There was a problem hiding this comment.
Excellent job taking on the extra work!
No description provided.