-
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
Miranda - Lion #83
base: master
Are you sure you want to change the base?
Miranda - Lion #83
Conversation
…ection between the string inside the self.inventory and the attribute category in Item class
…by using parameter_name.attribute_name
…e specific index 0. After assign the index 0 to a new variable, the problem solved.
…ry function, wrongly put my_priority in the self.get_best_by_category function
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! Your code overall is great! There are some comments about places where the code could be DRY-ed up. For commits, it would be a good idea to commit more often! It would also be great if the commit messages could focus on what changes were made to the code. Instead of messages about being stuck, it would be good to have something like "Created Item class" or "Added swap_item function".
|
||
class Clothing(Item): | ||
def __init__(self, category = "Clothing", condition = 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.
Great job! We actually don't want to have category
in the __init__
function. Since Clothing objects should always have "Clothing" as the category we do not want to let the user to put in their own information. On line 5 instead of category
you can put "Clothing"
to pass to the super class.
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.
Great job!
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.
Great job!
def __init__(self, category = None, condition = 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.
The default for category can be ""
instead of None
. We use None
for mutable data types like lists or dictionaries. Since string are immutable in Python, we do not need None
.
return "Hello World!" | ||
|
||
def condition_description(self): |
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 you were changing some of the conditions in the if statements, but didn't finish. The logic has some gaps in it. Good start though!
assert item_a not in items | ||
assert item_c not in items | ||
assert item_b not in items |
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 asserts! These three aren't necessary since the first one tells us there's nothing in the list. We don't need to check each individual item.
assert result is True | ||
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 not in tai.inventory | ||
assert item_f in tai.inventory | ||
assert item_d in jesse.inventory | ||
assert item_e in jesse.inventory | ||
assert item_f not 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 is True | ||
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 not in tai.inventory | ||
assert item_f in tai.inventory | ||
assert item_d in jesse.inventory | ||
assert item_e in jesse.inventory | ||
assert item_f not 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 is False | ||
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 result is False | ||
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.