# HG changeset patch # User Paul Boddie # Date 1531848098 -7200 # Node ID 0402e78f1fa51d5f7aa15a596fd1d299de167b8c # Parent 602ab3fbb29cfaa988108dd359d758347d7fe7dd Improved the test program to more properly compare node collections and to provide better reporting. Added simplified document tree definitions for the remaining test cases. diff -r 602ab3fbb29c -r 0402e78f1fa5 tests/test_headings.tree --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_headings.tree Tue Jul 17 19:21:38 2018 +0200 @@ -0,0 +1,14 @@ +Region + Heading + Text + Block + Text + Heading + Text + Block + Text + Heading + Text + Underline + Text + Block diff -r 602ab3fbb29c -r 0402e78f1fa5 tests/test_lists.tree --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_lists.tree Tue Jul 17 19:21:38 2018 +0200 @@ -0,0 +1,34 @@ +Region + Block + Text + List + ListItem + Text + List + ListItem + Text + ListItem + Text + List + ListItem + Text + List + ListItem + Text + List + ListItem + Text + List + ListItem + Text + Block + Text + List + ListItem + Text + ListItem + Text + ListItem + Text + Block + Text diff -r 602ab3fbb29c -r 0402e78f1fa5 tests/test_lists2.tree --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_lists2.tree Tue Jul 17 19:21:38 2018 +0200 @@ -0,0 +1,57 @@ +Region + Block + Text + List + ListItem + Text + Break + List + ListItem + Text + List + ListItem + Text + ListItem + Region + Text + List + ListItem + Region + Text + ListItem + Region + Text + ListItem + Region + Block + FontStyle + Text + Text + List + ListItem + Text + Break + List + ListItem + Text + ListItem + Text + List + ListItem + Text + ListItem + Text + ListItem + Text + List + ListItem + Text + Break + List + ListItem + Text + ListItem + Text + Break + Block + Text diff -r 602ab3fbb29c -r 0402e78f1fa5 tests/test_lists2.txt --- a/tests/test_lists2.txt Tue Jul 17 19:19:59 2018 +0200 +++ b/tests/test_lists2.txt Tue Jul 17 19:21:38 2018 +0200 @@ -9,6 +9,9 @@ 1. {{{#!python motto = "Romanus eunt domus!" }}} + 1. {{{#!moin +''Romans!'' +}}} a.#18 The Romans. 1. Starting from one diff -r 602ab3fbb29c -r 0402e78f1fa5 tests/test_paragraphs.tree --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_paragraphs.tree Tue Jul 17 19:21:38 2018 +0200 @@ -0,0 +1,6 @@ +Region + Block + Text + Break + Block + Text diff -r 602ab3fbb29c -r 0402e78f1fa5 tests/test_parser.py --- a/tests/test_parser.py Tue Jul 17 19:19:59 2018 +0200 +++ b/tests/test_parser.py Tue Jul 17 19:21:38 2018 +0200 @@ -57,13 +57,17 @@ print "-" * 60 print d.prettyprint() if failing: - simple, tree = failing + print "-" * 60 + print ts + simple, tree, error = failing + print "-" * 60 + print error + print repr(simple) + print repr(tree) print "-" * 60 print tree.prettyprint() print "-" * 60 print simple.prettyprint() - print "-" * 60 - print ts print "-" * 60 print @@ -78,10 +82,11 @@ self.nodes = [] def __repr__(self): - return "Node(%r, ...)" % self.name + return "Node(%r, %r)" % (self.name, self.nodes) def prettyprint(self, indent=""): - l = [indent + self.name] + l = [] + l.append("%s%s%s" % (indent, self.name, len(self.nodes) and " nodes=%d" % len(self.nodes) or "")) for node in self.nodes: l.append(node.prettyprint(indent + " ")) return "\n".join(l) @@ -99,14 +104,17 @@ """ if other.__class__.__name__ != self.name: - return self, other + return self, other, "name" if isinstance(other, Container): for node, other_node in map(None, self.nodes, other.nodes): if node is None or other_node is None: - return self, other - if node.test(other_node): - return node, other_node + return self, other, node is None and "simple" or "document" + t = node.test(other_node) + if t: + return t + elif self.nodes: + return self, other, "empty" return None diff -r 602ab3fbb29c -r 0402e78f1fa5 tests/test_region_endings.tree --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_region_endings.tree Tue Jul 17 19:21:38 2018 +0200 @@ -0,0 +1,7 @@ +Region + Block + Text + Region + Text + Block + Text diff -r 602ab3fbb29c -r 0402e78f1fa5 tests/test_regions.tree --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_regions.tree Tue Jul 17 19:21:38 2018 +0200 @@ -0,0 +1,12 @@ +Region + Block + Text + Region + Block + Text + Region + Text + Block + Text + Block + Text diff -r 602ab3fbb29c -r 0402e78f1fa5 tests/test_regions_inline.tree --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_regions_inline.tree Tue Jul 17 19:21:38 2018 +0200 @@ -0,0 +1,6 @@ +Region + Block + Text + Region + Text + Text diff -r 602ab3fbb29c -r 0402e78f1fa5 tests/test_regions_opaque.tree --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_regions_opaque.tree Tue Jul 17 19:21:38 2018 +0200 @@ -0,0 +1,7 @@ +Region + Block + Text + Region + Text + Block + Text diff -r 602ab3fbb29c -r 0402e78f1fa5 tests/test_rules.tree --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_rules.tree Tue Jul 17 19:21:38 2018 +0200 @@ -0,0 +1,12 @@ +Region + Block + Text + Rule + Block + Text + Rule + Block + Text + Rule + Block + Text diff -r 602ab3fbb29c -r 0402e78f1fa5 tests/test_table_parser.tree --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_table_parser.tree Tue Jul 17 19:21:38 2018 +0200 @@ -0,0 +1,21 @@ +Region + Block + Text + Break + Region + Table + TableRow + TableCell + FontStyle + Text + Text + TableCell + Text + TableRow + TableCell + Text + TableCell + Text + Break + Block + Text diff -r 602ab3fbb29c -r 0402e78f1fa5 tests/test_tables.tree --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_tables.tree Tue Jul 17 19:21:38 2018 +0200 @@ -0,0 +1,48 @@ +Region + Table + TableRow + TableCell + TableAttrs + TableAttr + TableAttr + TableAttr + TableAttr + TableAttr + Text + TableCell + Text + TableRow + TableCell + Text + FontStyle + Text + Text + TableCell + TableAttrs + TableAttr + Text + TableAttr + Text + FontStyle + Text + Text + Break + Block + Text + Block + Text + Text + Text + Table + TableRow + TableCell + Text + Break + Table + TableRow + TableCell + Text + TableRow + TableCell + Text + Block