Source

pyfiboheap / tests / test_iter.py

import fiboheaps
import unittest

class TestIter(unittest.TestCase):
    def setUp(self):
        self.heap = fiboheaps.FibonacciHeap()
        self.sequence = list(range(10))
        self.heap.extend(self.sequence)

    def testLen(self):
        self.assertEquals(len(self.sequence), len(self.heap))

    def testIterEasy(self):
        self.assertSetEqual(
                set(self.sequence),
                set(iter(self.heap)))

    def testIterHard(self):
        self.heap.peek() # forces consolidate
        self.assertSetEqual(
                set(self.sequence),
                set(iter(self.heap)))