Commit e8c9f560 authored by gonczor's avatar gonczor

Modulo operation

parent 460964bc
from .my_math import add, sub, div, mul
from .my_math import add, sub, div, mul, mod
......@@ -12,3 +12,7 @@ def mul(a: int, b: int) -> int:
def div(a: int, b: int) -> float:
return a / b
def mod(a: int, b: int) -> int:
return a % b
......@@ -3,6 +3,7 @@ import pytest
from my_math import (
add,
div,
mod,
mul,
sub,
)
......@@ -31,3 +32,8 @@ def test_div(a: int, b: int, expected: float):
def test_div_by_zero():
with pytest.raises(ZeroDivisionError):
div(2, 0)
@pytest.mark.parametrize("a,b,expected", [(6, 4, 2), (2, 2, 0)])
def test_mod(a: int, b: int, expected: int):
assert mod(a, b) == expected
......@@ -2,7 +2,7 @@ import setuptools
setuptools.setup(
name="mymath",
version="0.0.2b2",
version="0.1.0",
author="gonczor",
author_email="",
description="A small example package",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment