Created
August 1, 2020 05:31
-
-
Save MartinThoma/7f6b51da1091a9f9c81df3691e836102 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Third party modules | |
import pytest | |
# First party modules | |
from factorize import factorize | |
@pytest.mark.parametrize( | |
"n,expected", | |
[ | |
(0, [0]), # 0 | |
(1, [1]), # 1 | |
(-1, [-1]), # -1 | |
(-2, [-1, 2]), # A prime, but negative | |
(2, [2]), # Just one prime | |
(3, [3]), # A different prime | |
(6, [2, 3]), # Different primes | |
(8, [2, 2, 2]), # Multiple times the same prime | |
], | |
) | |
def test_factorize(n, expected): | |
assert factorize(n) == expected |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment