示例#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
示例#2
0
文件: __init__.py 项目: steel-ne/moin
    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