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
def parent_item(self, item_name): """ Return name of parent item for the current item :rtype: unicode :returns: parent item name """ parent_item_name = wikiutil.ParentItemName(item_name) if item_name and parent_item_name: return parent_item_name