css linter: Report empty declarations more clearly.

Raise a CssParserException when declarations are empty.
This commit is contained in:
Steve Howell
2016-09-22 17:30:31 -07:00
committed by Tim Abbott
parent f0eaee68e4
commit 28bb9c883a
2 changed files with 14 additions and 1 deletions

View File

@@ -62,6 +62,15 @@ class ParserTestHappyPath(unittest.TestCase):
self.assertFalse(section.declaration_block.declarations[0].semicolon)
def test_empty_block(self):
# type: () -> None
my_css = '''
div {
}'''
error = 'Empty declaration'
with self.assertRaisesRegexp(CssParserException, error): # type: ignore # See https://github.com/python/typeshed/issues/372
parse(my_css)
def test_multi_line_selector(self):
# type: () -> None
my_css = '''