-
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
Amethyst - Elaine W. #91
base: main
Are you sure you want to change the base?
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 work Elaine and Raina! You hit all the learning goals for this project and all tests are passing. You have earned a well-deserved 🟢 grade on this project ✨
I added comments, compliments, and hints on ways to refactor your code.
Keep up the great work! ✨
@@ -89,7 +89,8 @@ In Wave 2 we will create the `Item` class and the `Vendor` class' `get_by_id` me | |||
- Specifically, you'll need to choose which of the `uuid` package's functions to use, so be sure to consider which function will work best for creating a unique integer | |||
- Note that this package's functions return `UUID` objects, not integers as such, **but** `UUID` objects have [an attribute `int`](https://docs.python.org/3/library/uuid.html#uuid.UUID.int) which allow us to access their value as an integer | |||
- When we initialize an instance of `Item`, we can optionally pass in an integer with the keyword argument `id` to manually set the `Item`'s `id` | |||
- Each `Item` will have a function named `get_category`, which will return a string holding the name of the class | |||
- Each `Item` will have a function named `get_category`, which will return a string holding the name of the class (named Vendor instance, ex: "Clothing", "Decor", "Electronics ") |
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.
I like this clarification!
# import uuid |
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.
We can remove commented-out code in future PR's.
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.
In industry, PR's are used to present a solution or code added to a project shared with the rest of the team with the intention of eventually being reviewed and merged into production. Commented out code isn't going to be merged into production (at least, that's best practice) so we can remove it from PRs (:
def __init__(self, id = None, fabric="Unknown", condition = 0): | ||
super().__init__(id, condition) | ||
# self.id = id | ||
self.fabric = fabric | ||
|
||
def __str__(self): | ||
return f"An object of type Clothing with id {self.id}. It is made from {self.fabric} fabric." |
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 work using the parent constructor to create the id and condition attributes.
def __init__(self, id = None, width = 0, length = 0, condition = 0): | ||
super().__init__(id, condition) | ||
# self.id = id | ||
self.width = width | ||
self.length = length | ||
|
||
def __str__(self): | ||
return f"An object of type Decor with id {self.id}. It takes up a {self.width} by {self.length} sized space." |
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.
👍
class Electronics(Item): | ||
def __init__(self, id = None, type = "Unknown", condition = 0): | ||
super().__init__(id, condition) | ||
# self.id = id | ||
self.type = type | ||
|
||
|
||
def __str__(self): | ||
return f"An object of type Electronics with id {self.id}. This is a {self.type} device." |
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.
👍 We can remove self.id = id
since it's commented out.
assert len(fatimah.inventory) == 3 | ||
assert len(jolie.inventory) == 0 | ||
assert not result |
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) == len(jesse.inventory) | ||
assert item_f not in jesse.inventory | ||
assert item_e 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.
👍
assert result | ||
assert len(tai.inventory) == len(jesse.inventory) | ||
assert (item_d and item_f) in tai.inventory and (item_d and item_f) not 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.
👍 Nitpick: if I'm testing 2 different data structures (tai's inventory and jesse's inventory) I prefer to have separate asserts just to make thediff message from the failed test easier to read.
This can be applied to the rest of the tests.
assert jesse | ||
assert tai |
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.
These assert
s only check if jesse
and tai
are truthy, which means that as long as jesse and tai have items within their lists (or is any truthy value like an integer, string, etc.) then the test will pass. We may want to be more explicit to ensure that jesse
and tai
's inventory lists remain unchanged.
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.
example:
assert tai.inventory == [item_a, item_b, item_c]
assert jesse.inventory == [item_d, item_e, item_f]
assert not result | ||
assert len(tai.inventory) == 3 | ||
assert len(jesse.inventory) == 3 | ||
assert jesse | ||
assert tai |
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.
See comment above.
No description provided.