def test_page_should_contain_string_fails(mocker: MockerFixture,
                                          under_test: x3270):
    mocker.patch("Mainframe3270.py3270.Emulator.string_get",
                 return_value="abc")

    with pytest.raises(Exception, match='The string "def" was not found'):
        under_test.page_should_contain_string("def")
def test_page_should_contain_string(mocker: MockerFixture, under_test: x3270):
    mocker.patch("Mainframe3270.py3270.Emulator.string_get",
                 return_value="abc")
    mocker.patch("robot.api.logger.info")

    under_test.page_should_contain_string("abc")

    logger.info.assert_called_with('The string "abc" was found')
def test_page_should_contain_string_custom_message(mocker: MockerFixture,
                                                   under_test: x3270):
    mocker.patch("Mainframe3270.py3270.Emulator.string_get",
                 return_value="abc")

    with pytest.raises(Exception, match="my error message"):
        under_test.page_should_contain_string("def",
                                              error_message="my error message")