changeset 610:66b072c4ce8b pytest2

test added for wikiutil.ParentItemName() in _test/test_wikiutil
author pkumar <contactprashantat@gmail.com>
date Sun, 03 Jul 2011 16:24:51 +0530
parents ed593361022e
children 2c52e4d20d01
files MoinMoin/_tests/test_wikiutil.py MoinMoin/themes/_tests/test_navi_bar.py
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_wikiutil.py	Sat Jul 02 00:04:47 2011 +0530
+++ b/MoinMoin/_tests/test_wikiutil.py	Sun Jul 03 16:24:51 2011 +0530
@@ -175,5 +175,15 @@
                 assert result == expected
 
 
+def testParentItemName():
+    # with no parent
+    result = wikiutil.ParentItemName(u'itemname')
+    expected = u''
+    assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+    # with a parent
+    result = wikiutil.ParentItemName(u'some/parent/itemname')
+    expected = u'some/parent'
+    assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+    
 coverage_modules = ['MoinMoin.wikiutil']
 
--- a/MoinMoin/themes/_tests/test_navi_bar.py	Sat Jul 02 00:04:47 2011 +0530
+++ b/MoinMoin/themes/_tests/test_navi_bar.py	Sun Jul 03 16:24:51 2011 +0530
@@ -47,7 +47,7 @@
         assert test_item_name_2 == 'some/place'
         assert test_segment_name_3 == 'test_item'
         assert test_item_name_3 == 'some/place/test_item'
-
+        
 def test_shorten_item_name():
     test_result1 = themes.shorten_item_name(u'MoinMoin/some/value', 0) 
     assert test_result1 == u'valu...lue'    
@@ -60,3 +60,4 @@
     test_result = themes.contenttype_to_class(u'MoinMoin/some/value')
     expected = u'moin-mime-MoinMoin'    
     assert test_result == expected
+