def countsFromExecutingSnippetWithSimulatedEvaluationResult(self, snippet, outcome): t = TestRig() if outcome == "(An exception)": t.stub_result(RuntimeError()) else: t.stub_result(outcome) return t.process_fragment(snippet)
def countsFromExecutingSnippetWithSimulatedEvaluationResult( self, snippet, outcome): t = TestRig() if outcome == "(An exception)": t.stub_result(RuntimeError()) else: t.stub_result(outcome) return t.process_fragment(snippet)
def outcomeOfPerformingAssertEquals(self, fragment, expectedString, result): if result == "None": result = None fragment = fragment.replace("(some expectation)", expectedString) t = TestRig() t.stub_result(result) t.process_fragment(fragment) return t.success_or_failure()
def processSnippets(self, evaluationResult): result = Result() for i, snippet in enumerate(self.snippets, start=1): t = TestRig() t.stub_result(evaluationResult) has_failed = t.process_fragment(snippet).has_failed() if has_failed: result._failures.append("({})".format(i)) else: result._successes.append("({})".format(i)) return result
def outcomeOfPerformingAssertEquals(self, fragment, expectedString, result, resultType): if resultType == "String": simulatedResult = result elif resultType == "Integer": simulatedResult = int(result) elif resultType == "Double": simulatedResult = float(result) else: raise RuntimeError("Unsupported result-type '{}'".format(resultType )) fragment = fragment.replace("(some expectation)", expectedString) t = TestRig() t.stub_result(simulatedResult) t.process_fragment(fragment) return t.success_or_failure()
def outcomeOfPerformingAssertEquals(self, fragment, expectedString, result, resultType): if resultType == "String": simulatedResult = result elif resultType == "Integer": simulatedResult = int(result) elif resultType == "Double": simulatedResult = float(result) else: raise RuntimeError( "Unsupported result-type '{}'".format(resultType)) fragment = fragment.replace("(some expectation)", expectedString) t = TestRig() t.stub_result(simulatedResult) t.process_fragment(fragment) return t.success_or_failure()
def render(self, fragment, evalResult): rig = TestRig() rig.stub_result(evalResult) rig.process_fragment(fragment) result = rig.get_output_fragment_xml() return result.replace(" concordion:echo=\"username\">", ">")
def process(self, fragment): t = TestRig(fixture=self) t.stub_result(None) t.process_fragment(fragment) return t.success_or_failure()
def succeeds(self, snippet, evaluationResult): t = TestRig() t.stub_result(evaluationResult) return t.process_fragment(snippet).has_succeeded()
def process(self, snippet): t = TestRig() t.stub_result("Fred") result = t.process_fragment(snippet) return snippet if not result.has_failed() else "Did not work"
def render(self, fragment): rig = TestRig() rig.stub_result(self.nextResult) rig.process_fragment(fragment) return rig.get_output_fragment_xml()
def successOrFailure(self, snippet, outcome): t = TestRig() t.stub_result(text_to_bool(outcome)) t.process_fragment(snippet) return t.success_or_failure()
def matchOrNotMatch(self, snippet, outcome): t = TestRig() t.stub_result(outcome) result = t.process_fragment(snippet) return "match" if not result.has_failed() else "not match"