I am currently learning python in preperation for a class during the summer and started by implementing various types of heaps and data structures based on priorities.
I started writing a unit test kit for a project, but ran into difficulties creating a common unit test, which only checks the interface and doesn't notice the actual implementation.
I am wondering if it is possible to do something like this.
suite = HeapTestSuite(BinaryHeap()) suite.run() suite = HeapTestSuite(BinomialHeap()) suite.run()
What I'm doing now just feels ... wrong (multiple inheritance? ACK!) ..
class TestHeap: def reset_heap(self): self.heap = None def test_insert(self): self.reset_heap()
python unit-testing interface test-suite
Nicholas mancuso
source share