92
92
class TestHeadings(ParserTestCase):
93
93
""" Test various heading problems """
95
def class_setup(self):
96
""" Require show_section_numbers = 0 to workaround counter
97
global state saved in request.
99
self.config = self.TestConfig(show_section_numbers=0)
101
def class_teardown(self):
95
104
def testIgnoreWhiteSpaceAroundHeadingText(self):
96
105
""" parser.wiki: ignore white space around heading text
161
179
(u'<<DateTime(2003-03-03T03:03:03)>>', '2003-03-03 03:03:03'),
162
180
(u'<<DateTime(2000-01-01T00:00:00Z)>>', '2000-01-01 00:00:00'), # works for Europe/Vilnius
163
181
(u'<<Date(2002-02-02T01:02:03Z)>>', '2002-02-02'),
164
#(u'<<DateTime(1970-01-06T00:00:00)>>', '1970-01-06 00:00:00'), # fails e.g. for Europe/Vilnius
182
(u'<<DateTime(1970-01-06T00:00:00)>>', '1970-01-06 00:00:00'), # fails e.g. for Europe/Vilnius
185
def class_setup(self):
186
""" Require default date and time format config values """
187
self.config = self.TestConfig(defaults=('date_fmt', 'datetime_fmt'))
189
def class_teardown(self):
167
192
def testDateTimeMacro(self):
168
193
""" parser.wiki: DateTime macro """
171
196
If this fails, it is likely a problem in your python / libc,
172
197
not in moin. See also: <http://sourceforge.net/tracker/index.php?func=detail&aid=902172&group_id=5470&atid=105470>
174
It can also be related to TZ changes a country historically made and then
175
shows a bug in moin. For this reason, the last tuple above is commented out.
199
It can also be related to TZ changes a country historically made.
178
202
for test, expected in self._tests:
494
518
needle = re.compile(text % r'(.+)')
497
('SomeNonExistentPage', '<a class="nonexistent" href="/SomeNonExistentPage">SomeNonExistentPage</a>'),
498
('SomeNonExistentPage#anchor', '<a class="nonexistent" href="/SomeNonExistentPage#anchor">SomeNonExistentPage#anchor</a>'),
499
('[[something]]', '<a class="nonexistent" href="/something">something</a>'),
500
('[[some thing]]', '<a class="nonexistent" href="/some%20thing">some thing</a>'),
501
('[[something|some text]]', '<a class="nonexistent" href="/something">some text</a>'),
502
('[[../something]]', '<a class="nonexistent" href="/something">../something</a>'),
503
('[[/something]]', '<a class="nonexistent" href="/%s/something">/something</a>' % PAGENAME),
504
('[[something#anchor]]', '<a class="nonexistent" href="/something#anchor">something#anchor</a>'),
521
('SomeNonExistentPage', '<a class="nonexistent" href="./SomeNonExistentPage">SomeNonExistentPage</a>'),
522
('SomeNonExistentPage#anchor', '<a class="nonexistent" href="./SomeNonExistentPage#anchor">SomeNonExistentPage#anchor</a>'),
523
('[[something]]', '<a class="nonexistent" href="./something">something</a>'),
524
('[[some thing]]', '<a class="nonexistent" href="./some%20thing">some thing</a>'),
525
('[[something|some text]]', '<a class="nonexistent" href="./something">some text</a>'),
526
('[[../something]]', '<a class="nonexistent" href="./something">../something</a>'),
527
('[[/something]]', '<a class="nonexistent" href="./%s/something">/something</a>' % PAGENAME),
528
('[[something#anchor]]', '<a class="nonexistent" href="./something#anchor">something#anchor</a>'),
505
529
('MoinMoin:something', '<a class="interwiki" href="http://moinmo.in/something" title="MoinMoin">something</a>'),
506
530
('[[MoinMoin:something|some text]]', '<a class="interwiki" href="http://moinmo.in/something" title="MoinMoin">some text</a>'),
507
531
('[[MoinMoin:with space]]', '<a class="interwiki" href="http://moinmo.in/with%20space" title="MoinMoin">with space</a>'),
508
532
('[[MoinMoin:with space|some text]]', '<a class="interwiki" href="http://moinmo.in/with%20space" title="MoinMoin">some text</a>'),
510
('[[ABC:n]]', '<a class="nonexistent" href="/ABC%3An">ABC:n</a>'), # finnish/swedish abbreviations / possessive
534
('[[ABC:n]]', '<a class="nonexistent" href="./ABC%3An">ABC:n</a>'), # finnish/swedish abbreviations / possessive
511
535
('ABC:n', 'ABC:n'), # finnish/swedish abbreviations / possessive
512
536
('lowercase:nointerwiki', 'lowercase:nointerwiki'),
513
537
('[[http://google.com/|google]]', '<a class="http" href="http://google.com/">google</a>'),