Mercurial > p > roundup > code
annotate test/test_template_parser.py @ 1091:d870139aeb5c
more doc
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 10 Sep 2002 00:45:46 +0000 |
| parents | 9b910e8d987d |
| children |
| rev | line source |
|---|---|
| 1090 | 1 # $Id: test_template_parser.py,v 1.2 2002-09-10 00:19:55 richard Exp $ |
|
932
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2 |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3 import unittest |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4 from roundup import template_parser |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
5 |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
6 class TemplateParserTestCase(unittest.TestCase): |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
7 def testParser(self): |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
8 parser = template_parser.RoundupTemplate() |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
9 s = ''' |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
10 <table border=0 cellspacing=5 cellpadding=0> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
11 <tr> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
12 <td bgcolor="ffffea"> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
13 <property name="prop1"> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
14 <require permission="perm1"> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
15 <display call="field('prop1')"> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
16 <else> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
17 <display call="plain('prop1')"> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
18 </require> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
19 </property> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
20 </td> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
21 </tr> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
22 </table> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
23 |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
24 <table border=0 cellspacing=5 cellpadding=0> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
25 <property name="prop2"> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
26 <tr> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
27 <td class="form-label">Prop2:</td> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
28 <td class="form-text"> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
29 <require permission="perm2"> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
30 <display call="field('prop2')"> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
31 <else> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
32 <display call="plain('prop2')"> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
33 </require> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
34 </td> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
35 </tr> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
36 </property> |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
37 </table>''' |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
38 parser.feed(s) |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
39 self.assertEqual(template_parser.display(parser.structure), |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
40 '\n<table border="0" cellspacing="5" cellpadding="0">\n <tr>\n <td bgcolor="ffffea">\n PROPERTY: [(\'name\', \'prop1\')] \n TEST: [(\'permission\', \'perm1\')]\n OK... \n DISPLAY: [(\'call\', "field(\'prop1\')")] \n FAIL... \n DISPLAY: [(\'call\', "plain(\'prop1\')")] \n \n \n </td>\n </tr>\n</table>\n\n<table border="0" cellspacing="5" cellpadding="0">\n PROPERTY: [(\'name\', \'prop2\')] \n <tr>\n <td class="form-label">Prop2:</td>\n <td class="form-text">\n TEST: [(\'permission\', \'perm2\')]\n OK... \n DISPLAY: [(\'call\', "field(\'prop2\')")] \n FAIL... \n DISPLAY: [(\'call\', "plain(\'prop2\')")] \n \n </td>\n </tr>\n \n</table>') |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
41 |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
42 def suite(): |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
43 return unittest.makeSuite(TemplateParserTestCase, 'test') |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
44 |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
45 |
|
a43fa69c1b70
fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
46 # vim: set filetype=python ts=4 sw=4 et si |
