Amethyst - Elaine W.#91
Conversation
audreyandoy
left a comment
There was a problem hiding this comment.
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! ✨
| - 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 ") |
| @@ -1,2 +1,13 @@ | |||
| class Clothing: | |||
| pass No newline at end of file | |||
| # import uuid | |||
There was a problem hiding this comment.
We can remove commented-out code in future PR's.
There was a problem hiding this comment.
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 (:
| class Clothing(Item): | ||
| 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.
👍 Great work using the parent constructor to create the id and condition attributes.
| class Decor(Item): | ||
| 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." |
| 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.
👍 We can remove self.id = id since it's commented out.
| assert len(fatimah.inventory) == 3 | ||
| assert len(jolie.inventory) == 0 | ||
| assert not result |
| assert result | ||
| assert len(tai.inventory) == len(jesse.inventory) | ||
| assert item_f not in jesse.inventory | ||
| assert item_e not in tai.inventory |
| 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.
👍 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.
These asserts 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.
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 |
No description provided.