def _check_ineq_add_constraint(self, drv):
        self.asm.add('driver', drv)

        try:
            drv.add_constraint('comp1.b==comp1.a')
        except Exception as err:
            self.assertEqual(str(err), "driver: Constraints require an explicit comparator (=, <, >, <=, or >=)")
        else:
            self.fail("Exception expected")

        self.assertEqual(len(drv.get_ineq_constraints()), 0)
        drv.add_constraint(' comp1.a > comp1.b')

        try:
            drv.add_constraint('comp1.a>comp1.b')
        except Exception as err:
            self.assertEqual(str(err),
                             'driver: A constraint of the form "comp1.a>comp1.b" already exists '
                             'in the driver. Add failed.')
        else:
            self.fail("Exception Expected")

        self.assertEqual(len(drv.get_ineq_constraints()), 1)
        drv.remove_constraint(' comp1.a>  comp1.b  ')
        self.assertEqual(len(drv.get_ineq_constraints()), 0)
        try:
            drv.remove_constraint('comp1.bogus < comp1.d')
        except Exception as err:
            self.assertEqual(str(err),
                "driver: Constraint 'comp1.bogus<comp1.d' was not found. Remove failed.")
        else:
            self.fail("Exception expected")
        drv.add_constraint(' comp1.a > comp1.b')
        self.assertEqual(len(drv.get_ineq_constraints()), 1)

        drv.add_constraint('comp1.b < comp1.c', name='foobar')
        self.assertEqual(len(drv.get_ineq_constraints()), 2)

        try:
            drv.add_constraint('comp1.b < comp1.a', name='foobar')
        except Exception as err:
            self.assertEqual(str(err), 'driver: A constraint named "foobar" already exists in the driver. Add failed.')
        else:
            self.fail("Exception expected")

        self.assertEqual(len(drv.get_ineq_constraints()), 2)

        drv.remove_constraint('foobar')
        self.assertEqual(len(drv.get_ineq_constraints()), 1)

        drv.clear_constraints()

        self.assertEqual(len(drv.get_ineq_constraints()), 0)

        try:
            drv.add_constraint('comp1.b < comp1.qq')
        except __HOLE__ as err:
            self.assertEqual(str(err),
                "Right hand side of constraint 'comp1.b < comp1.qq' has invalid variables 'comp1.qq'")
        else:
            self.fail('expected ValueError')
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/test/test_hasconstraints.py/HasConstraintsTestCase._check_ineq_add_constraint