Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
    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()
Пример #4
0
    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()
Пример #5
0
    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
Пример #6
0
    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()
Пример #7
0
    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()
Пример #8
0
 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\">", ">")
Пример #9
0
 def process(self, fragment):
     t = TestRig(fixture=self)
     t.stub_result(None)
     t.process_fragment(fragment)
     return t.success_or_failure()
Пример #10
0
 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"
Пример #12
0
 def render(self, fragment):
     rig = TestRig()
     rig.stub_result(self.nextResult)
     rig.process_fragment(fragment)
     return rig.get_output_fragment_xml()
Пример #13
0
 def successOrFailure(self, snippet, outcome):
     t = TestRig()
     t.stub_result(text_to_bool(outcome))
     t.process_fragment(snippet)
     return t.success_or_failure()
Пример #14
0
 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"