#!/usr/bin/env mayapy

import maya.standalone
maya.standalone.initialize()

import os
import sys
_HERE = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.path.abspath(os.path.join(_HERE, *((os.pardir,) * 2))))

import bana
bana.initialize()


import itertools
import re
import unittest

from maya import OpenMaya


_WILDCARDS = '*+?.'
_IS_VALID_VARIATIONS = ('%s', '|%s', '@%s', '@|%s')


def _applyIsValid(function, string, *args, **kwargs):
    out = []
    for pattern in [variation % string for variation in _IS_VALID_VARIATIONS]:
        expr = re.sub(r'@', '%s', pattern)
        samples = [
            expr % wildcards
            for wildcards in itertools.product(_WILDCARDS,
                                               repeat=pattern.count('@'))]
        samples = [y for x in samples for y in (x, unicode(x))]
        outputs = [function(sample, *args, **kwargs) for sample in samples]
        if outputs.count(outputs[0]) != len(outputs):
            raise RuntimeError("Not all of the combinations for '%s' "
                               "return the same result." % (pattern,))

        out.append(outputs[0])

    return out


def _applyMatch(function, pattern, string, *args, **kwargs):
    samples = [
        (str(pattern), str(string)),
        (str(pattern), unicode(string)),
        (unicode(pattern), str(string)),
        (unicode(pattern), unicode(string))
    ]
    outputs = [function(sample[0], sample[1], *args, **kwargs)
               for sample in samples]
    if outputs.count(outputs[0]) != len(outputs):
        raise RuntimeError("Not all of the combinations for '%s, %s' "
                           "return the same result." % (pattern, string))

    return outputs[0]


class MGlobalTest(unittest.TestCase):

    def testBnIsValidName(self):
        function = OpenMaya.MGlobal.bnIsValidName

        self.assertEqual(_applyIsValid(function, ''), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ' '), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'Z'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '0'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, ':'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '__'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_ '), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_Z'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_0'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_9'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_-'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_>'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ' _'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'Z_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '0_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '  '), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'aa'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ZZ'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '00'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '99'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '::'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '||'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '--'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>>'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_ab'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_b'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a_b'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_ab_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_b_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a_b_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@a@b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@b@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@a@b@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_12'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '1_2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_12_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '1_2_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, ':12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':12:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@2@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1ab'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '1_ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1b'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_1b'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1_b'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_1_b'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:1b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1:b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:1:b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1|b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1|b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1->b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1->b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1@b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1@b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab_1'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:1'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|1'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->1'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@1'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, ':abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|:abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':|abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c|de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c:de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@|abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c|de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c@de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->:abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c->de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c:de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c->de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c@de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->|abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c->de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c|de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@:abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c:de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c@de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '::abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab::cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c:de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '||abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab||cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c|de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c->de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c@de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de->f'), [False, False, False, False])

        self.assertEqual(_applyIsValid(function, '', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, ' ', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'Z', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '0', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '9', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '__', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_ ', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_Z', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_0', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_9', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_-', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_>', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ' _', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'Z_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '0_', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '9_', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, ':_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '  ', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'aa', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ZZ', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '00', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '99', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '::', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '||', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '--', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>>', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_ab', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a_b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_a_b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_ab_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a_b_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_a_b_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a@b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@a@b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@ab@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a@b@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@a@b@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '12', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '_12', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1_2', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '12_', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '_1_2', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_12_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1_2_', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '_1_2_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':12', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':12:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1@2', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '12@', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '@1@2', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@12@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1@2@', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '@1@2@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1ab', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '_1ab', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1_ab', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, ':1ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1ab', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1@ab', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a1b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a_1b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a1_b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a_1_b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a:1b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1:b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:1:b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1|b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1|b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1->b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1->b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a1@b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a@1@b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab1', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab_1', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab1_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab:1', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|1', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->1', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@1', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab1@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'abcde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@abcde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab@cde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'abcde@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|:abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':|abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c|de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c:de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|@abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@|abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|@cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c|de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab@cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c@de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->:abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c->de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c:de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->@abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->@cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c->de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab@cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c@de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->|abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c->de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c|de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':@abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@:abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:@cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c:de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab@cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c@de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '::abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab::cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c:de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '||abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab||cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c|de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c->de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@abcde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@ab@cde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab@@cde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab@c@de', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de->f', allowWildcards=True), [False, False, False, False])

        self.assertEqual(_applyIsValid(function, '@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@:leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':@', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@->|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ns:@', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|:@', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|:@:leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ns:@:leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ns:@|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ns:@->|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root|@', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root|@:leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root|@|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root|@->|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@:leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@->|leaf', allowWildcards=True), [False, False, False, False])

    def testBnIsValidFullName(self):
        function = OpenMaya.MGlobal.bnIsValidFullName

        self.assertEqual(_applyIsValid(function, ''), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ' '), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'Z'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '0'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, ':'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '__'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_ '), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_Z'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_0'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_9'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_-'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_>'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ' _'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'Z_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '0_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '  '), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'aa'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ZZ'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '00'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '99'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '::'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '||'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '--'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>>'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_ab'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_b'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a_b'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_ab_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_b_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a_b_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@a@b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@b@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@a@b@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_12'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '1_2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_12_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '1_2_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, ':12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':12:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@2@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1ab'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '1_ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1b'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_1b'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1_b'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_1_b'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:1b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1:b'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:1:b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1|b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1|b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1->b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1->b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1@b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1@b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab_1'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:1'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|1'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->1'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@1'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, ':abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:cde'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|:abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':|abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c|de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c:de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@|abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c|de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c@de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->:abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c->de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c:de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c->de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c@de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->|abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c->de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c|de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@:abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c:de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c@de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '::abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab::cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c:de'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '||abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab||cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c|de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c->de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c@de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de:f'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de->f'), [False, False, False, False])

        self.assertEqual(_applyIsValid(function, '', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, ' ', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'Z', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '0', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '9', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '__', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_ ', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_Z', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_0', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_9', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_-', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_>', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ' _', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'Z_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '0_', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '9_', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, ':_', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '|_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '  ', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'aa', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ZZ', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '00', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '99', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '::', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '||', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '--', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>>', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_ab', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a_b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_a_b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_ab_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a_b_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_a_b_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':ab', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a:b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, ':ab:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a@b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@a@b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@ab@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a@b@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@a@b@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '12', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '_12', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1_2', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '12_', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '_1_2', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_12_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1_2_', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '_1_2_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':12', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':12:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1@2', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '12@', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '@1@2', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@12@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1@2@', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '@1@2@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1ab', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '_1ab', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1_ab', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, ':1ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:ab', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '|1ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1ab', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1@ab', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a1b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a_1b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a1_b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a_1_b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a:1b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1:b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a:1:b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1|b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1|b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1->b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1->b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a1@b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a@1@b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab1', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab_1', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab1_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab:1', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|1', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->1', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@1', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab1@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'abcde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':abcde', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab:cde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'abcde:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@abcde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab@cde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'abcde@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|:abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':|abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c|de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c:de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|@abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@|abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|@cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c|de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab@cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c@de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->:abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c->de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c:de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->@abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->@cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c->de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab@cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c@de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->|abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c->de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c|de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':@abcde', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '@:abcde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@ab:cde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab:@cde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab@:cde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab@c:de', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':ab@cde', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab:c@de', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '::abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:cde', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab::cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c:de', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '||abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab||cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c|de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c->de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@abcde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@ab@cde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab@@cde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab@c@de', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de:f', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de->f', allowWildcards=True), [False, False, False, False])

        self.assertEqual(_applyIsValid(function, '@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@:leaf', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@->|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ns:@', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|:@', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|:@:leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ns:@:leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ns:@|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ns:@->|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root|@', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root|@:leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root|@|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root|@->|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@:leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@->|leaf', allowWildcards=True), [False, False, False, False])

        self.assertEqual(_applyIsValid(function, '', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ' ', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'Z', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '0', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, ':', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '__', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_ ', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_Z', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_0', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_9', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_-', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_>', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ' _', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'Z_', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '0_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':_', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '|_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '  ', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'aa', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ZZ', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '00', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '99', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '::', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '||', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '--', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>>', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_ab', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_b', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab_', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a_b', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_ab_', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_b_', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a_b_', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@a@b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@b@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@a@b@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_12', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '1_2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '_12_', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '1_2_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2_', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, ':12', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':12:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@2@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1ab', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '1_ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1b', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_1b', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1_b', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_1_b', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:1b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1:b', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:1:b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1|b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1|b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1->b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1->b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1@b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1@b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab_1', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1_', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:1', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|1', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->1', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@1', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, ':abcde', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:cde', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|:abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':|abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab|cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|:cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:|cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c|de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab:cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c:de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|@abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@|abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab|cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@|cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c|de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c@de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->:abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':->abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->:cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c->de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab:cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c:de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->@abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@->abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c->de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c@de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->|abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|->abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->|cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c->de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab|cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c|de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':@abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@:abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab:cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@:cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c:de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c@de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '::abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:cde', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab::cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c:de', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '||abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab||cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c|de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c->de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c@de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de:f', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de|f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de->f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de:f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de:f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de|f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de:f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de|f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de|f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de:f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de:f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de->f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de:f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de->f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de->f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de|f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de|f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de->f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de|f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de->f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de->f', matchRelative=True), [False, False, False, False])

        self.assertEqual(_applyIsValid(function, '', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, ' ', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'Z', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '0', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '9', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '_', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '__', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_ ', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_Z', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_0', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_9', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_-', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_>', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ' _', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'Z_', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '0_', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '9_', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, ':_', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|_', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-_', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>_', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->_', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@_', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '  ', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'aa', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ZZ', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '00', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '99', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '::', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '||', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '--', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>>', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_ab', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a_b', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab_', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_a_b', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_ab_', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a_b_', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_a_b_', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':ab', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a:b', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':ab:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a@b', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@a@b', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@ab@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a@b@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@a@b@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '12', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '_12', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1_2', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '12_', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '_1_2', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '_12_', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1_2_', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '_1_2_', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':12', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':12:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1@2', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '12@', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '@1@2', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@12@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1@2@', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '@1@2@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1ab', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '_1ab', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1_ab', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, ':1ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:ab', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '|1ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1ab', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '1@ab', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a1b', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a_1b', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a1_b', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a_1_b', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a:1b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1:b', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a:1:b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1|b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1|b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1->b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1->b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1b', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a1@b', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a@1@b', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab1', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab_1', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab1_', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab:1', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|1', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->1', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@1', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab1@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'abcde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':abcde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab:cde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'abcde:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@abcde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab@cde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'abcde@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|:abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':|abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab|cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|:cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:|cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c|de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab:cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c:de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|@abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@|abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab|cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|@cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@|cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c|de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab@cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c@de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->:abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':->abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->:cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c->de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab:cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c:de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->@abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@->abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->@cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c->de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab@cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c@de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->|abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|->abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->|cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c->de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab|cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c|de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':@abcde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@:abcde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@ab:cde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab:@cde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab@:cde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab@c:de', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':ab@cde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab:c@de', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '::abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:cde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab::cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c:de', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '||abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab||cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c|de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c->de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@abcde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@ab@cde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab@@cde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab@c@de', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de:f', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de|f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de->f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de:f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de:f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de|f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de:f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de|f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de|f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de:f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de:f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de->f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de:f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de->f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de->f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de|f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de|f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de->f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de|f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de->f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de->f', allowWildcards=True, matchRelative=True), [False, False, False, False])

        self.assertEqual(_applyIsValid(function, '@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@:leaf', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, ':@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@|leaf', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@->|leaf', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ns:@', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|:@', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|:@:leaf', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ns:@:leaf', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ns:@|leaf', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ns:@->|leaf', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root|@', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root|@:leaf', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root|@|leaf', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root|@->|leaf', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@:leaf', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@|leaf', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@->|leaf', allowWildcards=True, matchRelative=True), [False, False, False, False])

    def testBnIsValidPath(self):
        function = OpenMaya.MGlobal.bnIsValidPath

        self.assertEqual(_applyIsValid(function, ''), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ' '), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'Z'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '0'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, ':'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '__'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_ '), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_Z'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_0'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_9'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_-'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_>'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ' _'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'Z_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '0_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '-_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '  '), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'aa'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ZZ'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '00'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '99'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '::'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '||'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '--'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>>'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_ab'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a_b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_a_b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_ab_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a_b_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_a_b_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, ':ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@a@b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@b@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@a@b@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_12'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '1_2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_12_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '1_2_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, ':12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':12:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@2@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1ab'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '1_ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a_1b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a1_b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a_1_b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a:1b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1:b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a:1:b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1|b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1|b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1->b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1->b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1@b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1@b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab_1'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:1'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|1'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->1'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@1'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, ':abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:cde'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|abcde'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|cde'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|:abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':|abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c|de'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '|ab:cde'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c:de'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '|@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@|abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c|de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c@de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->:abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c->de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c:de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c->de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c@de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->|abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c->de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c|de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@:abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c:de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c@de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '::abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab::cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c:de'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '||abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|cde'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab||cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c|de'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '->->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c->de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c@de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de:f'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de|f'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de:f'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de:f'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de|f'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de:f'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de|f'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de|f'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de->f'), [False, False, False, False])

        self.assertEqual(_applyIsValid(function, '', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, ' ', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'Z', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '0', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@', allowWildcards=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, '__', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_ ', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_Z', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_0', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_9', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_-', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_>', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ' _', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'Z_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '0_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '-_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '  ', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'aa', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ZZ', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '00', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '99', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '::', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '||', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '--', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>>', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@', allowWildcards=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, 'ab', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_ab', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a_b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_a_b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_ab_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a_b_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_a_b_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a|b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|ab|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a@b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@a@b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@ab@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a@b@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@a@b@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '12', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_12', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1_2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_12_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1_2_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':12', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':12:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1@2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12@', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@12@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1@2@', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1ab', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1_ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1ab', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1@ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a_1b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a1_b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a_1_b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:1b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1:b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:1:b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1|b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a|1|b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1->b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1->b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a1@b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a@1@b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab1', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab_1', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab1_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab:1', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|1', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->1', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@1', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab1@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'abcde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'abcde:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|abcde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab|cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'abcde|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@abcde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'abcde@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '|:abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':|abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c|de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '|ab:cde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab|c:de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '|@abcde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@|abcde', allowWildcards=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, '@ab|cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab|@cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@|cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@c|de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '|ab@cde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab|c@de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '->:abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c->de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c:de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->@abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->@cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c->de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab@cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c@de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->|abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c->de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c|de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':@abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@:abcde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@ab:cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab:@cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@:cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@c:de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':ab@cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c@de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '::abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab::cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c:de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '||abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|cde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab||cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c|de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '->->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c->de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@abcde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@ab@cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@@cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@c@de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:bc:de:f', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a|bc|de|f', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a->bc->de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de:f', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:bc|de:f', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:bc:de|f', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a|bc|de:f', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a|bc:de|f', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:bc|de|f', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a->bc:de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de->f', allowWildcards=True), [False, False, False, False])

        self.assertEqual(_applyIsValid(function, '@', allowWildcards=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, '@:leaf', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@|leaf', allowWildcards=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, '@->|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ns:@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|:@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|:@:leaf', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|ns:@:leaf', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|ns:@|leaf', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|ns:@->|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root|@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root|@:leaf', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root|@|leaf', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root|@->|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@:leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@|leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@->|leaf', allowWildcards=True), [False, False, False, False])

    def testBnIsValidFullPath(self):
        function = OpenMaya.MGlobal.bnIsValidFullPath

        self.assertEqual(_applyIsValid(function, ''), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ' '), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'Z'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '0'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, ':'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '__'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_ '), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_Z'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_0'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_9'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_-'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_>'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_->'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ' _'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'Z_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '0_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|_'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '-_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '  '), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'aa'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ZZ'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '00'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '99'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '::'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '||'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '--'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>>'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_ab'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a_b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_a_b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_ab_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a_b_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_a_b_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, ':ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@a@b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@b@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@a@b@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_12'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '1_2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_12_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '1_2_'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, ':12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':12:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2->'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@2@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1ab'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '1_ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@ab'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a_1b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a1_b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a_1_b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a:1b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1:b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a:1:b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1|b'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1|b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1->b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1->b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1@b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1@b'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab_1'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1_'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:1'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|1'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->1'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1->'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@1'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, ':abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:cde'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde:'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|abcde'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|cde'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde|'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde->'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde@'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|:abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':|abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c|de'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '|ab:cde'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c:de'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '|@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@|abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c|de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c@de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->:abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c->de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c:de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c->de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c@de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->|abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->|cde'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c->de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab|cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c|de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@:abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c:de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c@de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '::abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab::cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c:de'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '||abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|cde'), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab||cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c|de'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '->->abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->->cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c->de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@abcde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@@cde'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c@de'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de:f'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de|f'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de:f'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de:f'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de|f'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de:f'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de|f'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de|f'), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de:f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de|f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de->f'), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de->f'), [False, False, False, False])

        self.assertEqual(_applyIsValid(function, '', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, ' ', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'Z', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '0', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '@', allowWildcards=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, '__', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_ ', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_Z', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_0', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_9', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_-', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_>', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_->', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ' _', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'Z_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '0_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|_', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '-_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '  ', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'aa', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ZZ', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '00', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '99', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '::', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '||', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '--', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>>', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@', allowWildcards=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, 'ab', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_ab', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a_b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_a_b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_ab_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a_b_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_a_b_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a|b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|ab|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '->a->b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a@b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@a@b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@ab@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a@b@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@a@b@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '12', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_12', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1_2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_12_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1_2_', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':12', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':12:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2->', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1@2', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12@', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@12@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1@2@', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1ab', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1_ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1ab', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1@ab', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a_1b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a1_b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a_1_b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:1b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1:b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:1:b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1|b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a|1|b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1->b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1->b', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a1@b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a@1@b', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab1', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab_1', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab1_', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab:1', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|1', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->1', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1->', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@1', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab1@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'abcde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'abcde:', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|abcde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab|cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'abcde|', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde->', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@abcde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'abcde@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '|:abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':|abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c|de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '|ab:cde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab|c:de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '|@abcde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@|abcde', allowWildcards=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, '@ab|cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab|@cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@|cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@c|de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '|ab@cde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab|c@de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '->:abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c->de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c:de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->@abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->@cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c->de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab@cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c@de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->|abcde', allowWildcards=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, '|->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->|cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab|->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c->de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab|cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c|de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':@abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@:abcde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@ab:cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab:@cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@:cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@c:de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':ab@cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c@de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '::abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab::cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c:de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '||abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|cde', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab||cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c|de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '->->abcde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->->cde', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c->de', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@abcde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@ab@cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@@cde', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@c@de', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:bc:de:f', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a|bc|de|f', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a->bc->de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de:f', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:bc|de:f', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:bc:de|f', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a|bc|de:f', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a|bc:de|f', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:bc|de|f', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a->bc:de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de:f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de|f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de->f', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de->f', allowWildcards=True), [False, False, False, False])

        self.assertEqual(_applyIsValid(function, '@', allowWildcards=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, '@:leaf', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':@', allowWildcards=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@|leaf', allowWildcards=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, '@->|leaf', allowWildcards=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, '|ns:@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|:@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|:@:leaf', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|ns:@:leaf', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|ns:@|leaf', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|ns:@->|leaf', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root|@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root|@:leaf', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root|@|leaf', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root|@->|leaf', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root->@', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root->@:leaf', allowWildcards=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@|leaf', allowWildcards=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root->@->|leaf', allowWildcards=True), [True, False, True, False])

        self.assertEqual(_applyIsValid(function, '', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ' ', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'Z', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '0', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, ':', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '__', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_ ', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_Z', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_0', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_9', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_-', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_>', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_->', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ' _', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'Z_', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '0_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|_', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '-_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '  ', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'aa', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ZZ', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '00', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '99', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '::', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '||', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '--', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>>', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_ab', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a_b', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab_', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_a_b', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_ab_', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a_b_', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_a_b_', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, ':ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@a@b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@b@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@a@b@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_12', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '1_2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '_12_', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '1_2_', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2_', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, ':12', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':12:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2->', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@2@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1ab', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '1_ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1@ab', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1b', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a_1b', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a1_b', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a_1_b', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a:1b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1:b', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a:1:b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1|b', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1|b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1->b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1->b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1@b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1@b', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab_1', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1_', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:1', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|1', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->1', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1->', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@1', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, ':abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:cde', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde:', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|abcde', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|cde', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde|', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde->', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '@abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde@', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|:abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':|abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab|cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|:cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:|cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c|de', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '|ab:cde', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c:de', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '|@abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@|abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab|cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@|cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c|de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c@de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->:abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':->abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->:cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c->de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab:cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c:de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->@abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@->abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c->de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c@de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->|abcde', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, '|->abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->|cde', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c->de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab|cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c|de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':@abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@:abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab:cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@:cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c:de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c@de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '::abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab::cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c:de', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '||abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|cde', matchRelative=True), [True, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab||cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c|de', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, '->->abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->->cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c->de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@abcde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@@cde', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c@de', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de:f', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de|f', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de->f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de:f', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de:f', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de|f', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de:f', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de|f', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc|de|f', matchRelative=True), [False, True, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de:f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de:f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de->f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de:f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de->f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de->f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de|f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de|f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de->f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de|f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de->f', matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de->f', matchRelative=True), [False, False, False, False])

        self.assertEqual(_applyIsValid(function, '', allowWildcards=True, matchRelative=True), [False, False, True, False])
        self.assertEqual(_applyIsValid(function, ' ', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'Z', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '0', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '-', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@', allowWildcards=True, matchRelative=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, '__', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_ ', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_a', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_Z', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_0', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_9', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_-', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_>', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_->', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_@', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ' _', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a_', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'Z_', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '0_', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '9_', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':_', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|_', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '-_', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>_', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->_', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@_', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '  ', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'aa', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ZZ', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '00', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '99', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '::', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '||', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '--', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '>>', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@', allowWildcards=True, matchRelative=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, 'ab', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_ab', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a_b', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab_', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_a_b', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_ab_', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a_b_', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_a_b_', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:b:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':a:b:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'a|b', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|ab|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|b|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|a|b|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '->a->b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->b->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->a->b->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a@b', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@a@b', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@ab@', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a@b@', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@a@b@', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '12', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_12', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1_2', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12_', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '_12_', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1_2_', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1_2_', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':12', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':12:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:2:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1:2:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|12|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|2|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1|2|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->12->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->2->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1->2->', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@12', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1@2', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '12@', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@12@', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1@2@', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1@2@', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '_1ab', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1_ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':1ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1:ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|1ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1|ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->1ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '1->ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@1ab', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '1@ab', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1b', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a_1b', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a1_b', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a_1_b', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:1b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1:b', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:1:b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|1b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1|b', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a|1|b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a1->b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->1->b', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a@1b', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a1@b', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a@1@b', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab1', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab_1', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab1_', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab:1', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|1', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->1', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab1->', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@1', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab1@', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'abcde', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:cde', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'abcde:', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|abcde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab|cde', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'abcde|', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'abcde->', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@abcde', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@cde', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'abcde@', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '|:abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':|abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab|cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|:cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:|cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c|de', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '|ab:cde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab|c:de', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '|@abcde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '@|abcde', allowWildcards=True, matchRelative=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, '@ab|cde', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab|@cde', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@|cde', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@c|de', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '|ab@cde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab|c@de', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '->:abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':->abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->:cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c->de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab:cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c:de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->@abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@->abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@ab->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->@cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab@c->de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab@cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c@de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->|abcde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|->abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->|cde', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab|->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c->de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab|cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c|de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':@abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@:abcde', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@ab:cde', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab:@cde', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@:cde', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@c:de', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':ab@cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c@de', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '::abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, ':ab:cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab::cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab:c:de', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '||abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|ab|cde', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, 'ab||cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab|c|de', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '->->abcde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '->ab->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->->cde', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'ab->c->de', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '@@abcde', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@ab@cde', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@@cde', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'ab@c@de', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:bc:de:f', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a|bc|de|f', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a->bc->de->f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc:de:f', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:bc|de:f', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:bc:de|f', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a|bc|de:f', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a|bc:de|f', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a:bc|de|f', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, 'a->bc:de:f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de:f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc:de->f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de:f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc:de->f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a:bc->de->f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de|f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de|f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc|de->f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc->de|f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a->bc|de->f', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, 'a|bc->de->f', allowWildcards=True, matchRelative=True), [False, False, False, False])

        self.assertEqual(_applyIsValid(function, '@', allowWildcards=True, matchRelative=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, '@:leaf', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, ':@', allowWildcards=True, matchRelative=True), [False, True, False, True])
        self.assertEqual(_applyIsValid(function, '@|leaf', allowWildcards=True, matchRelative=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, '@->|leaf', allowWildcards=True, matchRelative=True), [True, True, True, True])
        self.assertEqual(_applyIsValid(function, '|ns:@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|:@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|:@:leaf', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|ns:@:leaf', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|ns:@|leaf', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|ns:@->|leaf', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root|@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root|@:leaf', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root|@|leaf', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root|@->|leaf', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root->@', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root->@:leaf', allowWildcards=True, matchRelative=True), [False, False, False, False])
        self.assertEqual(_applyIsValid(function, '|root->@|leaf', allowWildcards=True, matchRelative=True), [True, False, True, False])
        self.assertEqual(_applyIsValid(function, '|root->@->|leaf', allowWildcards=True, matchRelative=True), [True, False, True, False])

    def testBnMatchName(self):
        function = OpenMaya.MGlobal.bnMatchName

        self.assertEqual(_applyMatch(function, 'leaf', 'leaf'), True)
        self.assertEqual(_applyMatch(function, 'leaf', 'lof'), False)
        self.assertEqual(_applyMatch(function, 'leaf', 'lf'), False)
        self.assertEqual(_applyMatch(function, 'leaf', 'l'), False)

        self.assertEqual(_applyMatch(function, '*', 'leaf'), True)
        self.assertEqual(_applyMatch(function, '*', 'lof'), True)
        self.assertEqual(_applyMatch(function, '*', 'lf'), True)
        self.assertEqual(_applyMatch(function, '*', 'l'), True)

        self.assertEqual(_applyMatch(function, '+', 'leaf'), True)
        self.assertEqual(_applyMatch(function, '+', 'lof'), True)
        self.assertEqual(_applyMatch(function, '+', 'lf'), True)
        self.assertEqual(_applyMatch(function, '+', 'l'), True)

        self.assertEqual(_applyMatch(function, '?', 'leaf'), False)
        self.assertEqual(_applyMatch(function, '?', 'lof'), False)
        self.assertEqual(_applyMatch(function, '?', 'lf'), False)
        self.assertEqual(_applyMatch(function, '?', 'l'), True)

        self.assertEqual(_applyMatch(function, '.', 'leaf'), False)
        self.assertEqual(_applyMatch(function, '.', 'lof'), False)
        self.assertEqual(_applyMatch(function, '.', 'lf'), False)
        self.assertEqual(_applyMatch(function, '.', 'l'), True)

        self.assertEqual(_applyMatch(function, 'l*', 'leaf'), True)
        self.assertEqual(_applyMatch(function, 'l*', 'lof'), True)
        self.assertEqual(_applyMatch(function, 'l*', 'lf'), True)
        self.assertEqual(_applyMatch(function, 'l*', 'l'), True)

        self.assertEqual(_applyMatch(function, 'l+', 'leaf'), True)
        self.assertEqual(_applyMatch(function, 'l+', 'lof'), True)
        self.assertEqual(_applyMatch(function, 'l+', 'lf'), True)
        self.assertEqual(_applyMatch(function, 'l+', 'l'), False)

        self.assertEqual(_applyMatch(function, 'l?', 'leaf'), False)
        self.assertEqual(_applyMatch(function, 'l?', 'lof'), False)
        self.assertEqual(_applyMatch(function, 'l?', 'lf'), True)
        self.assertEqual(_applyMatch(function, 'l?', 'l'), True)

        self.assertEqual(_applyMatch(function, 'l.', 'leaf'), False)
        self.assertEqual(_applyMatch(function, 'l.', 'lof'), False)
        self.assertEqual(_applyMatch(function, 'l.', 'lf'), True)
        self.assertEqual(_applyMatch(function, 'l.', 'l'), False)

        self.assertEqual(_applyMatch(function, '*f', 'leaf'), True)
        self.assertEqual(_applyMatch(function, '*f', 'lof'), True)
        self.assertEqual(_applyMatch(function, '*f', 'lf'), True)
        self.assertEqual(_applyMatch(function, '*f', 'l'), False)

        self.assertEqual(_applyMatch(function, '+f', 'leaf'), True)
        self.assertEqual(_applyMatch(function, '+f', 'lof'), True)
        self.assertEqual(_applyMatch(function, '+f', 'lf'), True)
        self.assertEqual(_applyMatch(function, '+f', 'l'), False)

        self.assertEqual(_applyMatch(function, '?f', 'leaf'), False)
        self.assertEqual(_applyMatch(function, '?f', 'lof'), False)
        self.assertEqual(_applyMatch(function, '?f', 'lf'), True)
        self.assertEqual(_applyMatch(function, '?f', 'l'), False)

        self.assertEqual(_applyMatch(function, '.f', 'leaf'), False)
        self.assertEqual(_applyMatch(function, '.f', 'lof'), False)
        self.assertEqual(_applyMatch(function, '.f', 'lf'), True)
        self.assertEqual(_applyMatch(function, '.f', 'l'), False)

        self.assertEqual(_applyMatch(function, 'l*f', 'leaf'), True)
        self.assertEqual(_applyMatch(function, 'l*f', 'lof'), True)
        self.assertEqual(_applyMatch(function, 'l*f', 'lf'), True)
        self.assertEqual(_applyMatch(function, 'l*f', 'l'), False)

        self.assertEqual(_applyMatch(function, 'l+f', 'leaf'), True)
        self.assertEqual(_applyMatch(function, 'l+f', 'lof'), True)
        self.assertEqual(_applyMatch(function, 'l+f', 'lf'), False)
        self.assertEqual(_applyMatch(function, 'l+f', 'l'), False)

        self.assertEqual(_applyMatch(function, 'l?f', 'leaf'), False)
        self.assertEqual(_applyMatch(function, 'l?f', 'lof'), True)
        self.assertEqual(_applyMatch(function, 'l?f', 'lf'), True)
        self.assertEqual(_applyMatch(function, 'l?f', 'l'), False)

        self.assertEqual(_applyMatch(function, 'l.f', 'leaf'), False)
        self.assertEqual(_applyMatch(function, 'l.f', 'lof'), True)
        self.assertEqual(_applyMatch(function, 'l.f', 'lf'), False)
        self.assertEqual(_applyMatch(function, 'l.f', 'l'), False)

        self.assertEqual(_applyMatch(function, 'l..f', 'leaf'), True)
        self.assertEqual(_applyMatch(function, 'l..f', 'lof'), False)
        self.assertEqual(_applyMatch(function, 'l..f', 'lf'), False)
        self.assertEqual(_applyMatch(function, 'l..f', 'l'), False)

        self.assertEqual(_applyMatch(function, 'l??.', 'leaf'), True)
        self.assertEqual(_applyMatch(function, 'l??.', 'lof'), True)
        self.assertEqual(_applyMatch(function, 'l??.', 'lf'), True)
        self.assertEqual(_applyMatch(function, 'l??.', 'l'), False)

        self.assertEqual(_applyMatch(function, 'l.??', 'leaf'), True)
        self.assertEqual(_applyMatch(function, 'l.??', 'lof'), True)
        self.assertEqual(_applyMatch(function, 'l.??', 'lf'), True)
        self.assertEqual(_applyMatch(function, 'l.??', 'l'), False)

        self.assertEqual(_applyMatch(function, 'l?.?', 'leaf'), True)
        self.assertEqual(_applyMatch(function, 'l?.?', 'lof'), True)
        self.assertEqual(_applyMatch(function, 'l?.?', 'lf'), True)
        self.assertEqual(_applyMatch(function, 'l?.?', 'l'), False)

        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchName, '123', 'abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchName, 'ns:abc', 'abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchName, '|abc', 'abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchName, '|abc->def', 'abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchName, 'abc', '123')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchName, 'abc', 'ns:abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchName, 'abc', '|abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchName, 'abc', '|abc->def')

    def testBnMatchFullName(self):
        function = OpenMaya.MGlobal.bnMatchFullName

        self.assertEqual(_applyMatch(function, 'leaf', 'leaf'), True)
        self.assertEqual(_applyMatch(function, 'leaf', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, 'leaf', 'lf'), False)

        self.assertEqual(_applyMatch(function, 'ns:leaf', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, 'ns:leaf', 'leaf'), False)
        self.assertEqual(_applyMatch(function, 'ns:leaf', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, 'ns:leaf', 'ns:node'), False)

        self.assertEqual(_applyMatch(function, 'ns:nsa:leaf', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, 'ns:nsa:leaf', 'nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, 'ns:nsa:leaf', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, 'ns:nsa:leaf', 'leaf'), False)
        self.assertEqual(_applyMatch(function, 'ns:nsa:leaf', 'ns:nsa:node'), False)

        self.assertEqual(_applyMatch(function, '*', 'leaf'), True)
        self.assertEqual(_applyMatch(function, '*', 'lf'), True)
        self.assertEqual(_applyMatch(function, '*', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '*', 'ns:nsa:nsb:leaf'), True)

        self.assertEqual(_applyMatch(function, '+', 'leaf'), True)
        self.assertEqual(_applyMatch(function, '+', 'lf'), True)
        self.assertEqual(_applyMatch(function, '+', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '+', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '+', 'ns:nsa:nsb:leaf'), True)

        self.assertEqual(_applyMatch(function, '?', 'leaf'), True)
        self.assertEqual(_applyMatch(function, '?', 'lf'), True)
        self.assertEqual(_applyMatch(function, '?', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '?', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, '.', 'leaf'), True)
        self.assertEqual(_applyMatch(function, '.', 'lf'), True)
        self.assertEqual(_applyMatch(function, '.', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '.', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, '*:leaf', 'leaf'), True)
        self.assertEqual(_applyMatch(function, '*:leaf', 'lf'), False)
        self.assertEqual(_applyMatch(function, '*:leaf', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*:leaf', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '*:leaf', 'ns:nsa:nsb:leaf'), True)

        self.assertEqual(_applyMatch(function, '+:leaf', 'leaf'), False)
        self.assertEqual(_applyMatch(function, '+:leaf', 'lf'), False)
        self.assertEqual(_applyMatch(function, '+:leaf', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '+:leaf', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '+:leaf', 'ns:nsa:nsb:leaf'), True)

        self.assertEqual(_applyMatch(function, '?:leaf', 'leaf'), True)
        self.assertEqual(_applyMatch(function, '?:leaf', 'lf'), False)
        self.assertEqual(_applyMatch(function, '?:leaf', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '?:leaf', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '?:leaf', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, '.:leaf', 'leaf'), False)
        self.assertEqual(_applyMatch(function, '.:leaf', 'lf'), False)
        self.assertEqual(_applyMatch(function, '.:leaf', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '.:leaf', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '.:leaf', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, ':*:leaf', 'leaf'), True)
        self.assertEqual(_applyMatch(function, ':*:leaf', 'lf'), False)
        self.assertEqual(_applyMatch(function, ':*:leaf', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, ':*:leaf', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, ':*:leaf', 'ns:nsa:nsb:leaf'), True)

        self.assertEqual(_applyMatch(function, ':+:leaf', 'leaf'), False)
        self.assertEqual(_applyMatch(function, ':+:leaf', 'lf'), False)
        self.assertEqual(_applyMatch(function, ':+:leaf', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, ':+:leaf', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, ':+:leaf', 'ns:nsa:nsb:leaf'), True)

        self.assertEqual(_applyMatch(function, ':?:leaf', 'leaf'), True)
        self.assertEqual(_applyMatch(function, ':?:leaf', 'lf'), False)
        self.assertEqual(_applyMatch(function, ':?:leaf', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, ':?:leaf', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, ':?:leaf', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, ':.:leaf', 'leaf'), False)
        self.assertEqual(_applyMatch(function, ':.:leaf', 'lf'), False)
        self.assertEqual(_applyMatch(function, ':.:leaf', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, ':.:leaf', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, ':.:leaf', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, 'ns:*', 'leaf'), False)
        self.assertEqual(_applyMatch(function, 'ns:*', 'lf'), False)
        self.assertEqual(_applyMatch(function, 'ns:*', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, 'ns:*', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, 'ns:*', 'ns:nsa:nsb:leaf'), True)

        self.assertEqual(_applyMatch(function, 'ns:+', 'leaf'), False)
        self.assertEqual(_applyMatch(function, 'ns:+', 'lf'), False)
        self.assertEqual(_applyMatch(function, 'ns:+', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, 'ns:+', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, 'ns:+', 'ns:nsa:nsb:leaf'), True)

        self.assertEqual(_applyMatch(function, 'ns:?', 'leaf'), False)
        self.assertEqual(_applyMatch(function, 'ns:?', 'lf'), False)
        self.assertEqual(_applyMatch(function, 'ns:?', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, 'ns:?', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, 'ns:?', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, 'ns:.', 'leaf'), False)
        self.assertEqual(_applyMatch(function, 'ns:.', 'lf'), False)
        self.assertEqual(_applyMatch(function, 'ns:.', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, 'ns:.', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, 'ns:.', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, 'l*', 'leaf'), True)
        self.assertEqual(_applyMatch(function, 'l*', 'lf'), True)
        self.assertEqual(_applyMatch(function, 'l*', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, 'l*', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, 'l*', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, 'l+', 'leaf'), True)
        self.assertEqual(_applyMatch(function, 'l+', 'lf'), True)
        self.assertEqual(_applyMatch(function, 'l+', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, 'l+', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, 'l+', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, 'l?', 'leaf'), False)
        self.assertEqual(_applyMatch(function, 'l?', 'lf'), True)
        self.assertEqual(_applyMatch(function, 'l?', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, 'l?', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, 'l?', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, 'l.', 'leaf'), False)
        self.assertEqual(_applyMatch(function, 'l.', 'lf'), True)
        self.assertEqual(_applyMatch(function, 'l.', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, 'l.', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, 'l.', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, '*f', 'leaf'), True)
        self.assertEqual(_applyMatch(function, '*f', 'lf'), True)
        self.assertEqual(_applyMatch(function, '*f', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*f', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '*f', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, '+f', 'leaf'), True)
        self.assertEqual(_applyMatch(function, '+f', 'lf'), True)
        self.assertEqual(_applyMatch(function, '+f', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+f', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '+f', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, '?f', 'leaf'), False)
        self.assertEqual(_applyMatch(function, '?f', 'lf'), True)
        self.assertEqual(_applyMatch(function, '?f', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?f', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '?f', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, '.f', 'leaf'), False)
        self.assertEqual(_applyMatch(function, '.f', 'lf'), True)
        self.assertEqual(_applyMatch(function, '.f', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.f', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '.f', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, 'l*f', 'leaf'), True)
        self.assertEqual(_applyMatch(function, 'l*f', 'lf'), True)
        self.assertEqual(_applyMatch(function, 'l*f', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, 'l*f', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, 'l*f', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, 'l+f', 'leaf'), True)
        self.assertEqual(_applyMatch(function, 'l+f', 'lf'), False)
        self.assertEqual(_applyMatch(function, 'l+f', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, 'l+f', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, 'l+f', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, 'l?f', 'leaf'), False)
        self.assertEqual(_applyMatch(function, 'l?f', 'lf'), True)
        self.assertEqual(_applyMatch(function, 'l?f', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, 'l?f', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, 'l?f', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, 'l.f', 'leaf'), False)
        self.assertEqual(_applyMatch(function, 'l.f', 'lf'), False)
        self.assertEqual(_applyMatch(function, 'l.f', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, 'l.f', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, 'l.f', 'ns:nsa:nsb:leaf'), False)

        self.assertEqual(_applyMatch(function, '..:leaf', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '..:leaf', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '..:leaf', 'ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '..:leaf', 'leaf'), False)

        self.assertEqual(_applyMatch(function, '...:leaf', 'ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '...:leaf', 'ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '...:leaf', 'ns:nsa:nsb:nsc:leaf'), False)
        self.assertEqual(_applyMatch(function, '...:leaf', 'leaf'), False)

        self.assertEqual(_applyMatch(function, '.?:leaf', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '.?:leaf', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '.?:leaf', 'ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '.?:leaf', 'leaf'), False)

        self.assertEqual(_applyMatch(function, '?.:leaf', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '?.:leaf', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '?.:leaf', 'ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '?.:leaf', 'leaf'), False)

        self.assertEqual(_applyMatch(function, '..?:leaf', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '..?:leaf', 'ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '..?:leaf', 'ns:nsa:nsb:nsc:leaf'), False)
        self.assertEqual(_applyMatch(function, '..?:leaf', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '..?:leaf', 'leaf'), False)

        self.assertEqual(_applyMatch(function, '?..:leaf', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '?..:leaf', 'ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '?..:leaf', 'ns:nsa:nsb:nsc:leaf'), False)
        self.assertEqual(_applyMatch(function, '?..:leaf', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?..:leaf', 'leaf'), False)

        self.assertEqual(_applyMatch(function, '.?.:leaf', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '.?.:leaf', 'ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '.?.:leaf', 'ns:nsa:nsb:nsc:leaf'), False)
        self.assertEqual(_applyMatch(function, '.?.:leaf', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.?.:leaf', 'leaf'), False)

        self.assertEqual(_applyMatch(function, '.*:leaf', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '.*:leaf', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '.*:leaf', 'ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '.*:leaf', 'ns:nsa:nsb:nsc:leaf'), True)
        self.assertEqual(_applyMatch(function, '.*:leaf', 'leaf'), False)

        self.assertEqual(_applyMatch(function, '*.:leaf', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*.:leaf', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '*.:leaf', 'ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '*.:leaf', 'ns:nsa:nsb:nsc:leaf'), True)
        self.assertEqual(_applyMatch(function, '*.:leaf', 'leaf'), False)

        self.assertEqual(_applyMatch(function, '.+:leaf', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.+:leaf', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '.+:leaf', 'ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '.+:leaf', 'ns:nsa:nsb:nsc:leaf'), True)
        self.assertEqual(_applyMatch(function, '.+:leaf', 'leaf'), False)

        self.assertEqual(_applyMatch(function, '+.:leaf', 'ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+.:leaf', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '+.:leaf', 'ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '+.:leaf', 'ns:nsa:nsb:nsc:leaf'), True)
        self.assertEqual(_applyMatch(function, '+.:leaf', 'leaf'), False)

        self.assertEqual(_applyMatch(function, '*:leaf', 'leaf'), True)
        self.assertEqual(_applyMatch(function, '*:leaf', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*:leaf', 'nsa:nsb:leaf'), True)

        self.assertEqual(_applyMatch(function, 'ns:.', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, 'ns:.', 'ns:nsa:leaf'), False)

        self.assertEqual(_applyMatch(function, 'ns:+', 'ns:leaf'), True)
        self.assertEqual(_applyMatch(function, 'ns:+', 'ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, 'ns:+', 'ns:nsa:nsb:leaf'), True)

        self.assertEqual(_applyMatch(function, 'leaf', 'leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'leaf', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'leaf', 'lf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, 'ns:leaf', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'ns:leaf', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:leaf', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:leaf', 'ns:node', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, 'ns:nsa:leaf', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'ns:nsa:leaf', 'nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:nsa:leaf', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:nsa:leaf', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:nsa:leaf', 'ns:nsa:node', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, ':leaf', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, ':leaf', 'ns:leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '*', 'leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', 'lf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', 'ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', ':leaf', matchRelative=True), True)

        self.assertEqual(_applyMatch(function, '+', 'leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', 'lf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', 'ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', ':leaf', matchRelative=True), True)

        self.assertEqual(_applyMatch(function, '?', 'leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', 'lf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', ':leaf', matchRelative=True), True)

        self.assertEqual(_applyMatch(function, '.', 'leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', 'lf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', ':leaf', matchRelative=True), True)

        self.assertEqual(_applyMatch(function, '*:leaf', 'leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*:leaf', 'lf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*:leaf', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*:leaf', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*:leaf', ':leaf', matchRelative=True), True)

        self.assertEqual(_applyMatch(function, '+:leaf', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+:leaf', 'lf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+:leaf', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+:leaf', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+:leaf', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '?:leaf', 'leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?:leaf', 'lf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?:leaf', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?:leaf', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?:leaf', ':leaf', matchRelative=True), True)

        self.assertEqual(_applyMatch(function, '.:leaf', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.:leaf', 'lf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.:leaf', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.:leaf', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.:leaf', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, ':*:leaf', 'leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, ':*:leaf', 'lf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, ':*:leaf', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, ':*:leaf', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, ':*:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, ':*:leaf', ':leaf', matchRelative=True), True)

        self.assertEqual(_applyMatch(function, ':+:leaf', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, ':+:leaf', 'lf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, ':+:leaf', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, ':+:leaf', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, ':+:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, ':+:leaf', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, ':?:leaf', 'leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, ':?:leaf', 'lf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, ':?:leaf', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, ':?:leaf', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, ':?:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, ':?:leaf', ':leaf', matchRelative=True), True)

        self.assertEqual(_applyMatch(function, ':.:leaf', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, ':.:leaf', 'lf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, ':.:leaf', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, ':.:leaf', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, ':.:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, ':.:leaf', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, 'ns:*', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:*', 'lf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:*', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'ns:*', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'ns:*', 'ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'ns:*', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, 'ns:+', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:+', 'lf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:+', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'ns:+', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'ns:+', 'ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'ns:+', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, 'ns:?', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:?', 'lf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:?', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'ns:?', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:?', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:?', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, 'ns:.', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:.', 'lf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:.', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'ns:.', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:.', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'ns:.', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, 'l*', 'leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'l*', 'lf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'l*', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l*', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l*', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l*', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, 'l+', 'leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'l+', 'lf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'l+', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l+', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l+', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l+', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, 'l?', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l?', 'lf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'l?', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l?', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l?', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l?', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, 'l.', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l.', 'lf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'l.', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l.', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l.', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l.', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '*f', 'leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*f', 'lf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*f', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*f', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*f', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*f', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '+f', 'leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+f', 'lf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+f', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+f', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+f', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+f', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '?f', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?f', 'lf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?f', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?f', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?f', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?f', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '.f', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.f', 'lf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.f', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.f', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.f', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.f', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, 'l*f', 'leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'l*f', 'lf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'l*f', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l*f', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l*f', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l*f', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, 'l+f', 'leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'l+f', 'lf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l+f', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l+f', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l+f', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l+f', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, 'l?f', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l?f', 'lf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'l?f', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l?f', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l?f', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l?f', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, 'l.f', 'leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l.f', 'lf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l.f', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l.f', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l.f', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, 'l.f', ':leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '..:leaf', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '..:leaf', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '..:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '..:leaf', 'leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '...:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '...:leaf', 'ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '...:leaf', 'ns:nsa:nsb:nsc:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '...:leaf', 'leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '.?:leaf', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.?:leaf', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.?:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.?:leaf', 'leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '?.:leaf', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?.:leaf', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?.:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?.:leaf', 'leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '..?:leaf', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '..?:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '..?:leaf', 'ns:nsa:nsb:nsc:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '..?:leaf', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '..?:leaf', 'leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '?..:leaf', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?..:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?..:leaf', 'ns:nsa:nsb:nsc:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?..:leaf', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?..:leaf', 'leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '.?.:leaf', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.?.:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.?.:leaf', 'ns:nsa:nsb:nsc:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.?.:leaf', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.?.:leaf', 'leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '.*:leaf', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.*:leaf', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.*:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.*:leaf', 'ns:nsa:nsb:nsc:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.*:leaf', 'leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '*.:leaf', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*.:leaf', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*.:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*.:leaf', 'ns:nsa:nsb:nsc:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*.:leaf', 'leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '.+:leaf', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.+:leaf', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.+:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.+:leaf', 'ns:nsa:nsb:nsc:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.+:leaf', 'leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '+.:leaf', 'ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+.:leaf', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+.:leaf', 'ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+.:leaf', 'ns:nsa:nsb:nsc:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+.:leaf', 'leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '*:leaf', 'leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*:leaf', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*:leaf', 'nsa:nsb:leaf', matchRelative=True), True)

        self.assertEqual(_applyMatch(function, 'ns:.', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'ns:.', 'ns:nsa:leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, 'ns:+', 'ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'ns:+', 'ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, 'ns:+', 'ns:nsa:nsb:leaf', matchRelative=True), True)

        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchFullName, '123', 'abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchFullName, '|abc', 'abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchFullName, '|abc->def', 'abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchFullName, 'abc', '123')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchFullName, 'abc', '|abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchFullName, 'abc', '|abc->def')

    def testBnMatchPath(self):
        function = OpenMaya.MGlobal.bnMatchPath

        self.assertEqual(_applyMatch(function, '|leaf', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|leaf', '|root|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:leaf', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:leaf', '|root|ns:leaf'), False)

        self.assertEqual(_applyMatch(function, '|root|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|world|root|leaf'), False)

        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|root|node|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|world|root|ns:leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|ns:root'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|ns:root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|world|ns:root|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|ns:root|node|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|world|ns:root|ns:leaf'), False)

        self.assertEqual(_applyMatch(function, '*', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root'), True)
        self.assertEqual(_applyMatch(function, '*', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root|node|node2|leaf'), True)

        self.assertEqual(_applyMatch(function, '+', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root'), True)
        self.assertEqual(_applyMatch(function, '+', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root|node|node2|leaf'), True)

        self.assertEqual(_applyMatch(function, '?', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '?', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '?', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '?', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '?', '|root'), True)
        self.assertEqual(_applyMatch(function, '?', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '.', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '.', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '.', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '.', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '.', '|root'), True)
        self.assertEqual(_applyMatch(function, '.', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '*|leaf', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|node|node2|leaf'), True)

        self.assertEqual(_applyMatch(function, '+|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|node|node2|leaf'), True)

        self.assertEqual(_applyMatch(function, '?|leaf', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '.|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:*', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:+', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:?', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:.', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|root|*', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|node|node2|leaf'), True)

        self.assertEqual(_applyMatch(function, '|root|+', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|node|node2|leaf'), True)

        self.assertEqual(_applyMatch(function, '|root|?', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|root|.', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|node|node2|leaf'), True)

        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|node|node2|leaf'), True)

        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|*', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|root'), True)
        self.assertEqual(_applyMatch(function, '|*', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|root|node|node2|leaf'), True)

        self.assertEqual(_applyMatch(function, '|+', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|root'), True)
        self.assertEqual(_applyMatch(function, '|+', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|root|node|node2|leaf'), True)

        self.assertEqual(_applyMatch(function, '|?', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|?', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|?', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|?', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '|?', '|root'), True)
        self.assertEqual(_applyMatch(function, '|?', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|.', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|.', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|.', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|.', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '|.', '|root'), True)
        self.assertEqual(_applyMatch(function, '|.', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '*|*', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root|node|node2|leaf'), True)

        self.assertEqual(_applyMatch(function, '+|+', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|+', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '+|+', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '+|+', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|+', '|root|node|node2|leaf'), True)

        self.assertEqual(_applyMatch(function, '?|?', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|root'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '.|.', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.|.', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '.|.', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '.|.', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|*|leaf', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|node|node2|leaf'), True)

        self.assertEqual(_applyMatch(function, '|+|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|node|node2|leaf'), True)

        self.assertEqual(_applyMatch(function, '|?|leaf', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|.|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|l+', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|l?', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|l.', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|*f', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|+f', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|?f', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|.f', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|l*f', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|l+f', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|l?f', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|l.f', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:*f', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:+f', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:?f', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:.f', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|node|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '..', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '..', '|root'), False)
        self.assertEqual(_applyMatch(function, '..', '|root|node|leaf'), False)

        self.assertEqual(_applyMatch(function, '..|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '..|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '..|leaf', '|root|node1|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '...|leaf', '|root|node1|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '...|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '...|leaf', '|root|node1|node2|node3|leaf'), False)

        self.assertEqual(_applyMatch(function, '.?|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.?|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '.?|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '.?|leaf', '|root|node1|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '?.|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?.|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '?.|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '?.|leaf', '|root|node1|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '..?|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '..?|leaf', '|root|node1|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '..?|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '..?|leaf', '|root|node1|node2|node3|leaf'), False)

        self.assertEqual(_applyMatch(function, '?..|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '?..|leaf', '|root|node1|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '?..|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '?..|leaf', '|root|node1|node2|node3|leaf'), False)

        self.assertEqual(_applyMatch(function, '.?.|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '.?.|leaf', '|root|node1|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '.?.|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '.?.|leaf', '|root|node1|node2|node3|leaf'), False)

        self.assertEqual(_applyMatch(function, '.*|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.*|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '.*|leaf', '|root|node1|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '.*|leaf', '|root|node1|node2|node3|leaf'), True)
        self.assertEqual(_applyMatch(function, '.*|leaf', '|leaf'), False)

        self.assertEqual(_applyMatch(function, '*.|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*.|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '*.|leaf', '|root|node1|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '*.|leaf', '|root|node1|node2|node3|leaf'), True)
        self.assertEqual(_applyMatch(function, '*.|leaf', '|leaf'), False)

        self.assertEqual(_applyMatch(function, '.+|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '.+|leaf', '|root|node1|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '.+|leaf', '|root|node1|node2|node3|leaf'), True)
        self.assertEqual(_applyMatch(function, '.+|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '.+|leaf', '|leaf'), False)

        self.assertEqual(_applyMatch(function, '+.|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '+.|leaf', '|root|node1|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '+.|leaf', '|root|node1|node2|node3|leaf'), True)
        self.assertEqual(_applyMatch(function, '+.|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '+.|leaf', '|leaf'), False)

        self.assertEqual(_applyMatch(function, '|.', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|.', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|.', '|root|leaf'), False)

        self.assertEqual(_applyMatch(function, '|:.', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|:.', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|:.', '|root|leaf'), False)

        self.assertEqual(_applyMatch(function, '|:..', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|:..', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|:..', '|root|leaf'), False)

        self.assertEqual(_applyMatch(function, '+|*Shape*', '|cube|cubeShape'), True)
        self.assertEqual(_applyMatch(function, '+|*Shape*', '|root|sphere|sphereShape1'), True)
        self.assertEqual(_applyMatch(function, '+|*Shape*', '|cube|ns:cubeShape'), False)

        self.assertEqual(_applyMatch(function, '+|*:*Shape*', '|cube|cubeShape'), True)
        self.assertEqual(_applyMatch(function, '+|*:*Shape*', '|root|sphere|sphereShape1'), True)
        self.assertEqual(_applyMatch(function, '+|*:*Shape*', '|cube|ns:cubeShape'), True)

        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchPath, '123', '|abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchPath, 'abc', '|abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchPath, 'ns:abc', '|abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchPath, '|abc->def', '|abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchPath, '|abc', '123')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchPath, '|abc', 'abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchPath, '|abc', 'ns:abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchPath, '|abc', '|abc->def')

    def testBnMatchFullPath(self):
        function = OpenMaya.MGlobal.bnMatchFullPath

        self.assertEqual(_applyMatch(function, '|leaf', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|leaf', '|root->|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:leaf', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:leaf', '|root->|ns:leaf'), False)

        self.assertEqual(_applyMatch(function, '|root|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|world|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|root->|leaf'), False)

        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|root|node|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|world|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|root->|ns:leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|ns:root'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|ns:root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|world|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|ns:root->|leaf'), False)

        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|ns:root|node|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|world|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|ns:root->|ns:leaf'), False)

        self.assertEqual(_applyMatch(function, '|root->|leaf', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->|leaf', '|root->|ns:leaf'), False)

        self.assertEqual(_applyMatch(function, '|root->', '|root->'), True)
        self.assertEqual(_applyMatch(function, '|root->', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root->', '|root->|leaf'), False)

        self.assertEqual(_applyMatch(function, '*', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root'), True)
        self.assertEqual(_applyMatch(function, '*', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root->|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:nsa:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:root->|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root|node|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root->|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root->|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root->|node->|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*', '|root->'), True)
        self.assertEqual(_applyMatch(function, '*', '|root->|node->'), True)

        self.assertEqual(_applyMatch(function, '+', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root'), True)
        self.assertEqual(_applyMatch(function, '+', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root->|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:nsa:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:root->|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root|node|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root->|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root->|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root->|node->|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+', '|root->'), True)
        self.assertEqual(_applyMatch(function, '+', '|root->|node->'), True)

        self.assertEqual(_applyMatch(function, '?', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '?', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '?', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '?', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '?', '|root'), True)
        self.assertEqual(_applyMatch(function, '?', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '?', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '?', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '?', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '?', '|root|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '?', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?', '|root->'), False)
        self.assertEqual(_applyMatch(function, '?', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '.', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '.', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '.', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '.', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '.', '|root'), True)
        self.assertEqual(_applyMatch(function, '.', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '.', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '.', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '.', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '.', '|root|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '.', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.', '|root->'), False)
        self.assertEqual(_applyMatch(function, '.', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '*|leaf', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '+|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '?|leaf', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '.|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '*->|leaf', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:nsa:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root|node|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root->|node->|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '+->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:nsa:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root|node|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root->|node->|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '?->|leaf', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:nsa:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root|node|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '.->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:nsa:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root|node|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:*', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:+', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:?', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:.', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:nsa:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:nsa:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root|*', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root|+', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root|?', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root|.', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root|node|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root|node|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root->*', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->*', '|root->|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root->|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->*', '|root->|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->*', '|root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->*', '|root->|node->|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root->'), True)
        self.assertEqual(_applyMatch(function, '|root->*', '|root->|node->'), True)

        self.assertEqual(_applyMatch(function, '|root->+', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->+', '|root->|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root->|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->+', '|root->|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->+', '|root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->+', '|root->|node->|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root->|node->'), True)

        self.assertEqual(_applyMatch(function, '|root->?', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->?', '|root->|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root->|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->?', '|root->|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->?', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root->'), True)
        self.assertEqual(_applyMatch(function, '|root->?', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root->.', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->.', '|root->|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root->|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->.', '|root->|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->.', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root->|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root->|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root->|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root->|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root->|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root->|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root->|node->|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root->|node->|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|*', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|root'), True)
        self.assertEqual(_applyMatch(function, '|*', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|root|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|*', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|+', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|root'), True)
        self.assertEqual(_applyMatch(function, '|+', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|root|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|+', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|?', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|?', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|?', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|?', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '|?', '|root'), True)
        self.assertEqual(_applyMatch(function, '|?', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|?', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|.', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|.', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|.', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '|.', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '|.', '|root'), True)
        self.assertEqual(_applyMatch(function, '|.', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|.', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '*|*', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root->'), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '+|+', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|+', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '+|+', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '+|+', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|+', '|root|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '+|+', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root->'), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '?|?', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:nsa:nsb:leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|root'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '?|?', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root->'), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '.|.', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.|.', '|root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '.|.', '|root|ns:nsa:leaf'), True)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:root|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '.|.', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root->'), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|*|leaf', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|+|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|node|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|?|leaf', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|.|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:nsa:root|leaf'), True)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:nsa:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root|node|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root->|node->|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root->|node->|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:nsa:root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root|node|node2->|leaf'), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:root->|node->|leaf'), True)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root->'), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|l*', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|l+', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|l?', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|l.', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|*f', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|+f', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|?f', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|.f', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|l*f', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|l+f', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|l?f', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|l.f', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:*f', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:+f', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:?f', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '|ns:.f', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:nsa:nsb:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|ns:nsa:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:nsa:root|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:root|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:nsa:root->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:root->|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|node|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root->|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root->|node|node2|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root->|node->|node2->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:root->|node->|leaf'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root->'), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root->|node->'), False)

        self.assertEqual(_applyMatch(function, '..', '|root->'), True)
        self.assertEqual(_applyMatch(function, '..', '|root->|leaf'), True)
        self.assertEqual(_applyMatch(function, '..', '|root'), False)
        self.assertEqual(_applyMatch(function, '..', '|root->|node->'), False)
        self.assertEqual(_applyMatch(function, '..', '|root->|node->|leaf'), False)

        self.assertEqual(_applyMatch(function, '..|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '..|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '..|leaf', '|root|node1|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '...|leaf', '|root|node1|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '...|leaf', '|root|node|leaf'), False)
        self.assertEqual(_applyMatch(function, '...|leaf', '|root|node1|node2|node3|leaf'), False)

        self.assertEqual(_applyMatch(function, '.?|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.?|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '.?|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '.?|leaf', '|root|node1|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '?.|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '?.|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '?.|leaf', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '?.|leaf', '|root|node1|node2|leaf'), False)

        self.assertEqual(_applyMatch(function, '..?|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '..?|leaf', '|root|node1|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '..?|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '..?|leaf', '|root|node1|node2|node3|leaf'), False)

        self.assertEqual(_applyMatch(function, '?..|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '?..|leaf', '|root|node1|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '?..|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '?..|leaf', '|root|node1|node2|node3|leaf'), False)

        self.assertEqual(_applyMatch(function, '.?.|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '.?.|leaf', '|root|node1|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '.?.|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '.?.|leaf', '|root|node1|node2|node3|leaf'), False)

        self.assertEqual(_applyMatch(function, '.*|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '.*|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '.*|leaf', '|root|node1|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '.*|leaf', '|root|node1|node2|node3|leaf'), True)
        self.assertEqual(_applyMatch(function, '.*|leaf', '|leaf'), False)

        self.assertEqual(_applyMatch(function, '*.|leaf', '|root|leaf'), True)
        self.assertEqual(_applyMatch(function, '*.|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '*.|leaf', '|root|node1|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '*.|leaf', '|root|node1|node2|node3|leaf'), True)
        self.assertEqual(_applyMatch(function, '*.|leaf', '|leaf'), False)

        self.assertEqual(_applyMatch(function, '.+|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '.+|leaf', '|root|node1|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '.+|leaf', '|root|node1|node2|node3|leaf'), True)
        self.assertEqual(_applyMatch(function, '.+|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '.+|leaf', '|leaf'), False)

        self.assertEqual(_applyMatch(function, '+.|leaf', '|root|node|leaf'), True)
        self.assertEqual(_applyMatch(function, '+.|leaf', '|root|node1|node2|leaf'), True)
        self.assertEqual(_applyMatch(function, '+.|leaf', '|root|node1|node2|node3|leaf'), True)
        self.assertEqual(_applyMatch(function, '+.|leaf', '|root|leaf'), False)
        self.assertEqual(_applyMatch(function, '+.|leaf', '|leaf'), False)

        self.assertEqual(_applyMatch(function, '|.', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|.', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|.', '|root|leaf'), False)

        self.assertEqual(_applyMatch(function, '|:.', '|leaf'), True)
        self.assertEqual(_applyMatch(function, '|:.', '|ns:leaf'), False)
        self.assertEqual(_applyMatch(function, '|:.', '|root|leaf'), False)

        self.assertEqual(_applyMatch(function, '|:..', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|:..', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|:..', '|root|leaf'), False)

        self.assertEqual(_applyMatch(function, '+|*Shape*', '|cube|cubeShape'), True)
        self.assertEqual(_applyMatch(function, '+|*Shape*', '|root|sphere|sphereShape1'), True)
        self.assertEqual(_applyMatch(function, '+|*Shape*', '|cube|ns:cubeShape'), False)

        self.assertEqual(_applyMatch(function, '+|*:*Shape*', '|cube|cubeShape'), True)
        self.assertEqual(_applyMatch(function, '+|*:*Shape*', '|root|sphere|sphereShape1'), True)
        self.assertEqual(_applyMatch(function, '+|*:*Shape*', '|cube|ns:cubeShape'), True)

        self.assertEqual(_applyMatch(function, '|leaf', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|leaf', '|root->|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:leaf', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:leaf', '|root->|ns:leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|world|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|leaf', '|root->|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|root|node|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|world|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|ns:leaf', '|root->|ns:leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|ns:root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|ns:root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|world|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:root|leaf', '|ns:root->|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|ns:root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|ns:root|node|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|world|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:root|ns:leaf', '|ns:root->|ns:leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root->|leaf', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->|leaf', '|root->|ns:leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root->', '|root->', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->', '|root->|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '->|leaf', '->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '->|leaf', '|root->|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '*', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|root', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|root|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|root|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|root->|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:nsa:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:root->|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|root|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|root|node|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|root->|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|root->|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|root->|node->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|ns:root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|root->', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '|root->|node->', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '->|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '->|node1->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '->|leaf->', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*', '->', matchRelative=True), True)

        self.assertEqual(_applyMatch(function, '+', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|root', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|root|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|root|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|root->|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:nsa:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:root->|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|root|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|root|node|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|root->|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|root->|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|root->|node->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|ns:root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|root->', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '|root->|node->', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '->|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '->|node1->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '->|leaf->', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+', '->', matchRelative=True), True)

        self.assertEqual(_applyMatch(function, '?', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', '|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', '|ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', '|root', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', '|root|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', '|ns:root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', '|root|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', '->|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?', '->', matchRelative=True), True)

        self.assertEqual(_applyMatch(function, '.', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', '|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', '|ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', '|root', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', '|root|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', '|ns:root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', '|root|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', '->|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.', '->', matchRelative=True), True)

        self.assertEqual(_applyMatch(function, '*|leaf', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '+|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '?|leaf', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '.|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '*->|leaf', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root|node|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|ns:root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '->|node1->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '+->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root|node|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|ns:root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '->|node1->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '?->|leaf', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root|node|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '.->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root|node|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.->|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:*', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:+', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:?', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:.', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*:leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+:leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?:leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.:leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|*', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|*', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|+', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|+', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|?', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|.', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*:leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+:leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?:leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.:leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root|node|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|*->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root|node|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|+->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|?->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root|.->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root->*', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->*', '|root->|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root->|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->*', '|root->|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->*', '|root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->*', '|root->|node->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->*', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '|root->', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->*', '|root->|node->', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->*', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root->+', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->+', '|root->|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root->|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->+', '|root->|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->+', '|root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->+', '|root->|node->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->+', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '|root->|node->', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->+', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root->?', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->?', '|root->|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root->|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->?', '|root->|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->?', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '|root->', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->?', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root->.', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->.', '|root->|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root->|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->.', '|root->|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->.', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root->|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root->|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root->|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root->|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root->|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root->|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->*->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->+->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->?->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|root->.->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|*', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*', '|root', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*', '|root|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*', '|ns:root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*', '|root|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|+', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+', '|root', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+', '|root|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+', '|ns:root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+', '|root|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|?', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|?', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|?', '|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|?', '|ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|?', '|root', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|?', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|.', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|.', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|.', '|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|.', '|ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|.', '|root', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|.', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '*|*', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*|*', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*|*', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '+|+', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|+', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|+', '|root|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|+', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|+', '|root|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|+', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+|+', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '?|?', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:nsa:nsb:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?|?', '|root', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?|?', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?|?', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?|?', '|root|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?|?', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?|?', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '.|.', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.|.', '|root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.|.', '|root|ns:nsa:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:root|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.|.', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.|.', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|*|leaf', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|+|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|node|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|?|leaf', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|.|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:nsa:root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root|node|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|ns:root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '->|node1->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '*->*->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|ns:root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '->|node1->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+->+->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root|node|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|ns:root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '->|node1->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?->?->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|ns:root->|node->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '->|node1->|node2->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.->.->|leaf', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|l*', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|l+', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|l?', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|l.', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|*f', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|*f', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|+f', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|+f', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|?f', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|?f', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|.f', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|.f', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|l*f', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l*f', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|l+f', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l+f', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|l?f', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l?f', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|l.f', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|l.f', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:*f', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:*f', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:+f', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:+f', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:?f', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:?f', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|ns:.f', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:nsa:nsb:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|ns:nsa:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:nsa:root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:root|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:nsa:root->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:root->|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root|node|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root->|node|node2|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root->|node->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|ns:root->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '->|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '->|node->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '->|node1->|node2->|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '->|leaf->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|ns:.f', '->', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '..', '|root->', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '..', '|root->|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '..', '|root', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '..', '|root->|node->', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '..', '|root->|node->|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '..|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '..|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '..|leaf', '|root|node1|node2|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '...|leaf', '|root|node1|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '...|leaf', '|root|node|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '...|leaf', '|root|node1|node2|node3|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '.?|leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.?|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.?|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.?|leaf', '|root|node1|node2|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '?.|leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?.|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?.|leaf', '|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?.|leaf', '|root|node1|node2|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '..?|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '..?|leaf', '|root|node1|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '..?|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '..?|leaf', '|root|node1|node2|node3|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '?..|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?..|leaf', '|root|node1|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '?..|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '?..|leaf', '|root|node1|node2|node3|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '.?.|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.?.|leaf', '|root|node1|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.?.|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.?.|leaf', '|root|node1|node2|node3|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '.*|leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.*|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.*|leaf', '|root|node1|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.*|leaf', '|root|node1|node2|node3|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.*|leaf', '|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '*.|leaf', '|root|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*.|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*.|leaf', '|root|node1|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*.|leaf', '|root|node1|node2|node3|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '*.|leaf', '|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '.+|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.+|leaf', '|root|node1|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.+|leaf', '|root|node1|node2|node3|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '.+|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '.+|leaf', '|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '+.|leaf', '|root|node|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+.|leaf', '|root|node1|node2|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+.|leaf', '|root|node1|node2|node3|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+.|leaf', '|root|leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '+.|leaf', '|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|.', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|.', '|ns:leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|.', '|root|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|:.', '|leaf', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '|:.', '|ns:leaf', matchRelative=True), False)
        self.assertEqual(_applyMatch(function, '|:.', '|root|leaf', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '|:..', '|ns:leaf'), True)
        self.assertEqual(_applyMatch(function, '|:..', '|leaf'), False)
        self.assertEqual(_applyMatch(function, '|:..', '|root|leaf'), False)

        self.assertEqual(_applyMatch(function, '+|*Shape*', '|cube|cubeShape', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|*Shape*', '|root|sphere|sphereShape1', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|*Shape*', '|cube|ns:cubeShape', matchRelative=True), False)

        self.assertEqual(_applyMatch(function, '+|*:*Shape*', '|cube|cubeShape', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|*:*Shape*', '|root|sphere|sphereShape1', matchRelative=True), True)
        self.assertEqual(_applyMatch(function, '+|*:*Shape*', '|cube|ns:cubeShape', matchRelative=True), True)

        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchFullPath, '123', '|abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchFullPath, 'abc', '|abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchFullPath, 'ns:abc', '|abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchFullPath, '|abc', '123')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchFullPath, '|abc', 'abc')
        self.assertRaises(ValueError, OpenMaya.MGlobal.bnMatchFullPath, '|abc', 'ns:abc')


if __name__ == '__main__':
    from tests.run import run
    run('__main__')
