diff options
Diffstat (limited to 'testing/code/test_gcd.py')
-rw-r--r-- | testing/code/test_gcd.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/testing/code/test_gcd.py b/testing/code/test_gcd.py new file mode 100644 index 0000000..d1ee7df --- /dev/null +++ b/testing/code/test_gcd.py @@ -0,0 +1,21 @@ +from gcd import gcd, atoi + +def test_gcd(): + assert gcd(48, 64) == 16 + assert gcd(44, 19) == 1 + +def test_atoi_works(): + x = '1' + assert atoi(x) == 1 + +import pytest + +def test_atoi_raises_error(): + x = 'hello' + with pytest.raises(ValueError): + atoi(x) + + +if __name__ == '__main__': + test_gcd() + |