def test_build_tree(self): expected_tree = self.build_expected_tree() decision_tree = DecisionTree() tree = decision_tree._build_tree(self.training_data) self.assertEqual(expected_tree, tree)
def test_classify_with_true_branch(self): expected_prediction = Counter({'Grape': 2}) decision_tree = DecisionTree() tree = decision_tree._build_tree(self.training_data) prediction = classify(self.training_data[2], tree) self.assertEqual(expected_prediction, prediction)