summaryrefslogtreecommitdiff
path: root/tests/test_template.py
blob: 9ae87171fbc8e621716f139deec76bbcf400dbc4 (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
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""Test template formats."""

import textwrap
import pytest

from pygments.lexers import Angular2HtmlLexer
from pygments.token import Token

@pytest.fixture(scope='module')
def lexer_ng2():
    yield Angular2HtmlLexer()


def testAngularFragment(lexer_ng2):
    # Not starting with v makes this test work (remove the first token  from
    # tokens in that case)
    fragment = 'v*39j5Sq='
    tokens = [
        (Token.Text, 'v'),
        (Token.Punctuation, '*'),
        (Token.Name.Attribute, '39j5Sq'),
        (Token.Operator, '='),
        (Token.Text, '\n')
    ]
    assert list(lexer_ng2.get_tokens(fragment)) == tokens