def test_parse_possible(self): computed_tree = Ast.from_string("M_1 p", "K").root expected_tree = nodes.Possible("1", nodes.Proposition("p")) self.assertEqual(computed_tree, expected_tree)
def test_parse_intention(self): computed_tree = Ast.from_string("I p", "KI").root expected_tree = nodes.Implicit(nodes.Proposition("p")) self.assertEqual(computed_tree, expected_tree)
def test_parse_knowledge_with_brackets(self): computed_tree = Ast.from_string("(K_1 p)", "K").root expected_tree = nodes.Knowledge("1", nodes.Proposition("p")) self.assertEqual(computed_tree, expected_tree)
def test_parse_double_knowledge(self): computed_tree = Ast.from_string("K_1 K_1 p", "K").root expected_tree = nodes.Knowledge( "1", nodes.Knowledge("1", nodes.Proposition("p"))) self.assertEqual(computed_tree, expected_tree)
def test_parse_everybody(self): computed_tree = Ast.from_string("E p", "KEC").root expected_tree = nodes.Everybody(nodes.Proposition("p")) self.assertEqual(computed_tree, expected_tree)
def test_parse_common(self): computed_tree = Ast.from_string("C p", "KEC").root expected_tree = nodes.Common(nodes.Proposition("p")) self.assertEqual(computed_tree, expected_tree)
def test_parse_double_negation(self): computed_tree = Ast.from_string("~ ~ p", "K").root expected_tree = nodes.Negation(nodes.Negation(nodes.Proposition("p"))) self.assertEqual(computed_tree, expected_tree)
def test_parse_biimplication(self): computed_tree = Ast.from_string("p <-> q", "K").root expected_tree = nodes.BiImplication(nodes.Proposition("p"), nodes.Proposition("q")) self.assertEqual(computed_tree, expected_tree)
def test_parse_disjunction(self): computed_tree = Ast.from_string("p | q", "K").root expected_tree = nodes.Disjunction(nodes.Proposition("p"), nodes.Proposition("q")) self.assertEqual(computed_tree, expected_tree)