Skip to content

Ocelots - Lisa Utsett#14

Open
lisabethu88 wants to merge 4 commits intoada-ac2:mainfrom
lisabethu88:main
Open

Ocelots - Lisa Utsett#14
lisabethu88 wants to merge 4 commits intoada-ac2:mainfrom
lisabethu88:main

Conversation

@lisabethu88
Copy link
Copy Markdown

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 Lisa! 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 Pseudocode .rtf
@@ -0,0 +1,73 @@
{\rtf1\ansi\ansicpg1252\cocoartf2639
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Was this file meant to be committed?

Comment thread swap_meet/electronics.py
self.type = type

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 +5 to +8
if not id:
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
return "Fair"
elif 3 < self.condition <= 4:
return "Good"
elif 4 < self.condition <= 5:
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 ranges to account for decimal condition values.

Comment thread swap_meet/vendor.py
@@ -1,2 +1,146 @@
from .item import Item
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If we don't use a class name to do something like create a new instance or call a class method, we likely don't need to import it and should remove the import line.

Comment thread swap_meet/vendor.py
Comment on lines +94 to +98
my_item = self.get_by_id(my_item_id)
their_item = other_vendor.get_by_id(vendor_item_id)

if my_item and their_item:
return self.swap_items(other_vendor, my_item, their_item)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Another option could be to use the swap_by_id function here.

@pytest.mark.skip
@pytest.mark.integration_test
#@pytest.mark.skip
#@pytest.mark.integration_test
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

For integration tests, we want to leave the decorator @pytest.mark.integration_test uncommented. This decorator tells pytest that this is an integration test, so we should run it after all of the unit tests.

result = vendor.remove(item)

raise Exception("Complete this test according to comments below.")
assert result == 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 assert, we definitely want to confirm our return value is None. We generally also want to confirm that there weren't side affects or changes to the input that we didn't intend. What could we assert about the vendor's inventory to confirm that its content didn’t change?

result = fatimah.swap_items(jolie, item_b, nobodys_item)

raise Exception("Complete this test according to comments below.")
assert result == False
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The feedback in wave 1 applies here as well, what else would be helpful to assert to ensure there were no unintended side effects?

assert item_c in vendor1.inventory
assert item_d in vendor2.inventory
assert item_e in vendor2.inventory
assert item_f in vendor2.inventory 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.

Love the added tests!

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