-
Notifications
You must be signed in to change notification settings - Fork 103
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
Ruby - Mikayla H #84
base: main
Are you sure you want to change the base?
Ruby - Mikayla H #84
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.
Excellent job! There are some comments below on places to make the code cleaner/simpler. Great job on commits! It would be great if the commits could give more details about what changes were made. Something like "Created the Item class" would be great!
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!
return super().condition_description() |
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 the only thing you're doing is calling the super, then you don't need to override the method! If Python sees that the Clothing class does not have a condition_description
method, it will look in the Item
class, see it there, and use that one. Try removing this method from Clothing (and Decor and Electronics) and you'll see that all of the tests still pass!
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!
return "Clothing" |
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.
This method is not necessary! The .__class__.__name__
attribute that's used in the Item
class will adjust and print the correct thing. Try deleting this method in the Clothing class (and Decor and Electronics) and the tests will still pass!
@@ -33,12 +34,12 @@ 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 result | ||
assert len(tai.inventory) == 3 | ||
assert len(jesse.inventory) == 3 | ||
assert item_f in tai.inventory | ||
assert item_a in tai.inventory | ||
assert item_b 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.
Excellent!
assert result | ||
assert len(tai.inventory) == 3 | ||
assert len(jesse.inventory) == 3 | ||
assert item_a in tai.inventory | ||
assert item_b in tai.inventory | ||
assert item_f in tai.inventory | ||
assert item_d in jesse.inventory | ||
assert item_e in jesse.inventory | ||
assert item_c in jesse.inventory | ||
assert item_f not in jesse.inventory | ||
assert item_c not 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.
Excellent!
assert not result | ||
assert len(tai.inventory) == 3 | ||
assert len(jesse.inventory) == 3 | ||
assert item_a in tai.inventory | ||
assert item_b in tai.inventory | ||
assert item_c in tai.inventory | ||
assert item_d in jesse.inventory | ||
assert item_e in jesse.inventory | ||
assert item_f 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.
Excellent!
assert not result | ||
assert len(tai.inventory) == 3 | ||
assert len(jesse.inventory) == 3 | ||
assert item_a in tai.inventory | ||
assert item_b in tai.inventory | ||
assert item_c in tai.inventory | ||
assert item_d in jesse.inventory | ||
assert item_e in jesse.inventory | ||
assert item_f 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.
Excellent!
No description provided.