Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 277cb76a14
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (33 sloc) 1.14 kb
from nose.tools import eq_
from spritecss.css import parser
from itertools import izip, starmap
def tokenizes_to(css, toks):
got = list(parser.css_tokenize_data(css))
expect = list(starmap(parser.Token, toks))
for got_tok, exp_tok in izip(got, expect):
eq_(got_tok, exp_tok)
def test_tokenize_comments():
tokenizes_to("/*x*/\n",
[('comment_begin', '/*'),
('char', 'x'),
('comment_end', '*/'),
('w', '\n')])
def test_tokenize_block():
tokenizes_to("q{a;b;}",
[('char', 'q'),
('block_begin', '{'),
('char', 'a'),
('semicolon', ';'),
('char', 'b'),
('semicolon', ';'),
('block_end', '}')])
def test_tokenize_quoted():
tokenizes_to(r'"x\\y"zw',
[('char', '"'),
('char', 'x'),
('char', '\\'),
('char', '\\'),
('char', 'y'),
('char', '"'),
('char', 'z'),
('char', 'w')])
Jump to Line
Something went wrong with that request. Please try again.