Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testing turtle prefix names where reference starts with number (#1590)
* testing turtle prefix names where reference starts with number * remove case insensitive flag from Turtle lexer * use same end-of-string regex as in SPARQL and ShExC * make example.ttl valid turtle
- Loading branch information
1 parent
97457ad
commit 95935cc
Showing
3 changed files
with
99 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |