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.")
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)
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'.")
def test_should_return_assert_results( self, sequence, expected, response): assert (CodeEvaluator.evaluate( sequence, {"response": response}, is_a_test_case=True, ) == expected)
def test_should_return_evaluated_code( self, sequence, expected, response ): assert ( CodeEvaluator.evaluate(sequence, {"response": response}) == expected )
def test_should_return_evaluated_code(self, sequence, expected): assert CodeEvaluator.evaluate(sequence, {}) == expected
def test_should_return_assert_results(self, sequence, expected): assert (CodeEvaluator.evaluate( sequence, {}, is_a_test_case=True) == expected)
def test_should_return_sequence(self, sequence): assert CodeEvaluator.evaluate(sequence, {}) == sequence