Back to index

moin  1.9.0~rc2
Public Member Functions | Static Public Attributes
test_text_moin_wiki.TestBlock Class Reference
Inheritance diagram for test_text_moin_wiki.TestBlock:
Inheritance graph
[legend]
Collaboration diagram for test_text_moin_wiki.TestBlock:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def testParagraphBeforeBlock
def testEmptyLineBeforeBlock
def testUrlAfterBlock
def testWikiNameAfterBlock
def testColorizedPythonParserAndNestingPreBrackets
def testNestingPreBrackets
def testTextBeforeNestingPreBrackets
def testManyNestingPreBrackets
def testMultipleShortPreSections
def parse

Static Public Attributes

tuple cases

Detailed Description

Definition at line 375 of file test_text_moin_wiki.py.


Member Function Documentation

def test_text_moin_wiki.ParserTestCase.parse (   self,
  body 
) [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 test_text_moin_wiki.py.

00026 
00027     def parse(self, body):
00028         """Parse body and return html
00029 
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
00047 

Here is the call graph for this function:

Here is the caller graph for this function:

tests nested {{{ }}} for the python colorized parser

Definition at line 435 of file test_text_moin_wiki.py.

00435 
00436     def testColorizedPythonParserAndNestingPreBrackets(self):
00437         """ tests nested {{{ }}} for the python colorized parser
00438         """
00439         raw = """{{{{
00440 #!python
00441 import re
00442 pattern = re.compile(r'{{{This is some nested text}}}')
00443 }}}}"""
00444         output = self.parse(raw)
00445         output = ''.join(output)
00446         assert "{{{This is some nested text}}}" in output

Here is the call graph for this function:

parser.wiki: empty lines before block element ignored

Empty lines separate paragraphs, but should be ignored if a block
element follow.

Currently an empty paragraph is created, which make no sense but
no real harm.

Definition at line 401 of file test_text_moin_wiki.py.

00401 
00402     def testEmptyLineBeforeBlock(self):
00403         """ parser.wiki: empty lines before block element ignored
00404 
00405         Empty lines separate paragraphs, but should be ignored if a block
00406         element follow.
00407 
00408         Currently an empty paragraph is created, which make no sense but
00409         no real harm.
00410         """
00411         text = """AAA
00412 
00413 %s
00414 """
00415         for test, blockstart in self.cases:
00416             expected = r'<p.*?>AAA.*?(<p.*?>\s*)*%s' % blockstart # XXX ignores addtl. <p>
00417             needle = re.compile(expected, re.MULTILINE)
00418             result = self.parse(text % test)
00419             print expected, result
00420             assert needle.search(result)

Here is the call graph for this function:

tests two nestings  ({{{ }}} and {{{ }}}) in one line for the wiki parser

Definition at line 470 of file test_text_moin_wiki.py.

00470 
00471     def testManyNestingPreBrackets(self):
00472         """ tests two nestings  ({{{ }}} and {{{ }}}) in one line for the wiki parser
00473         """
00474         raw = """{{{{
00475 Test {{{brackets}}} and test {{{brackets}}}
00476 }}}}"""
00477         output = self.parse(raw)
00478         output = ''.join(output)
00479         expected = '<pre>Test {{{brackets}}} and test {{{brackets}}}'
00480         assert expected in output

Here is the call graph for this function:

tests two single {{{ }}} in one line

Definition at line 481 of file test_text_moin_wiki.py.

00481 
00482     def testMultipleShortPreSections(self):
00483         """
00484         tests two single {{{ }}} in one line
00485         """
00486         raw = 'def {{{ghi}}} jkl {{{mno}}}'
00487         output = ''.join(self.parse(raw))
00488         expected = 'def <tt>ghi</tt> jkl <tt>mno</tt>'
00489         assert expected in output

Here is the call graph for this function:

tests nested {{{ }}} for the wiki parser

Definition at line 447 of file test_text_moin_wiki.py.

00447 
00448     def testNestingPreBrackets(self):
00449         """ tests nested {{{ }}} for the wiki parser
00450         """
00451         raw = """{{{{
00452 Example
00453 You can use {{{brackets}}}
00454 }}}}"""
00455         output = self.parse(raw)
00456         output = ''.join(output)
00457         print output
00458         assert 'You can use {{{brackets}}}' in output

Here is the call graph for this function:

parser.wiki: paragraph closed before block element 

Definition at line 388 of file test_text_moin_wiki.py.

00388 
00389     def testParagraphBeforeBlock(self):
00390         """ parser.wiki: paragraph closed before block element """
00391         text = """AAA
00392 %s
00393 """
00394         for test, blockstart in self.cases:
00395             # We dont test here formatter white space generation
00396             expected = r'<p.*?>AAA\s*\n*%s' % blockstart
00397             needle = re.compile(expected, re.MULTILINE)
00398             result = self.parse(text % test)
00399             print expected, result
00400             assert needle.search(result)

Here is the call graph for this function:

tests text before nested {{{ }}} for the wiki parser

Definition at line 459 of file test_text_moin_wiki.py.

00459 
00460     def testTextBeforeNestingPreBrackets(self):
00461         """ tests text before nested {{{ }}} for the wiki parser
00462         """
00463         raw = """Example
00464         {{{{
00465 You can use {{{brackets}}}
00466 }}}}"""
00467         output = self.parse(raw)
00468         output = ''.join(output)
00469         assert 'Example <ul><li style="list-style-type:none"><pre>You can use {{{brackets}}}</pre>' in output

Here is the call graph for this function:

parser.wiki: tests url after block element 

Definition at line 421 of file test_text_moin_wiki.py.

00421 
00422     def testUrlAfterBlock(self):
00423         """ parser.wiki: tests url after block element """
00424         case = 'some text {{{some block text\n}}} and a URL http://moinmo.in/'
00425 
00426         result = self.parse(case)
00427         assert result.find('and a URL <a ') > -1

Here is the call graph for this function:

parser.wiki: tests url after block element 

Definition at line 428 of file test_text_moin_wiki.py.

00428 
00429     def testWikiNameAfterBlock(self):
00430         """ parser.wiki: tests url after block element """
00431         case = 'some text {{{some block text\n}}} and a WikiName'
00432 
00433         result = self.parse(case)
00434         assert result.find('and a <a ') > -1

Here is the call graph for this function:


Member Data Documentation

Initial value:
(
        # test, block start
        ('----\n', '<hr'),
        ('= Heading =\n', '<h1'),
        ('{{{\nPre\n}}}\n', '<pre'),
        ('{{{\n#!python\nPre\n}}}\n', '<div'),
        ('|| Table ||', '<div'),
        (' * unordered list\n', '<ul'),
        (' 1. ordered list\n', '<ol'),
        (' indented text\n', '<ul'),
        )

Definition at line 376 of file test_text_moin_wiki.py.


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