def test_register_and_remove_constraint(self): self._constraints_absence_check() constraint_id = 1 constraint = IdenticalConstraint(groups=self.identical_groups) self.teacher.register_constraint(constraint_id, constraint) user_rule = self.teacher.get_rule() wanted_constraint = UserConstraintIntent( IdenticalConstraint.TYPE, self.identical_groups, constraint_id=constraint_id ) assert wanted_constraint == user_rule.constraints[0] self._constraints_presence_check() self.teacher.remove_constraint(constraint_id) self._constraints_absence_check()
def test_verify_fail(self): ic = IdenticalConstraint(params_checking=False) assert not ic.verify(['comp1', 'hello', 'comp1'], {})
def test_verify_success(self): ic = IdenticalConstraint(params_checking=False) assert ic.verify(['comp1', 'comp1', 'comp1'], {})
def test_get_group_count(self): assert IdenticalConstraint.get_groups_count() == (2, None)
def test_get_param_names(self): assert not IdenticalConstraint.get_param_names()
def _register_identical_constraint(self, constraint_id=1): constraint = IdenticalConstraint(groups=self.identical_groups) self.teacher.register_constraint(constraint_id, constraint)
def test_verify_fail(self): ic = IdenticalConstraint(params_checking=False) assert not ic.verify(['comp1', 'hello', 'comp1'])
def test_verify_success(self): ic = IdenticalConstraint(params_checking=False) assert ic.verify(['comp1', 'comp1', 'comp1'])