-
Notifications
You must be signed in to change notification settings - Fork 113
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
Whales C17 - Julie Warren #94
base: master
Are you sure you want to change the base?
Conversation
…ronics: Wave 5 / Tests 1 thru 3
…te and condition description method: Wave 5 / Tests 4 and 5
…ms: Wave 6 / Tests 4 thru 6
…item: Wave 6 / Tests 7 thru 9. Passed integration tests.
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.
Wonderful work on this project, Julie! You demonstrated mastery of Unit 1 concepts and had fantastic code style and implementations throughout. 👍🏻 Great job for both the function definitions and completing the tests! Your project is green 🟢 !
A sub-class of Item, indicating a type of item a vendor might have. | ||
|
||
Attributes: | ||
condition (float): optional descr. of item condition, 0 if not defined | ||
category (str): description of item category, always set to "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.
Yay docstrings! Great use of them here and throughout your code!
self.condition = condition |
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! Another option that works is calling the constructor of the parent (Item) class like super().__init__(condition=condition, category='Decor')
|
||
Attributes: | ||
category (str): optional descr. of item category. None if not defined, | ||
w/attribute set to an empty string. Otherwise set to input param. | ||
condition (float): optional descr. of item condition, 0 if not defined |
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.
Nice details!
''' | ||
|
||
if category is 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.
👍🏻
if len(self.inventory) >= 1 and len(other_vendor.inventory) >= 1: | ||
self.swap_items(other_vendor, self.inventory[0], other_vendor.inventory[0]) | ||
return True |
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.
Yes! You could also take advantage of the fact that .swap_items returns True or False and return self.swap_items(...,...)
best_my_priority = other.get_best_by_category(my_priority) | ||
if best_their_priority and best_my_priority: | ||
self.swap_items(other, best_their_priority, best_my_priority) |
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.
Awesome use of helper functions!
assert item not in vendor.inventory | ||
assert len(vendor.inventory) == 3 | ||
assert result == False |
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.
👍🏻
assert result | ||
assert len(tai.inventory) == 3 | ||
assert item_a in tai.inventory | ||
assert item_b in tai.inventory | ||
assert item_f in tai.inventory | ||
assert len(jesse.inventory) == 3 | ||
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.
👍🏻
assert not result | ||
assert len(tai.inventory) == 3 | ||
assert item_a in tai.inventory | ||
assert item_b in tai.inventory | ||
assert item_c in tai.inventory | ||
assert len(jesse.inventory) == 3 | ||
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.
👍🏻
assert not result | ||
assert len(tai.inventory) == 3 | ||
assert item_a in tai.inventory | ||
assert item_b in tai.inventory | ||
assert item_c in tai.inventory | ||
assert len(jesse.inventory) == 3 | ||
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.
👍🏻
No description provided.