def test_no_rbrace(self): src = u'.myclass { rule: #abc ; ' parser = Parser(src) self.assertTrue(parser.match(tokens.START)) with self.assertRaises(errors.CSSSyntaxError): parser.ruleset() src = u'.myclass { rule: #abc ; \n@import "mycssfile.css"' parser = Parser(src) self.assertTrue(parser.match(tokens.START)) with self.assertRaises(errors.CSSSyntaxError): parser.ruleset()
def test_lineno(self): src = u'.myclass {} ' parser = Parser(src) self.assertTrue(parser.match(tokens.START)) ruleset = parser.ruleset() self.assertEqual(1, ruleset.lineno)
def test_no_lbrace(self): src = u'.myclass ' parser = Parser(src) self.assertTrue(parser.match(tokens.START)) with self.assertRaises(errors.CSSSyntaxError): parser.ruleset()