Skip to content

Commit

Permalink
add another test for removing from a heap
Browse files Browse the repository at this point in the history
  • Loading branch information
CheezItMan committed Jan 14, 2022
1 parent 35c4aee commit 5f72082
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions tests/test_min_heap.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ def test_works_for_adding_nodes_in_proper_order_with_6_nodes(heap):
# Assert
assert output == "[Donuts, Pizza, Pasta, Soup, Cookies, Cake]"

# Written by Ariana Gonzalez Organista
def test_works_for_adding_nodes_in_proper_order_with_6_nodes_2(heap):
# Arrange
numbers = [5, 27, 3, 16, 50]
for num in numbers:
heap.add(num)
# Act
output = str(heap)

# Assert
assert output == "[3, 16, 5, 27, 50]"

def test_it_can_remove_nodes_in_proper_order(heap):
# Arrange
heap.add(3, "Pasta")
Expand All @@ -64,16 +76,5 @@ def test_it_can_remove_nodes_in_proper_order(heap):
for item in returned_items:
assert heap.remove() == item

# Written by Ariana Gonzalez Organista
def test_works_for_adding_nodes_in_proper_order_with_6_nodes_2(heap):
# Arrange
numbers = [5, 27, 3, 16, 50]
for num in numbers:
heap.add(num)
# Act
output = str(heap)

# Assert
# assert output == "[0, 1, 3, 6, 16, 57]"
assert output == "[3, 16, 5, 27, 50]"

def test_removing_a_node_from_an_empty_heap_is_none(heap):
assert heap.remove() == None

0 comments on commit 5f72082

Please sign in to comment.