public void Rule_Script_Contains_Run_Which_Is_Not_A_Function() { var snippet = new Snippet(); var ruleCode = new StringBuilder(); ruleCode.AppendLine("run = 100"); var rule = new PyRule() { Code = ruleCode.ToString(), Weight = 1 }; rule.Rank(snippet); }
public void Running_Rule_With_Incorrect_Syntax_Throws_An_Exception() { var snippet = new Snippet(); var ruleCode = new StringBuilder(); ruleCode.AppendLine("de run(snippet):"); ruleCode.AppendLine(" return 100;"); var rule = new PyRule() { Code = ruleCode.ToString(), Weight = 1 }; rule.Rank(snippet); }
public void Rule_Script_Returns_A_Value_Of_Incompatible_Type() { var snippet = new Snippet(); var ruleCode = new StringBuilder(); ruleCode.AppendLine("def run(snippet):"); ruleCode.AppendLine(" pass"); var rule = new PyRule() { Code = ruleCode.ToString(), Weight = 1 }; rule.Rank(snippet); }
public void Rule_Script_Does_Not_Contain_Run_Function() { var snippet = new Snippet(); var ruleCode = new StringBuilder(); ruleCode.AppendLine("def notrun(snippet):"); ruleCode.AppendLine(" return 100;"); var rule = new PyRule() { Code = ruleCode.ToString(), Weight = 1 }; rule.Rank(snippet); }