def test_prune_rule_2(self): df = pd.read_csv('tests/test_files/mushroom.csv', encoding='utf-8', delimiter=';') ds = DictDataset(0, df) l = Literal('a5', 'in', ['c', 'f', 'm', 'p', 's', 'y']) rule = Rule() rule.add_literal(l) rule = ds.prune_rule(rule) self.assertEqual("a5 in ['c', 'f', 'm', 'p', 's', 'y']", rule.to_string())
def test_prune_rule_1(self): df = pd.read_csv('tests/test_files/testfile_3.csv', encoding='utf-8', delimiter=';') l = Literal('Sex', 'in', 'Female') l2 = Literal('Sex', 'in', 'Male') rule = Rule() rule.add_literal(l) rule.add_literal(l2) ds = DictDataset(1, df) rule = ds.prune_rule(rule) self.assertEqual("Sex in Female", rule.to_string())