示例#1
0
    def testgetconstructor(self):
        """
        We test the get_constructor method.  We send in each of the valid types and get the constructors for
        those types.  We make sure each type gets its appropriate constructor
        """

        func = Change.get_constructor("atomic")
        self.assertEqual(func, Change.atomic, msg="Failed to get atomic constructor")

        func = Change.get_constructor("node")
        self.assertEqual(func, Change.node, msg="Failed to get node constructor")

        func = Change.get_constructor("sweep")
        self.assertEqual(func, Change.sweep, msg="Failed to get sweep constructor")

        func = Change.get_constructor("arm")
        self.assertEqual(func, Change.arm, msg="Failed to get arm constructor")

        # -------- Try invalid option
        self.assertRaises(ValueError, Change.get_constructor, "super_type")