Skip to content

Ada c17 whales-Nishat Salsabil#96

Open
nishatsalsabil wants to merge 11 commits intoada-c17:masterfrom
nishatsalsabil:master
Open

Ada c17 whales-Nishat Salsabil#96
nishatsalsabil wants to merge 11 commits intoada-c17:masterfrom
nishatsalsabil:master

Conversation

@nishatsalsabil
Copy link
Copy Markdown

An additional wave 07 was created for the optional enhancement section of the project.

Copy link
Copy Markdown

@jericahuang jericahuang 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, Nish! The code you wrote passed all the tests and met the learning goals. Phenomenal job on the optional enhancements and completing the tests. Your project is green 🟢 ! Congratulations on completing Unit 1!

Comment thread swap_meet/item.py
class Item:
pass No newline at end of file
def __init__(self, category = None, condition = 0, age = 0):
if not category:
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 specify a category, it will be None because of category = None in the constructor!

Comment thread swap_meet/item.py
return "Hello World!"


def age_statement(self):
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 addition of an age statement!

Comment thread swap_meet/vendor.py
their_item = other_vendor.inventory[0]
first_items = self.swap_items(other_vendor, my_item, their_item)
return first_items
except IndexError:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wonderful try-except and catching IndexError!

Comment thread swap_meet/vendor.py
if item in self.inventory:
self.inventory.remove(item)
return item
return 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.

Nice use of short-circuiting and returning False at the end!

Comment thread swap_meet/vendor.py
def swap_best_by_category(self, other, my_priority, their_priority):
my_item = other.get_best_by_category(my_priority)
their_item = self.get_best_by_category(their_priority)
return self.swap_items(other, their_item, my_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.

Great use of helper functions to DRY your code!


assert newest_item
assert newest_item.category == "Clothing"
assert newest_item.age == pytest.approx(1)
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 use of pytest.approx()!


newest_item = nishat.get_newest_item()

assert newest_item 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.

👍🏻

assert item_a in nishat.inventory
assert item_b not in nishat.inventory
assert item_b in fatima.inventory
assert item_c in nishat.inventory
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍🏻


# Test 40
#@pytest.mark.skip
def test_swap_newest_item_reordered():
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Awesome test idea for another ordering!

their_item = nishat.get_newest_item()
)

assert not result
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍🏻

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