IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Introduction to Testing in Python

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

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(____) ____ ____
Modifica ed esegui il codice