def test_vardef_at_end2(self): src = u'$x: 5 a {}' parser = Parser(src) self.assertTrue(parser.match(tokens.START)) with self.assertRaises(errors.CSSSyntaxError) as cm: parser.toplevel_statement() self.assertEqual("Variable definitions must end with a semicolon.", cm.exception.msg)
def test_vardef_at_end1(self): # Variable definition at the end of a stylesheet is legal, though # useless. src = u'$x: 5' parser = Parser(src) self.assertTrue(parser.match(tokens.START)) stmt = parser.toplevel_statement() expected = \ VarDef( name=u'x', expr=NumberNode(number=u'5') ) self.assertEqual(dump(expected), dump(stmt))