Test Informed Learning with Examples

Logo

Repository with assignments using the Test Informed Learning with Examples (TILE) method to integrate testing into existing programming courses for free.

Menu

Convert a letter to upper case

Write a function lower_to_upper which receives as a parameter a lowercase letter and returns that same character, uppercase. To do this you must use the functions chr y ord. If the letter does not belong to the lowercase alphabet, it must be returned the same letter.

Remember that:

This is the last time we give you the pytests that you can use to test your function. From now on you will have to do it yourself.

@pytest.mark.parametrize("testcase, input, expected_output",[(1, 'a', 'A'), (2, 'z', 'Z'), (3, 'ñ', 'Ñ'), (4, '\*', '\*'), (5, 'Q', 'Q'), (6, ' ] )

def test_lower_to_upper(testcase, input, expected_output): 
    assert lower_to_upper(input) == expected_output, "case 0".format(testcase)
Insist that the students test their programs by giving them example
pytests.