MoinSupport

Annotated tests/test_regions.py

118:791ab8b6dd9d
2015-01-28 Paul Boddie Merged changes from the default branch. recurrences
paul@25 1
#!/usr/bin/env python
paul@25 2
paul@25 3
from MoinSupport import getRegions, getFragments
paul@25 4
paul@25 5
s = """
paul@25 6
Test some shared content...
paul@25 7
paul@25 8
{{{#!MoinShare fragment=101
paul@25 9
Hello!
paul@25 10
paul@25 11
This is ''testing'' shared content.
paul@25 12
}}}
paul@25 13
paul@25 14
{{{#!html fragment=100 moinshare
paul@25 15
<table>
paul@25 16
<tr>
paul@25 17
<td>Test some <strong>HTML</strong> content.</td>
paul@25 18
<td>This is a table.</td>
paul@25 19
</tr>
paul@25 20
</table>
paul@25 21
}}}
paul@25 22
paul@25 23
Some trailing content.
paul@25 24
"""
paul@25 25
paul@25 26
regions = getRegions(s)
paul@25 27
fragments = getFragments(s)
paul@25 28
expected = 2
paul@25 29
paul@25 30
print regions
paul@25 31
print
paul@25 32
print len(regions) == expected, ": length is", len(regions), "==", expected
paul@25 33
print
paul@25 34
print fragments
paul@25 35
print
paul@25 36
print len(fragments) == expected, ": length is", len(fragments), "==", expected
paul@25 37
paul@25 38
regions = getRegions(s, True)
paul@25 39
fragments = getFragments(s, True)
paul@25 40
expected = 5
paul@25 41
paul@25 42
print regions
paul@25 43
print
paul@25 44
print len(regions) == expected, ": length is", len(regions), "==", expected
paul@25 45
print
paul@25 46
print fragments
paul@25 47
print
paul@25 48
print len(fragments) == expected, ": length is", len(fragments), "==", expected
paul@25 49
paul@25 50
# vim: tabstop=4 expandtab shiftwidth=4