Example #1
0
def check_token(token, attr_name, config=None, pos=None):
    """
    Raises a `ValueError` if *token* is not a valid XML token.

    As defined by XML Schema Part 2.
    """
    if (token is not None and not xml_check.check_token(token)):
        return False
    return True
Example #2
0
def test_check_token():
    assert check.check_token("token")
    assert not check.check_token("token\rtoken")