Example #1
0
def testParentItemName():
    # with no parent
    result = wikiutil.ParentItemName('itemname')
    expected = ''
    assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals(
    )
    # with a parent
    result = wikiutil.ParentItemName('some/parent/itemname')
    expected = 'some/parent'
    assert result == expected
Example #2
0
    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