def test_page_should_contain_string_x_times_custom_message( mocker: MockerFixture, under_test: x3270): mocker.patch("Mainframe3270.py3270.Emulator.string_get", return_value="a") with pytest.raises(Exception, match="my error message"): under_test.page_should_contain_string_x_times( "b", 1, error_message="my error message")
def test_page_should_contain_string_x_times_fails(mocker: MockerFixture, under_test: x3270): mocker.patch("Mainframe3270.py3270.Emulator.string_get", return_value="a") with pytest.raises( Exception, match= 'The string "a" was not found "1" times, it appears "24" times'): under_test.page_should_contain_string_x_times("a", 1) with pytest.raises( Exception, match='The string "b" was not found "1" times, it appears "0" times' ): under_test.page_should_contain_string_x_times("b", 1)
def test_page_should_contain_string_x_times_ignore_case( mocker: MockerFixture, under_test: x3270): mocker.patch("Mainframe3270.py3270.Emulator.string_get", return_value="a") under_test.page_should_contain_string_x_times("A", 24, ignore_case=True)