{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Let's make sure pytest and ipython_pytest plugin are installed\n", "import sys\n", "!{sys.executable} -m pip install pytest\n", "!{sys.executable} -m pip install ../../../utils/ipython_pytest/" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%load_ext ipython_pytest" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 1. Creating your first test case\n", "There is an implementation for `get_divisible_by_five` function in the cell below. Your task is to create a test case for this function to verify that it works correctly.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%pytest\n", "\n", "def get_divisible_by_five(numbers):\n", " '''Returns a list of numbers which are divisible by five in the list got as an argument'''\n", " result = []\n", " for num in numbers:\n", " if not num % 5:\n", " result.append(num)\n", "\n", " return result\n", "\n", "\n", "#####################\n", "\n", "import pytest\n", "\n", "def test_get_divisible_by_five():\n", " # Your implementation here\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.4" } }, "nbformat": 4, "nbformat_minor": 2 }