summaryrefslogtreecommitdiff
path: root/tests/test_rdf.py
blob: ff8c9313c24eecb6eb260235d9c6a4cf1f5fb4df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-
"""
    Basic RubyLexer Test
    ~~~~~~~~~~~~~~~~~~~~

    :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

import pytest

from pygments.token import Name, Punctuation, Text
from pygments.lexers import TurtleLexer, ShExCLexer


@pytest.fixture(scope='module')
def turtle_lexer():
    yield TurtleLexer()

@pytest.fixture(scope='module')
def shexc_lexer():
    yield ShExCLexer()

def test_turtle_prefixed_name_starting_with_number(turtle_lexer):
    fragment = 'alice:6f6e4241-75a2-4780-9b2a-40da53082e54\n'
    tokens = [
        (Name.Namespace, 'alice'),
        (Punctuation, ':'),
        (Name.Tag, '6f6e4241-75a2-4780-9b2a-40da53082e54'),
        (Text, '\n'),
    ]
    assert list(turtle_lexer.get_tokens(fragment)) == tokens

def test_shexc_prefixed_name_starting_with_number(shexc_lexer):
    fragment = 'alice:6f6e4241-75a2-4780-9b2a-40da53082e54\n'
    tokens = [
        (Name.Namespace, 'alice'),
        (Punctuation, ':'),
        (Name.Tag, '6f6e4241-75a2-4780-9b2a-40da53082e54'),
        (Text, '\n'),
    ]
    assert list(shexc_lexer.get_tokens(fragment)) == tokens