How to parameterize unittests
Steven D'Aprano
steve at pearwood.info
Thu Apr 14 11:05:07 EDT 2016
On Fri, 15 Apr 2016 12:08 am, Antoon Pardon wrote:
>
> I have a unittest for my avltree module.
>
> Now I want this unittest to also run on a subclass of avltree.
> How can I organise this, so that I can largely reuse the
> original TestCase?
class Test_AVLTree(unittest.TestCase):
tree = avltree
def test_empty_tree_is_false(self):
instance = self.tree()
self.assertFalse(instance)
class Test_MySubclassTree(Test_AVLTree):
tree = My_Subclass_Tree
--
Steven
More information about the Python-list
mailing list