mirror of https://github.com/zulip/zulip.git
Finish annotating template/css parsers and tests.
This commit is contained in:
parent
e580ed579b
commit
1eb16d03a2
|
@ -25,6 +25,7 @@ class Token(object):
|
|||
self.col = col
|
||||
|
||||
def tokenize(text):
|
||||
# type: (str) -> List[Token]
|
||||
def advance(n):
|
||||
# type: (int) -> None
|
||||
for _ in range(n):
|
||||
|
@ -119,7 +120,7 @@ def tokenize(text):
|
|||
return tokens
|
||||
|
||||
def validate(fn=None, text=None, check_indent=True):
|
||||
# type: (str, str, bool) -> None
|
||||
# type: (Optional[str], Optional[str], bool) -> None
|
||||
assert fn or text
|
||||
|
||||
if fn is None:
|
||||
|
|
|
@ -119,9 +119,8 @@ class ParserTestSadPath(unittest.TestCase):
|
|||
'''
|
||||
|
||||
def _assert_error(self, my_css, error):
|
||||
# See https://github.com/python/typeshed/issues/372
|
||||
# for why we have to ingore types here.
|
||||
with self.assertRaisesRegexp(CssParserException, error): # type: ignore
|
||||
# type: (str, str) -> None
|
||||
with self.assertRaisesRegexp(CssParserException, error): # type: ignore # See https://github.com/python/typeshed/issues/372
|
||||
parse(my_css)
|
||||
|
||||
def test_unexpected_end_brace(self):
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
from typing import Optional
|
||||
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
|
@ -17,9 +19,8 @@ except ImportError:
|
|||
|
||||
class ParserTest(unittest.TestCase):
|
||||
def _assert_validate_error(self, error, fn=None, text=None, check_indent=True):
|
||||
# See https://github.com/python/typeshed/issues/372
|
||||
# for why we have to ingore types here.
|
||||
with self.assertRaisesRegexp(TemplateParserException, error): # type: ignore
|
||||
# type: (str, Optional[str], Optional[str], bool) -> None
|
||||
with self.assertRaisesRegexp(TemplateParserException, error): # type: ignore # See https://github.com/python/typeshed/issues/372
|
||||
validate(fn=fn, text=text, check_indent=check_indent)
|
||||
|
||||
def test_is_django_block_tag(self):
|
||||
|
|
Loading…
Reference in New Issue