예제 #1
0
                    def test_should_raises_invalid_python_code_error(self):
                        with pytest.raises(InvalidPythonCodeError) as excinfo:
                            CodeEvaluator.evaluate("${{1/0}}", {})

                        assert (str(excinfo.value) ==
                                "Invalid Python code defined in the API spec. "
                                "Exception: division by zero. Code: 1/0.")
예제 #2
0
    def test_should_raises_invalid_python_code_error(
        self, sequence, spec_vars, is_a_test_case
    ):
        with raises(InvalidPythonCodeError) as excinfo:
            CodeEvaluator.evaluate(sequence, spec_vars, is_a_test_case)

        assert isinstance(excinfo.value, InvalidPythonCodeError)
예제 #3
0
                    def test_should_raises_invalid_python_code_error(self):
                        with pytest.raises(InvalidPythonCodeError) as excinfo:
                            CodeEvaluator.evaluate(
                                "${{response.url == 'abc'}}", {},
                                is_a_test_case=True)

                        assert (
                            str(excinfo.value) ==
                            "Invalid Python code defined in the API spec. "
                            "Exception: 'NoneType' object has no attribute 'url'. "
                            "Code: response.url == 'abc'.")
예제 #4
0
 def test_should_return_assert_results(
         self, sequence, expected, response):
     assert (CodeEvaluator.evaluate(
         sequence,
         {"response": response},
         is_a_test_case=True,
     ) == expected)
예제 #5
0
 def test_should_return_evaluated_code(
     self, sequence, expected, response
 ):
     assert (
         CodeEvaluator.evaluate(sequence, {"response": response})
         == expected
     )
예제 #6
0
 def test_should_return_evaluated_code(self, sequence,
                                       expected):
     assert CodeEvaluator.evaluate(sequence, {}) == expected
예제 #7
0
 def test_should_return_assert_results(self, sequence,
                                       expected):
     assert (CodeEvaluator.evaluate(
         sequence, {}, is_a_test_case=True) == expected)
예제 #8
0
 def test_should_return_sequence(self, sequence):
     assert CodeEvaluator.evaluate(sequence, {}) == sequence