Esempio n. 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()
Esempio n. 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"
Esempio n. 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"
Esempio n. 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"