1. Enrico Franchi
  2. pyfiboheap

Source

pyfiboheap / tests / test_oneelement.py

import fiboheaps
import unittest

class TestFibonacciOneElement(unittest.TestCase):
    def setUp(self):
        self.heap = fiboheaps.FibonacciHeap()
        self.element = 'spam'
        self.heap.push(self.element)

    def testPeek(self):
        var = self.heap.peek()
        self.assertEquals(self.element, var)
        self.assertEquals(1, len(self.heap))

    def testRemoveElement(self):
        self.heap.pop()
        self.assertEquals(0, len(self.heap))

    def testExtend(self):
        lst = ['foo', 'bar', 'baz']
        full_lst = sorted([self.element] + lst)
        self.heap.extend(lst)
        self.assertEquals(len(full_lst), len(self.heap))