Skip to content
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

Alexis Miller - Cheetahs #87

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

LexElena22
Copy link

No description provided.

Copy link

@jbieniosek jbieniosek left a comment

Choose a reason for hiding this comment

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

Fantastic work on this project Lex! Really great use of helper methods throughout vendor. The code is very clean and easy to read. My only critical feedback is on the tests, I think being a bit more thorough and clear in what is being tested will take them to the next level. This project is green.

Comment on lines +4 to +5
super().__init__("Clothing", condition)

Choose a reason for hiding this comment

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

👍

Comment on lines +5 to +7
inventory = []
self.inventory = inventory

Choose a reason for hiding this comment

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

💯

Comment on lines +22 to +24
if item.category == category:
items.append(item)

Choose a reason for hiding this comment

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

Nice!

Comment on lines +30 to +33
friend_vendor.add(my_item)
friend_vendor.remove(their_item)
self.add(their_item)

Choose a reason for hiding this comment

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

Great use of helper methods!

my_first_item = self.inventory[0]
their_first_item = friend_vendor.inventory[0]
is_swapped = self.swap_items(friend_vendor, my_first_item, their_first_item)

Choose a reason for hiding this comment

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

🎉

top_condition = item.condition
return_item = item
return return_item

Choose a reason for hiding this comment

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

Great solution!

Comment on lines +56 to +58
their_best = other.get_best_by_category(my_priority)
return self.swap_items(other, my_best, their_best)

Choose a reason for hiding this comment

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

😍

@@ -49,7 +49,9 @@ def test_removing_not_found_is_false():

result = vendor.remove(item)

raise Exception("Complete this test according to comments below.")
#added assert
assert result == False

Choose a reason for hiding this comment

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

I suggest adding a check to verify that the inventory wasn't changed by the remove action:

Suggested change
assert result == False
assert result == False
assert len(vendor.inventory) == 3

Comment on lines +79 to +86
assert len(tai.inventory) == len(jesse.inventory) == 3
assert len(tai.get_by_category("Clothing")) == 1
assert len(jesse.get_by_category("Clothing")) == 1
assert len(tai.get_by_category("Decor")) == 1
assert len(jesse.get_by_category("Decor")) == 2
assert tai.get_by_category("Decor")[0].condition == 2.0
assert tai.get_by_category("Clothing")[0].condition == 4.0
assert jesse.get_by_category("Clothing")[0].condition == 2.0

Choose a reason for hiding this comment

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

I recommend restructuring these tests to make sure the correct elements are swapped. It will make the asserts themselves a little simpler, but also check the specific action in the act step. Also, removing get_by_category reduces the possibility that a bug in that function will falsely register a bug here.

Suggested change
assert len(tai.inventory) == len(jesse.inventory) == 3
assert len(tai.get_by_category("Clothing")) == 1
assert len(jesse.get_by_category("Clothing")) == 1
assert len(tai.get_by_category("Decor")) == 1
assert len(jesse.get_by_category("Decor")) == 2
assert tai.get_by_category("Decor")[0].condition == 2.0
assert tai.get_by_category("Clothing")[0].condition == 4.0
assert jesse.get_by_category("Clothing")[0].condition == 2.0
assert item_a in tai.inventory
assert item_b in tai.inventory
assert item_f in tai.inventory
assert item_d in jesse.inventory
assert item_e in jesse.inventory
assert item_c in jesse.inventory

Comment on lines +124 to +126
assert item_f in tai.inventory
assert item_c in jesse.inventory
assert item_c not in tai.inventory

Choose a reason for hiding this comment

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

I recommend checking all of the items here, rather than just the ones that were swapped.

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