From: Tim Vieira Date: Tue, 6 Aug 2013 20:12:56 +0000 (-0400) Subject: added post processors tests. X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=f2f6cd8c9cb44e982a8ec71775a27f9337b3b942;p=dyna2 added post processors tests. --- diff --git a/.coveragerc b/.coveragerc index 26f6420..20c10dc 100644 --- a/.coveragerc +++ b/.coveragerc @@ -28,6 +28,3 @@ exclude_lines = ignore_errors = True - -[html] -directory = coverage_html_report diff --git a/src/Dyna/Backend/Python/debug.py b/src/Dyna/Backend/Python/debug.py index e095aee..8f4ffe2 100644 --- a/src/Dyna/Backend/Python/debug.py +++ b/src/Dyna/Backend/Python/debug.py @@ -4,7 +4,7 @@ Generates a visual representation of a Dyna program's rules after the normalization process. """ -import re, os, shutil, webbrowser +import re, os, webbrowser from collections import defaultdict from utils import read_anf, path from config import dynahome @@ -36,9 +36,6 @@ else: return pretty, offset -cssfile = dynahome / 'src' / 'Dyna' / 'Backend' / 'Python' / 'debug-pygments.css' -jsfile = dynahome / 'external' / 'prototype-1.6.0.3.js' - class Edge(object): def __init__(self, head, label, body): self.head = head @@ -234,17 +231,9 @@ def main(dynafile, browser=True): dynafile = path(dynafile) -# if not os.path.exists(cssfile) or not os.path.exists(jsfile): -# print 'Debug must be run from the root of the Dyna source tree.' -# return - d = dynafile + '.d' d.mkdir_p() - # XXX: this is sort of silly - #shutil.copyfile(cssfile, d + '/debug-pygments.css') - #shutil.copyfile(jsfile, d + '/prototype.js') - with file(d / 'index.html', 'wb') as html: print >> html, HEADING diff --git a/src/Dyna/Backend/Python/post/__init__.py b/src/Dyna/Backend/Python/post/__init__.py index c6ecaac..135c869 100644 --- a/src/Dyna/Backend/Python/post/__init__.py +++ b/src/Dyna/Backend/Python/post/__init__.py @@ -1,5 +1,5 @@ import re -from utils import get_module +from utils import get_module, true, false, null available = 'trace', 'dump_solution', 'draw_circuit', 'graph', 'save', 'draw' diff --git a/src/Dyna/Backend/Python/post/draw_circuit.py b/src/Dyna/Backend/Python/post/draw_circuit.py index 71b8e82..a704ce0 100644 --- a/src/Dyna/Backend/Python/post/draw_circuit.py +++ b/src/Dyna/Backend/Python/post/draw_circuit.py @@ -116,14 +116,14 @@ class draw_circuit(object): if cls == 'edge': # split on arrow -> u, v = x.split('->') - print 'edge:', i, u, v +# print 'edge:', i, u, v else: if x in E: - print 'crux', i, x, +# print 'crux', i, x, rule = interp.rules[int(E[x].label)] x = '%s %% rule %s' % (rule.src, rule.index) - else: - print 'node:', i, x +# else: +# print 'node:', i, x return '%s%s' % (i, cls, x, q) diff --git a/test/repl/post.dynadoc b/test/repl/post.dynadoc new file mode 100644 index 0000000..14c7335 --- /dev/null +++ b/test/repl/post.dynadoc @@ -0,0 +1,20 @@ +> a :- b. +| b :- c. +| b :- d. +| c. + +Changes +======= +a = true. +b = true. +c = true. + +> post draw_circuit("circuit.html", open=false) + +> post dump_solution() + +Solution +======== +a. +b. +c.