def test_list_grammars(self): """ Verify that the 'list_grammars' RPC method works correctly. """ # Load a Grammar with three rules and check that the RPC returns the # correct data for them. g = Grammar("list_grammars_test") g.add_rule(CompoundRule(name="compound", spec="testing", exported=True)) g.add_rule( MappingRule(name="mapping", mapping={ "command a": ActionBase(), "command b": ActionBase() })) g.add_rule( Rule(name="base", element=Literal("hello world"), exported=False)) g.load() response = self.send_request("list_grammars", []) expected_grammar_data = { "name": g.name, "enabled": True, "active": True, "rules": [{ "name": "compound", "specs": ["testing"], "exported": True, "active": True }, { "name": "mapping", "specs": ["command a", "command b"], "exported": True, "active": True }, { "name": "base", "specs": ["hello world"], "exported": False, "active": True }] } # Check that the loaded grammar appears in the result. It might not # be the only grammar and that is acceptable because dragonfly's # tests can be run while user grammars are loaded. try: self.assertIn("result", response) self.assertIn(expected_grammar_data, response["result"]) finally: g.unload()
def getCSSNode(): H = hintnode.HintNode css_sections = [] css_sections.append(_get_background()) css_sections.append(_get_border()) css_sections.append(_get_box()) css_sections.append(_get_font()) css_sections.append(_get_box_model()) css_sections.append(_get_text()) css_sections.append(_get_column()) css_sections.append(_get_speech()) css_sections += _get_miscellaneous() return H("css", ActionBase(), css_sections)