def test_clausal_evaluation(self):
        """ Tests the evaluation of a selection of clauses. """
        eq = Equation('({1})')  # Equation object to test.
        fke_clause_true = Mock()  # Fake clause to return true
        fke_clause_true.evaluate = MagicMock(return_value=True)
        fke_clause_false = Mock()  # Fake clause to return false
        fke_clause_false.evaluate = MagicMock(return_value=False)

        eq._clauses = [fke_clause_true, fke_clause_false, fke_clause_true]
        res = eq.get_clause_evaluation({})
        assert (res[0] and (not res[1]) and res[2])

        eq._clauses = [fke_clause_true, fke_clause_true, fke_clause_true]
        res = eq.get_clause_evaluation({})
        assert (res[0] and res[1] and res[2])

        eq._clauses = [fke_clause_false, fke_clause_false, fke_clause_false]
        res = eq.get_clause_evaluation({})
        assert not (res[0] or res[1] or res[2])
    def test_gen_clause_list(self, gen_clause):
        """ Ensures the method generates the set of clauses. """
        gen_clause.return_value = "Fake3lause"  # Fake the generation of a clause node.
        eq = Equation('({1})')

        eq._unparsed_equation = '(1234).(1234).(9876)'  # Setup some fake clauses
        expected_calls = [call('1234'), call('1234'), call('9876')]
        eq.generate_clauses()
        eq._generate_clause.assert_has_calls(expected_calls)

        eq._clauses = []  # Reset clauses
        eq._unparsed_equation = '(1234)'  # Setup a fake clause
        expected_calls = [call('1234')]
        eq.generate_clauses()
        eq._generate_clause.assert_has_calls(expected_calls)

        eq._clauses = []  # Reset clauses
        eq._unparsed_equation = ''  # Setup no fake clauses
        expected_calls = []
        eq.generate_clauses()
        eq._generate_clause.assert_has_calls(expected_calls)