'Base rule induction learner test. To pass the test, all base
components are checked, including preprocessors, top-level
control procedure elements (covering algorithm, rule stopping,
data stopping), and bottom-level search procedure controller
(rule finder).
Every learner that extends _RuleLearner should override the fit
method. It should at this point not yet be available (exception
raised).'

def test_base_RuleLearner(self):

    base_rule_learner = _RuleLearner()
    self.assertEqual(len(list(base_rule_learner.active_preprocessors)), 3)
    preprocessor_types = [type(x) for x in base_rule_learner.active_preprocessors]
    self.assertIn(HasClass, preprocessor_types)
    self.assertIn(Impute, preprocessor_types)
    base_rule_learner.domain = self.iris.domain
    base_rule_learner.find_rules(self.iris.X, self.iris.Y.astype(int), None, None, [], self.iris.domain)
    self.assertTrue(hasattr(base_rule_learner, 'data_stopping'))
    self.assertTrue(hasattr(base_rule_learner, 'cover_and_remove'))
    self.assertTrue(hasattr(base_rule_learner, 'rule_stopping'))
    new_rule = Rule()
    new_rule.covered_examples = np.array([True, False, True], dtype=bool)
    new_rule.target_class = None
    (X, Y, W) = base_rule_learner.exclusive_cover_and_remove(self.iris.X[:3], self.iris.Y[:3], None, new_rule)
    self.assertTrue((len(X) == len(Y) == 1))
    self.assertTrue(hasattr(base_rule_learner, 'rule_finder'))
    rule_finder = base_rule_learner.rule_finder
    self.assertIsInstance(rule_finder, RuleHunter)
    self.assertTrue(hasattr(rule_finder, 'search_algorithm'))
    self.assertTrue(hasattr(rule_finder, 'search_strategy'))
    self.assertTrue(hasattr(rule_finder, 'quality_evaluator'))
    self.assertTrue(hasattr(rule_finder, 'complexity_evaluator'))
    self.assertTrue(hasattr(rule_finder, 'general_validator'))
    self.assertTrue(hasattr(rule_finder, 'significance_validator'))
