view MoinMoin/converter/_tests/test_include.py @ 562:17931e46e2df pytest2

py.test changed to pytest in conftest.py and all the tests of converter module.
author pkumar <contactprashantat@gmail.com>
date Wed, 25 May 2011 19:14:55 +0530
parents 4cd8edde9e94
children 844ff806153c
line wrap: on
line source
# Copyright: 2008 MoinMoin:BastianBlank
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.

"""
MoinMoin - Tests for MoinMoin.converter.include
"""


import pytest

from MoinMoin.converter.include import *

def test_XPointer():
    x = XPointer('a')
    assert len(x) == 1
    e = x[0]
    assert e.name == 'a'
    assert e.data is None

    x = XPointer('a(b)')
    assert len(x) == 1
    e = x[0]
    assert e.name == 'a'
    assert e.data == 'b'

    x = XPointer('a(^(b^)^^)')
    assert len(x) == 1
    e = x[0]
    assert e.name == 'a'
    assert e.data == '^(b^)^^'
    assert e.data_unescape == '(b)^'

    x = XPointer('a(b)c(d)')
    assert len(x) == 2
    e = x[0]
    assert e.name == 'a'
    assert e.data == 'b'
    e = x[1]
    assert e.name == 'c'
    assert e.data == 'd'

    x = XPointer('a(b) c(d)')
    assert len(x) == 2
    e = x[0]
    assert e.name == 'a'
    assert e.data == 'b'
    e = x[1]
    assert e.name == 'c'
    assert e.data == 'd'