2018-07-17 | Paul Boddie | raw files shortlog changelog graph | 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. | |
tests/test_headings.tree (file) tests/test_lists.tree (file) tests/test_lists2.tree (file) tests/test_lists2.txt (file) tests/test_paragraphs.tree (file) tests/test_parser.py (file) tests/test_region_endings.tree (file) tests/test_regions.tree (file) tests/test_regions_inline.tree (file) tests/test_regions_opaque.tree (file) tests/test_rules.tree (file) tests/test_table_parser.tree (file) tests/test_tables.tree (file) |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tests/test_headings.tree Tue Jul 17 19:21:38 2018 +0200 1.3 @@ -0,0 +1,14 @@ 1.4 +Region 1.5 + Heading 1.6 + Text 1.7 + Block 1.8 + Text 1.9 + Heading 1.10 + Text 1.11 + Block 1.12 + Text 1.13 + Heading 1.14 + Text 1.15 + Underline 1.16 + Text 1.17 + Block
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/tests/test_lists.tree Tue Jul 17 19:21:38 2018 +0200 2.3 @@ -0,0 +1,34 @@ 2.4 +Region 2.5 + Block 2.6 + Text 2.7 + List 2.8 + ListItem 2.9 + Text 2.10 + List 2.11 + ListItem 2.12 + Text 2.13 + ListItem 2.14 + Text 2.15 + List 2.16 + ListItem 2.17 + Text 2.18 + List 2.19 + ListItem 2.20 + Text 2.21 + List 2.22 + ListItem 2.23 + Text 2.24 + List 2.25 + ListItem 2.26 + Text 2.27 + Block 2.28 + Text 2.29 + List 2.30 + ListItem 2.31 + Text 2.32 + ListItem 2.33 + Text 2.34 + ListItem 2.35 + Text 2.36 + Block 2.37 + Text
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/tests/test_lists2.tree Tue Jul 17 19:21:38 2018 +0200 3.3 @@ -0,0 +1,57 @@ 3.4 +Region 3.5 + Block 3.6 + Text 3.7 + List 3.8 + ListItem 3.9 + Text 3.10 + Break 3.11 + List 3.12 + ListItem 3.13 + Text 3.14 + List 3.15 + ListItem 3.16 + Text 3.17 + ListItem 3.18 + Region 3.19 + Text 3.20 + List 3.21 + ListItem 3.22 + Region 3.23 + Text 3.24 + ListItem 3.25 + Region 3.26 + Text 3.27 + ListItem 3.28 + Region 3.29 + Block 3.30 + FontStyle 3.31 + Text 3.32 + Text 3.33 + List 3.34 + ListItem 3.35 + Text 3.36 + Break 3.37 + List 3.38 + ListItem 3.39 + Text 3.40 + ListItem 3.41 + Text 3.42 + List 3.43 + ListItem 3.44 + Text 3.45 + ListItem 3.46 + Text 3.47 + ListItem 3.48 + Text 3.49 + List 3.50 + ListItem 3.51 + Text 3.52 + Break 3.53 + List 3.54 + ListItem 3.55 + Text 3.56 + ListItem 3.57 + Text 3.58 + Break 3.59 + Block 3.60 + Text
4.1 --- a/tests/test_lists2.txt Tue Jul 17 19:19:59 2018 +0200 4.2 +++ b/tests/test_lists2.txt Tue Jul 17 19:21:38 2018 +0200 4.3 @@ -9,6 +9,9 @@ 4.4 1. {{{#!python 4.5 motto = "Romanus eunt domus!" 4.6 }}} 4.7 + 1. {{{#!moin 4.8 +''Romans!'' 4.9 +}}} 4.10 a.#18 The Romans. 4.11 4.12 1. Starting from one
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/tests/test_paragraphs.tree Tue Jul 17 19:21:38 2018 +0200 5.3 @@ -0,0 +1,6 @@ 5.4 +Region 5.5 + Block 5.6 + Text 5.7 + Break 5.8 + Block 5.9 + Text
6.1 --- a/tests/test_parser.py Tue Jul 17 19:19:59 2018 +0200 6.2 +++ b/tests/test_parser.py Tue Jul 17 19:21:38 2018 +0200 6.3 @@ -57,13 +57,17 @@ 6.4 print "-" * 60 6.5 print d.prettyprint() 6.6 if failing: 6.7 - simple, tree = failing 6.8 + print "-" * 60 6.9 + print ts 6.10 + simple, tree, error = failing 6.11 + print "-" * 60 6.12 + print error 6.13 + print repr(simple) 6.14 + print repr(tree) 6.15 print "-" * 60 6.16 print tree.prettyprint() 6.17 print "-" * 60 6.18 print simple.prettyprint() 6.19 - print "-" * 60 6.20 - print ts 6.21 print "-" * 60 6.22 print 6.23 6.24 @@ -78,10 +82,11 @@ 6.25 self.nodes = [] 6.26 6.27 def __repr__(self): 6.28 - return "Node(%r, ...)" % self.name 6.29 + return "Node(%r, %r)" % (self.name, self.nodes) 6.30 6.31 def prettyprint(self, indent=""): 6.32 - l = [indent + self.name] 6.33 + l = [] 6.34 + l.append("%s%s%s" % (indent, self.name, len(self.nodes) and " nodes=%d" % len(self.nodes) or "")) 6.35 for node in self.nodes: 6.36 l.append(node.prettyprint(indent + " ")) 6.37 return "\n".join(l) 6.38 @@ -99,14 +104,17 @@ 6.39 """ 6.40 6.41 if other.__class__.__name__ != self.name: 6.42 - return self, other 6.43 + return self, other, "name" 6.44 6.45 if isinstance(other, Container): 6.46 for node, other_node in map(None, self.nodes, other.nodes): 6.47 if node is None or other_node is None: 6.48 - return self, other 6.49 - if node.test(other_node): 6.50 - return node, other_node 6.51 + return self, other, node is None and "simple" or "document" 6.52 + t = node.test(other_node) 6.53 + if t: 6.54 + return t 6.55 + elif self.nodes: 6.56 + return self, other, "empty" 6.57 6.58 return None 6.59
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/tests/test_region_endings.tree Tue Jul 17 19:21:38 2018 +0200 7.3 @@ -0,0 +1,7 @@ 7.4 +Region 7.5 + Block 7.6 + Text 7.7 + Region 7.8 + Text 7.9 + Block 7.10 + Text
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/tests/test_regions.tree Tue Jul 17 19:21:38 2018 +0200 8.3 @@ -0,0 +1,12 @@ 8.4 +Region 8.5 + Block 8.6 + Text 8.7 + Region 8.8 + Block 8.9 + Text 8.10 + Region 8.11 + Text 8.12 + Block 8.13 + Text 8.14 + Block 8.15 + Text
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/tests/test_regions_inline.tree Tue Jul 17 19:21:38 2018 +0200 9.3 @@ -0,0 +1,6 @@ 9.4 +Region 9.5 + Block 9.6 + Text 9.7 + Region 9.8 + Text 9.9 + Text
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/tests/test_regions_opaque.tree Tue Jul 17 19:21:38 2018 +0200 10.3 @@ -0,0 +1,7 @@ 10.4 +Region 10.5 + Block 10.6 + Text 10.7 + Region 10.8 + Text 10.9 + Block 10.10 + Text
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/tests/test_rules.tree Tue Jul 17 19:21:38 2018 +0200 11.3 @@ -0,0 +1,12 @@ 11.4 +Region 11.5 + Block 11.6 + Text 11.7 + Rule 11.8 + Block 11.9 + Text 11.10 + Rule 11.11 + Block 11.12 + Text 11.13 + Rule 11.14 + Block 11.15 + Text
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/tests/test_table_parser.tree Tue Jul 17 19:21:38 2018 +0200 12.3 @@ -0,0 +1,21 @@ 12.4 +Region 12.5 + Block 12.6 + Text 12.7 + Break 12.8 + Region 12.9 + Table 12.10 + TableRow 12.11 + TableCell 12.12 + FontStyle 12.13 + Text 12.14 + Text 12.15 + TableCell 12.16 + Text 12.17 + TableRow 12.18 + TableCell 12.19 + Text 12.20 + TableCell 12.21 + Text 12.22 + Break 12.23 + Block 12.24 + Text
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/tests/test_tables.tree Tue Jul 17 19:21:38 2018 +0200 13.3 @@ -0,0 +1,48 @@ 13.4 +Region 13.5 + Table 13.6 + TableRow 13.7 + TableCell 13.8 + TableAttrs 13.9 + TableAttr 13.10 + TableAttr 13.11 + TableAttr 13.12 + TableAttr 13.13 + TableAttr 13.14 + Text 13.15 + TableCell 13.16 + Text 13.17 + TableRow 13.18 + TableCell 13.19 + Text 13.20 + FontStyle 13.21 + Text 13.22 + Text 13.23 + TableCell 13.24 + TableAttrs 13.25 + TableAttr 13.26 + Text 13.27 + TableAttr 13.28 + Text 13.29 + FontStyle 13.30 + Text 13.31 + Text 13.32 + Break 13.33 + Block 13.34 + Text 13.35 + Block 13.36 + Text 13.37 + Text 13.38 + Text 13.39 + Table 13.40 + TableRow 13.41 + TableCell 13.42 + Text 13.43 + Break 13.44 + Table 13.45 + TableRow 13.46 + TableCell 13.47 + Text 13.48 + TableRow 13.49 + TableCell 13.50 + Text 13.51 + Block