~oubiwann/pylisp-ng/ast-lisp

« back to all changes in this revision

Viewing changes to astlisp/tests/test_sprint.py

  • Committer: Duncan McGreggor
  • Date: 2011-05-15 20:24:57 UTC
  • Revision ID: duncan@ubuntu.com-20110515202457-k45w9criii606709
2011.05.15

* Commended out tests that test code that will be re-implemented.
* Added another example to the AST sandbox; this one consolidates some of the
logic in the first example, and removes redundancies (stuff provided by the
AST methods and classes).
* Renamed getSExp to sexp_factory.
* Deleted a large chunk of the old symbol module.
* Added operator-identifying code to the symbol module and renamed it mapper.
* Updated the lisp mapping to use AST.
* Added mapper unit tests.
* Added a build_ast function in the parser module.
* Added update methods to various parser classes.
* Moved get_node to a module-level function.
* Deleted old parser code.
* Removed the "new parser" unit tests.
* Added an s-expression parser that uses the AST node parser class.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
            '(+ 1 (+ 2 (+ 3 4)))',
68
68
            ]
69
69
 
 
70
    @unittest.skip("pending re-implementation")
70
71
    def test_ParserSExpression(self):
71
72
        """
72
73
 
79
80
            result = sexpr.getTree(s).lstrip()
80
81
            self.assertEquals(result, expected)
81
82
 
 
83
    @unittest.skip("pending re-implementation")
82
84
    def test_SExpression(self):
83
85
        s = sexpr.SExpression(self.exprs[2])
84
86
        self.assertEquals(sexpr.getTree(s).lstrip(), ans2.lstrip())
85
87
 
 
88
    @unittest.skip("pending re-implementation")
86
89
    def test_Graph(self):
87
90
        s = sexpr.SExpression(self.exprs[2])
88
91
        graph = s.getGraph()
89
92
        self.assertEquals(sexpr.getTree(graph).lstrip(), ans2.lstrip())
90
 
 
91
 
 
92
 
def test_suite():
93
 
    return unittest.TestSuite((
94
 
        unittest.makeSuite(SExpressionPrintTestCase),
95
 
        ))
96
 
 
97
 
 
98
 
def run_suite(verbosity=1):
99
 
    runner = unittest.TextTestRunner(verbosity=verbosity)
100
 
    runner.run(test_suite())
101
 
 
102
 
if __name__ == '__main__':
103
 
    run_suite()