def test_node_fillout(self): nr = NodeRule(self.node, self.nexus) mapping = {} self.node.fill_out_rule(mapping, [], {}, nr) self.assertEqual(len(mapping), 6) self.node.explode_depth = 0 mapping = {} self.node.fill_out_rule(mapping, [], {}, nr) self.assertEqual(len(mapping), 1)
H("contain", Text("contain")) ]), H("repeat", Text("-repeat: "), [ H("repeat", Text("repeat")), H("repeat X", Text("repeat-x")), H("repeat Y", Text("repeat-y")), H("no repeat", Text("no-repeat")), ]), H("attachment", Text("-attachment: "), [H("scroll", Text("scroll")), H("fixed", Text("fixed"))]), H("origin", Text("-origin: "), background_box), H("clip", Text("-clip: "), background_box + [H("no clip", Text("no-clip"))]), H("color", Text("-color: "), [ H("color", Text("COLOR")), H("transparent", Text("transparent")), ]), H("break", Text("-break: "), [ H("bounding box", Text("bounding-box")), H("each box", Text("each-box")), H("continuous", Text("continuous")), ]) ]) css = NodeRule(get_css_node(), control.nexus()) grammar = Grammar("node css") grammar.add_rule(css) # nothing to activate this right now, it's not even done
def setUp(self): TestNode.setUp(self) self.noderule = NodeRule(self.node, self.nexus)
class TestNodeRule(TestNode): def setUp(self): TestNode.setUp(self) self.noderule = NodeRule(self.node, self.nexus) def test_change_node(self): self.assertIs(self.noderule.node, self.noderule.master_node) ''' "align" should be in the mapping before, but not after''' self.assertIn("align", self.noderule.mapping_actual()) self.noderule.mapping_actual()["align"].execute() self.assertNotIn("align", self.noderule.mapping_actual()) ''' "center" should be in the mapping before, but not after''' self.assertIn("center", self.noderule.mapping_actual()) self.noderule.mapping_actual()["center"].execute() self.assertNotIn("center", self.noderule.mapping_actual()) ''' node should have reset at this point ''' self.assertIs(self.noderule.node, self.noderule.master_node) def test_defaulting(self): self.assertIn("align", self.noderule.mapping_actual()) self.noderule.mapping_actual()["align"].execute() defaulter = NullAction() defaulter.set_nexus(self.nexus) ''' the noderule should default here and reset ''' defaulter.execute() self.assertIn("align", self.noderule.mapping_actual())
ccr.refresh() except Exception: utilities.simple_log() _mapping={} for node in [# register nodes here in order to get them into ccr css.getCSSNode() ]: if node.spec.lower() in settings.SETTINGS["ccr"]["modes"]: utilities.report("CCR naming conflict found between: config"+node.spec+".txt and " \ +node.spec+".py, favoring CCR module, ignoring "+node.spec+".py" \ +" (Please delete config"+node.spec+".txt) and remove "+node.spec \ +" from the settings.json file to change this.") continue if node.spec in settings.SETTINGS["nodes"] and settings.SETTINGS["nodes"][node.spec]: node.active = True control.nexus().add_node_rule(NodeRule(node, None, control.nexus().intermediary, False)) _mapping["enable "+node.spec]=Function(update, name=node.spec, value=True) _mapping["disable "+node.spec]=Function(update, name=node.spec, value=False) if len(_mapping)>0: grammar = Grammar("NodeActivation") grammar.add_rule(MappingRule(mapping=_mapping, name="NodeActivation")) grammar.load() def unload(): global grammar if grammar: grammar.unload() grammar = None