Aan de slagGa gratis aan de slag

The first test suite

In this exercise, you will write the first test suite that includes the types of tests that you have learned using the pytest library.

The function multiple_of_two checks whether the num is a multiple of 2 or not. You will implement and run two regular assert tests.

The pytest package has already been imported.

Deze oefening maakt deel uit van de cursus

Introduction to Testing in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

def multiple_of_two(num):
    if num == 0:
        raise(ValueError)
    return num % 2 == 0

def test_numbers():
    # Write the "True" test below
    ____ multiple_of_two(____) ____ ____
Code bewerken en uitvoeren