1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/test_table.py Sun Jan 15 23:37:14 2012 +0100
1.3 @@ -0,0 +1,38 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +from ImprovedTableParser import parse
1.7 +
1.8 +table = """<tablestyle="border: 2px solid red; border-collapse: collapse;" rowstyle="background-color: #f77;">
1.9 +Test||Outcome||Comments
1.10 +==
1.11 +Colspan
1.12 +||<colspan="2"> Test a column with attributes
1.13 +==
1.14 +Normal || <style="
1.15 +text-align: center" colspan=1> Three columns || Adjacent column
1.16 +==
1.17 +Split
1.18 +|| Three columns
1.19 +|| Separate lines
1.20 +==
1.21 + * Item #1
1.22 + * Item #2
1.23 +||
1.24 + * Item #A
1.25 +|| Not a list
1.26 +"""
1.27 +
1.28 +attrs, rows = parse(table)
1.29 +
1.30 +print table
1.31 +print attrs
1.32 +print rows
1.33 +print len(rows) == 5, ": length is", len(rows), "==", 5
1.34 +print
1.35 +for (row_attrs, columns), expected in zip(rows, [3, 2, 3, 3, 3]):
1.36 + print row_attrs
1.37 + print columns
1.38 + print len(columns) == expected, ": length is", len(columns), "==", expected
1.39 + print
1.40 +
1.41 +# vim: tabstop=4 expandtab shiftwidth=4