Skip to content

Cheetahs - Wanjun Lan #79

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

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

Cheetahs - Wanjun Lan #79

wants to merge 6 commits into from

Conversation

wjlan
Copy link

@wjlan wjlan commented Oct 7, 2022

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 Wanjun! The code is very clean and easy to read. Good work using helper methods in the vendor class. Nice work on the age extension! This project is green.

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

Choose a reason for hiding this comment

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

👍

return "heavily used"
elif self.condition <= 5.0:
return "You probably want a glove for this one..."

Choose a reason for hiding this comment

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

Great work!

Comment on lines +15 to +17
self.inventory.remove(item)
return item

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:
result.append(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 +31 to +34
other.add(my_item)
other.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.

Good use of helper methods!

Comment on lines +63 to +68
their_best = other.get_best_by_category(my_priority)
if not my_best or not their_best:
return False

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.

Fantastic use of helper methods!

Comment on lines +75 to +77
their_newest_aged_item = min(other.inventory, key=lambda item: item.age)
self.swap_items(other, my_newest_aged_item, their_newest_aged_item)

Choose a reason for hiding this comment

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

🎉 Fantastic, great use of lambda!

Comment on lines +56 to +58
assert len(vendor.inventory) == 3
assert item not in vendor.inventory
assert result == False

Choose a reason for hiding this comment

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

👍

assert item_f in tai.inventory
assert item_d in jesse.inventory
assert item_e in jesse.inventory
assert item_c in jesse.inventory

Choose a reason for hiding this comment

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

💯

#### Optional tests ####

pytest.mark.skip
def test_swap_by_newest_return_true():

Choose a reason for hiding this comment

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

🎉 Great addition!

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