def test_property_fontsize(self): self.validate_node(self.parse_properties, "fontsize: 20", AST.FontSizeNode(20)) self.validate_node(self.parse_properties, "fontsize: 30", AST.FontSizeNode(30)) self.check_parse_exception(self.parse_properties, "fontsize: 20.0", pp.ParseException)
def test_stylesheet(self): stylesheet = """ stylesheet StyleSheet { page Selling { section "Selling" { question hasSoldHouse question widgetQuestion widget spinbox default integer { color: #123123 fontsize: 12 widget spinbox } default boolean widget radio } } page Housing { section "Buying" { question name } } } """ default_block = BlockNode([ AST.DefaultWithPropsNode( AST.IntTypeNode(), BlockNode([AST.ColorNode("#123123"), AST.FontSizeNode(12)]), AST.SpinboxNode()), AST.DefaultNode(AST.BoolTypeNode(), AST.RadioNode()) ]) stylesheet_node = AST.StylesheetNode( "StyleSheet", BlockNode([ AST.PageNode( "Selling", BlockNode([ AST.SectionWithDefaultsNode( "Selling", BlockNode([ AST.QuestionNode("hasSoldHouse"), AST.WidgetQuestionNode("widgetQuestion", AST.SpinboxNode()) ]), default_block) ])), AST.PageNode( "Housing", BlockNode([ AST.SectionNode("Buying", BlockNode([AST.QuestionNode("name")])) ])) ])) self.validate_node(self.parse_stylesheet, stylesheet, stylesheet_node)