Skip to content

Ocelots -- Eva Liu #18

Open
wich229 wants to merge 17 commits intoada-ac2:mainfrom
wich229:main
Open

Ocelots -- Eva Liu #18
wich229 wants to merge 17 commits intoada-ac2:mainfrom
wich229:main

Conversation

@wich229
Copy link
Copy Markdown

@wich229 wich229 commented Dec 9, 2022

No description provided.

Copy link
Copy Markdown

@kelsey-steven-ada kelsey-steven-ada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work Eva! I've left a mix of suggestions and questions to consider for feedback. Please reply here on Github or reach out on Slack if there's anything I can clarify =]

Comment thread swap_meet/electronics.py


def __str__(self):
return f"{super().__str__()}. This is a {self.type} device." No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice use of inheritance across the child classes.

Comment thread swap_meet/item.py
Comment on lines +7 to +10
if id is None:
self.id = uuid.uuid4().int
else:
self.id = id
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice solution, another option here could use conditional assignment:

# Assigns self.id to the parameter id if id is truthy, 
# otherwise assigns self.id the return value of uuid.uuid4().int
self.id = id if id else uuid.uuid4().int

Comment thread swap_meet/item.py
4 : "sample item",
5 : "brand new"
}
return level_explained[int(self.condition)]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the use of int() to account for decimal condition values.

Comment thread swap_meet/vendor.py
Comment on lines +15 to +16
if item not in self.inventory:
return None
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice check to ensure the Vendor doesn't contain duplicates

Comment thread swap_meet/vendor.py


def get_by_id(self, id):
print(f"\nid: {id}\n")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to remove debugging code like print statements before opening PRs.

Comment thread swap_meet/vendor.py
my_id_item = self.get_by_id(my_item_id)
other_id_item = other_vendor.get_by_id(their_item_id)

if my_id_item == None or other_id_item == None:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to share a reminder that in python we should use is or is not when comparing against None.

Comment thread swap_meet/vendor.py
self_id = 0
other_id = 0

while flag:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice loop to prompt for valid input!

@@ -0,0 +1,90 @@
import pytest
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great tests!

Comment on lines +53 to +55
assert len(vendor.inventory) == 3
assert vendor.inventory == ["a", "b", "c"]
assert result is None
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great assertions, very complete checks =]

Comment on lines +135 to +137
assert result is False
assert len(fatimah.inventory) == 3
assert len(jolie.inventory) == 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great assertions, I would also suggest checking fatima's inventory contents, since checks like the length being correct do not guarantee that the individual elements are still what we expect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants