moin-2.0 / build / lib / MoinMoin / util / _tests / test_tree.py

# Copyright: 2008 MoinMoin:BastianBlank
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.

"""
MoinMoin - Tests for MoinMoin.util.tree
"""


import pytest

from MoinMoin.util.tree import *

def test_Name():
    uri = 'uri:a'

    name = Name('a', uri)
    assert isinstance(name, ET.QName)
    assert name.name == 'a'
    assert name.uri == uri
    assert name == '{uri:a}a'

    element = name()
    assert isinstance(element, ET.Element)
    assert element.tag == name

def test_Namespace():
    uri = 'uri:a'

    namespace = Namespace(uri)
    assert namespace == uri
    assert namespace is namespace.namespace

    name = namespace.a
    assert isinstance(name, Name)
    assert name.name == 'a'
    assert name.uri == uri

    name = namespace('a')
    assert isinstance(name, Name)
    assert name.name == 'a'
    assert name.uri == uri

    name = namespace.outline_level
    assert name.name == 'outline-level'
    assert name.uri == uri

    name = namespace('outline-level')
    assert name.name == 'outline-level'
    assert name.uri == uri

    name = namespace.class_
    assert name.name == 'class'
    assert name.uri == uri

    name = namespace('class')
    assert name.name == 'class'
    assert name.uri == uri

    name = namespace('class_')
    assert name.name == 'class_'
    assert name.uri == uri

def test_html():
    assert isinstance(html, Namespace)

def test_moin_page():
    assert isinstance(moin_page, Namespace)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.