"""Testing binary Heap."""

import pytest


@pytest.fixture
def empty_heap():
    """Fixture for empty_heap."""
    from src.binheap import Binheap
    bh = Binheap()
    return bh


@pytest.fixture
def heap():
    """Fixture for a heap."""
    from src.binheap import Binheap
    bh = Binheap([10, 4, 2, 6, 13, 72, 1, 49])
    return bh


def test_push_val_to_head(empty_heap):
    """Test push first val adds to the head."""
    empty_heap.push(3)
    assert empty_heap.container == [None, 3]


def test_push_val(empty_heap):
    """Test push second val adds to the tree."""
    empty_heap.push(3)
    empty_heap.push(2)
    assert empty_heap.container == [None, 3, 2]


def test_push_val_large(empty_heap):
    """Test push val for larger number."""
    empty_heap.push(3)
    empty_heap.push(2)
    empty_heap.push(1)
    empty_heap.push(16)
    assert empty_heap.container == [None, 16, 3, 1, 2]


def test_push_on_empty(empty_heap):
    """Test push on an empty list."""
    empty_heap.push(1)
    assert empty_heap.container == [None, 1]


def test_initialize_iterable(heap):
    """Test heap can be initialized with iterable."""
    assert heap.container == [None, 72, 49, 13, 10, 6, 2, 1, 4]

@@ -1194,8 +1194,194 @@
 , 1, 4%5D%0A
+%0A%0Adef test_display(heap):%0A    %22%22%22Test the display method.%22%22%22%0A    tree = '    72 %5Cn  49 13 %5Cn 10 6 2 1 %5Cn4 %5Cn'%0A    print(heap.display())%0A    print(tree)%0A    assert heap.display() == tree%0A

test the display method