-
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
C18 Lions ADSF #102
base: master
Are you sure you want to change the base?
C18 Lions ADSF #102
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.
Great job! Your code overall was good. There are some comments below on places where the code can be improved. For the commits, make sure to commit often and have more descriptive commit messages. Instead of saying what wave was completed, explain what functionality was added or changed. For example, "Created Item class" or "Added swap_items function".
from swap_meet.item import Item | ||
|
||
class Clothing(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.
Excellent!
from swap_meet.item import Item | ||
|
||
class Decor(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.
Excellent!
pass | ||
from swap_meet.item import Item | ||
|
||
class Electronics(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.
Excellent!
def __init__(self, category = "", condition=None, age = None): |
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.
Condition and age do not need to have None
as the default, it can just be 0. We use None
for things that are mutable, like lists and dictionaries. Integers are not mutable!
from operator import ne | ||
from swap_meet.item import 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.
It looks like there were some imports that were accidentally added. It's good practice after you're done coding to make sure you only have the imports you need.
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.
Thank you, I 'll check them.
Actually, VSC added imports very often while I was doing my project.
@@ -33,8 +34,8 @@ def test_get_no_matching_items_by_category(): | |||
) | |||
|
|||
items = vendor.get_by_category("electronics") | |||
|
|||
raise Exception("Complete this test according to comments below.") | |||
assert len(items) == 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.
Excellent!
assert item_c in jesse.inventory | ||
assert item_f 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.
Great start! It would be a good idea to check that all of the other items that we expect in the inventory are still in there as well.
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.
Thank you, I'm still working on the project to finish it.
assert result == True | ||
assert len(jesse.inventory) == 3 | ||
assert len(tai.inventory) == 3 | ||
assert item_f in tai.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.
Great!
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to do the same kind of asserts you did in previous tests. ==
will fail if the lists are out of order. We don't know for sure how the swap works and where the new item will end up in the list. It is better to check if each of the items are in the list.
assert result == False | ||
assert len(tai.inventory) == 3 | ||
assert len(jesse.inventory) == 3 | ||
assert jesse.inventory == [item_f, item_e, item_d] | ||
assert tai.inventory == [item_c, item_b, item_a] |
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!
No description provided.