MoinLight

Change of tests/test_parser.py

12:575c7b5d97ac
tests/test_parser.py
     1.1 --- a/tests/test_parser.py	Sat Apr 29 17:47:03 2017 +0200
     1.2 +++ b/tests/test_parser.py	Sat Apr 29 18:20:55 2017 +0200
     1.3 @@ -3,7 +3,9 @@
     1.4  from moinformat import parse
     1.5  from moinformat.serialisers import serialise, HTMLSerialiser
     1.6  
     1.7 -s0 = """\
     1.8 +sl = []
     1.9 +
    1.10 +sl.append("""\
    1.11  Hello
    1.12  {{{{#!wiki
    1.13  A region
    1.14 @@ -17,9 +19,9 @@
    1.15   * Item 1
    1.16   * Item 2
    1.17  XXX
    1.18 -"""
    1.19 +""")
    1.20  
    1.21 -s1 = """\
    1.22 +sl.append("""\
    1.23  Hello
    1.24  {{{{#!xxx
    1.25  A region
    1.26 @@ -29,9 +31,9 @@
    1.27  End
    1.28  }}}}
    1.29  XXX
    1.30 -"""
    1.31 +""")
    1.32  
    1.33 -s2 = """\
    1.34 +sl.append("""\
    1.35  Hello
    1.36  {{{{
    1.37  Start
    1.38 @@ -39,34 +41,40 @@
    1.39  Still in region
    1.40  }}}}
    1.41  End
    1.42 -"""
    1.43 +""")
    1.44 +
    1.45 +sl.append("""\
    1.46 +Hello {{{world}}} again""")
    1.47  
    1.48 -s3 = """\
    1.49 -Hello {{{world}}} again"""
    1.50 +sl.append("""\
    1.51 +XXX
    1.52 +
    1.53 +YYY""")
    1.54  
    1.55 -d0 = parse(s0)
    1.56 -d1 = parse(s1)
    1.57 -d2 = parse(s2)
    1.58 -d3 = parse(s3)
    1.59 +sl.append("""\
    1.60 +XXX
    1.61 +----
    1.62 +YYY
    1.63 + ----still a rule
    1.64 +also still a rule----
    1.65 +EOF""")
    1.66  
    1.67 -ns0 = serialise(d0)
    1.68 -ns1 = serialise(d1)
    1.69 -ns2 = serialise(d2)
    1.70 -ns3 = serialise(d3)
    1.71 +dl = map(parse, sl)
    1.72 +nl = map(serialise, dl)
    1.73  
    1.74 -for s, n in zip([s0, s1, s2, s3], [ns0, ns1, ns2, ns3]):
    1.75 +for s, n in zip(sl, nl):
    1.76      print n == s
    1.77      print "----"
    1.78      print n
    1.79      print "----"
    1.80  
    1.81 -for d in [d0, d1, d2, d3]:
    1.82 +for d in dl:
    1.83      print
    1.84      print "----"
    1.85      print serialise(d, HTMLSerialiser)
    1.86      print "----"
    1.87  
    1.88 -for d in [d0, d1, d2, d3]:
    1.89 +for d in dl:
    1.90      print
    1.91      print "----"
    1.92      print d.prettyprint()