mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 19:02:37 +02:00
pep8
This commit is contained in:
parent
53d0d1c249
commit
2e235a9e7a
1 changed files with 7 additions and 2 deletions
|
|
@ -13,6 +13,7 @@
|
|||
else:
|
||||
tokenizers = (python_tokenize_flat, c_tokenize_flat)
|
||||
|
||||
|
||||
def token_api(self, tokenize):
|
||||
for css_source in [
|
||||
'(8, foo, [z])', '[8, foo, (z)]', '{8, foo, [z]}', 'func(8, foo, [z])'
|
||||
|
|
@ -21,6 +22,7 @@ def token_api(self, tokenize):
|
|||
self.ae(len(tokens), 1)
|
||||
self.ae(len(tokens[0].content), 7)
|
||||
|
||||
|
||||
def token_serialize_css(self, tokenize):
|
||||
for tokenize in tokenizers:
|
||||
for css_source in [
|
||||
|
|
@ -40,6 +42,7 @@ def token_serialize_css(self, tokenize):
|
|||
result = ''.join(token.as_css() for token in tokens)
|
||||
self.ae(result, css_source)
|
||||
|
||||
|
||||
def comments(self, tokenize):
|
||||
for ignore_comments, expected_tokens in [
|
||||
(False, [
|
||||
|
|
@ -65,6 +68,7 @@ def comments(self, tokenize):
|
|||
result = list(jsonify(tokens))
|
||||
self.ae(result, expected_tokens)
|
||||
|
||||
|
||||
def token_grouping(self, tokenize):
|
||||
for css_source, expected_tokens in [
|
||||
('', []),
|
||||
|
|
@ -126,6 +130,7 @@ def token_grouping(self, tokenize):
|
|||
result = list(jsonify(tokens))
|
||||
self.ae(result, expected_tokens)
|
||||
|
||||
|
||||
def positions(self, tokenize):
|
||||
css = '/* Lorem\nipsum */\fa {\n color: red;\tcontent: "dolor\\\fsit" }'
|
||||
tokens = tokenize(css, ignore_comments=False)
|
||||
|
|
@ -138,6 +143,7 @@ def positions(self, tokenize):
|
|||
('IDENT', 4, 17), (':', 4, 24), ('S', 4, 25), ('STRING', 4, 26),
|
||||
('S', 5, 5), ('}', 5, 6)])
|
||||
|
||||
|
||||
def tokens(self, tokenize):
|
||||
for css_source, expected_tokens in [
|
||||
('', []),
|
||||
|
|
@ -175,7 +181,7 @@ def tokens(self, tokenize):
|
|||
# Escaping
|
||||
|
||||
(r'/* Comment with a \ backslash */',
|
||||
[('COMMENT', '/* Comment with a \ backslash */')]), # Unchanged
|
||||
[('COMMENT', r'/* Comment with a \ backslash */')]), # Unchanged
|
||||
|
||||
# backslash followed by a newline in a string: ignored
|
||||
('"Lorem\\\nIpsum"', [('STRING', 'LoremIpsum')]),
|
||||
|
|
@ -266,4 +272,3 @@ def test_positions(self):
|
|||
|
||||
def test_tokens(self):
|
||||
self.run_test(tokens)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue