pytest sample

PHOTO EMBED

Mon Apr 26 2021 11:00:09 GMT+0000 (Coordinated Universal Time)

Saved by @opencv

import pytest


def count_odd_numbers(a: list):
    return len(list(filter(lambda x: (x % 2 != 0), a)))


def test_count_odd_numbers():
    list_to_check = [1, 10, 5, 2, 8]
    print(f"The odd numbers amount is:{count_odd_numbers(list_to_check)}")
    assert count_odd_numbers(list_to_check) == 2
content_copyCOPY