Back to index

moin  1.9.0~rc2
Public Member Functions
MoinMoin._tests.test_wikiutil.TestNormalizePagename Class Reference

List of all members.

Public Member Functions

def testPageInvalidChars
def testNormalizeSlashes
def testNormalizeWhitespace
def testUnderscoreTestCase

Detailed Description

Definition at line 967 of file test_wikiutil.py.


Member Function Documentation

request: normalize pagename: normalize slashes 

Definition at line 979 of file test_wikiutil.py.

00979 
00980     def testNormalizeSlashes(self):
00981         """ request: normalize pagename: normalize slashes """
00982         cases = (
00983             (u'/////', u''),
00984             (u'/a', u'a'),
00985             (u'a/', u'a'),
00986             (u'a/////b/////c', u'a/b/c'),
00987             (u'a b/////c d/////e f', u'a b/c d/e f'),
00988             )
00989         for test, expected in cases:
00990             result = wikiutil.normalize_pagename(test, self.request.cfg)
00991             assert result == expected

request: normalize pagename: normalize whitespace 

Definition at line 992 of file test_wikiutil.py.

00992 
00993     def testNormalizeWhitespace(self):
00994         """ request: normalize pagename: normalize whitespace """
00995         cases = (
00996             (u'         ', u''),
00997             (u'    a', u'a'),
00998             (u'a    ', u'a'),
00999             (u'a     b     c', u'a b c'),
01000             (u'a   b  /  c    d  /  e   f', u'a b/c d/e f'),
01001             # All 30 unicode spaces
01002             (config.chars_spaces, u''),
01003             )
01004         for test, expected in cases:
01005             result = wikiutil.normalize_pagename(test, self.request.cfg)
01006             assert result == expected

request: normalize pagename: remove invalid unicode chars

Assume the default setting

Definition at line 969 of file test_wikiutil.py.

00969 
00970     def testPageInvalidChars(self):
00971         """ request: normalize pagename: remove invalid unicode chars
00972 
00973         Assume the default setting
00974         """
00975         test = u'\u0000\u202a\u202b\u202c\u202d\u202e'
00976         expected = u''
00977         result = wikiutil.normalize_pagename(test, self.request.cfg)
00978         assert result == expected

request: normalize pagename: underscore convert to spaces and normalized

Underscores should convert to spaces, then spaces should be
normalized, order is important!

Definition at line 1007 of file test_wikiutil.py.

01007 
01008     def testUnderscoreTestCase(self):
01009         """ request: normalize pagename: underscore convert to spaces and normalized
01010 
01011         Underscores should convert to spaces, then spaces should be
01012         normalized, order is important!
01013         """
01014         cases = (
01015             (u'         ', u''),
01016             (u'  a', u'a'),
01017             (u'a  ', u'a'),
01018             (u'a  b  c', u'a b c'),
01019             (u'a  b  /  c  d  /  e  f', u'a b/c d/e f'),
01020             )
01021         for test, expected in cases:
01022             result = wikiutil.normalize_pagename(test, self.request.cfg)
01023             assert result == expected


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