def add_def(self, sec, key, value): if value == "": return ast = Assertion() ast.key = key ast.value = value if "r" == sec or "p" == sec: ast.tokens = ast.value.split(",") for i,token in enumerate(ast.tokens): ast.tokens[i] = key + "_" + token.strip() else: ast.value = util.remove_comments(util.escape_assertion(ast.value)) if sec not in self.model.keys(): self.model[sec] = {} self.model[sec][key] = ast return True
def test_escape_assertion(self): self.assertEqual( util.escape_assertion("m = r.sub == p.sub && r.obj == p.obj && r.act == p.act"), "m = r_sub == p_sub && r_obj == p_obj && r_act == p_act", )