Back to index

moin  1.9.0~rc2
Public Member Functions | Static Public Attributes | Static Private Attributes
test_text_moin_wiki.TestDateTimeMacro Class Reference
Inheritance diagram for test_text_moin_wiki.TestDateTimeMacro:
Inheritance graph
Collaboration diagram for test_text_moin_wiki.TestDateTimeMacro:
Collaboration graph

List of all members.

Public Member Functions

def testDateTimeMacro
def parse

Static Public Attributes

string text = 'AAA %s AAA'
tuple needle = re.compile(text % r'(.+)')

Static Private Attributes

tuple _tests

Detailed Description

Test DateTime macro

If you get failures in these tests, it might be because:
* libc problems (some are just broken/incorrect)
* changes in the timezone of a country (e.g. Lithuania seems
  to have changed the tz it is in, see comments below). Our
  timestamps are in UTC, but we use mktime(), which is the inverse
  function of localtime() (NOT of gmtime()), so we have to fix
  our calculation with the tzoffset. Problem: we can't easily find
  out the tzoffset some location had at some time in the past.
  Badly enough, we also don't have an inverse function of gmtime().

If some of these tests fail and show differences of e.g. 1 hour,
you might see your timestamps being off by 1 hour in the wiki.
If you can live with that, this will cause no other problems.

Definition at line 138 of file

Member Function Documentation

def test_text_moin_wiki.ParserTestCase.parse (   self,
) [inherited]
Parse body and return html

Create a page with body, then parse it and format using html formatter

Definition at line 26 of file

00027     def parse(self, body):
00028         """Parse body and return html
00030         Create a page with body, then parse it and format using html formatter
00031         """
00032         request = self.request
00033         assert body is not None
00034         request.reset()
00035         page = Page(request, PAGENAME)
00036         page.hilite_re = None
00037         page.set_raw_body(body)
00038         formatter = HtmlFormatter(request)
00039         formatter.setPage(page)
00040         page.formatter = formatter
00041         request.formatter = formatter
00042         parser = WikiParser(body, request, line_anchors=False)
00043         formatter.startContent('') # needed for _include_stack init
00044         output = request.redirectedOutput(parser.format, formatter)
00045         formatter.endContent('')
00046         return output

Here is the call graph for this function:

Here is the caller graph for this function: DateTime macro 

Definition at line 167 of file

00168     def testDateTimeMacro(self):
00169         """ DateTime macro """
00170         note = """
00172     If this fails, it is likely a problem in your python / libc,
00173     not in moin.  See also: <>
00175     It can also be related to TZ changes a country historically made and then
00176     shows a bug in moin. For this reason, the last tuple above is commented out.
00177     """
00179         for test, expected in self._tests:
00180             html = self.parse(self.text % test)
00181             result =
00182             assert result == expected

Here is the call graph for this function:

Member Data Documentation

Initial value:
        # test                                   expected
        (u'<<DateTime(259200)>>',                '1970-01-04 00:00:00'),
        (u'<<DateTime(2003-03-03T03:03:03)>>',   '2003-03-03 03:03:03'),
        (u'<<DateTime(2000-01-01T00:00:00Z)>>',  '2000-01-01 00:00:00'), # works for Europe/Vilnius
        (u'<<Date(2002-02-02T01:02:03Z)>>',      '2002-02-02'),
        #(u'<<DateTime(1970-01-06T00:00:00)>>',   '1970-01-06 00:00:00'), # fails e.g. for Europe/Vilnius

Definition at line 158 of file

tuple test_text_moin_wiki.TestDateTimeMacro.needle = re.compile(text % r'(.+)') [static]

Definition at line 157 of file

string test_text_moin_wiki.TestDateTimeMacro.text = 'AAA %s AAA' [static]

Definition at line 156 of file

The documentation for this class was generated from the following file: