Example #1
0
def test_for_integer_input():
    main.input = lambda x: 1
    with pytest.raises(
        ValueError,
        match=r"Somehow you didn't enter a string. Please try again."
    ):
        main.count_vowels()
Example #2
0
def test_if_vowel(capsys):
    main.input = lambda x: "few"
    main.count_vowels()
    captured = capsys.readouterr()
    assert captured.out == "The total is: \ne: 1 instances\n"
Example #3
0
def test_if_no_vowels(capsys):
    main.input = lambda x: "sky"
    main.count_vowels()
    captured = capsys.readouterr()
    assert captured.out == "The total is: \n"
Example #4
0
def test_for_string_integer_input(capsys):
    main.input = lambda x: "1"
    with pytest.raises(SystemExit):
        main.count_vowels()
    captured = capsys.readouterr()
    assert captured.out == "That's not a string, that's a number. >_<\n"