Skip to content

Instantly share code, notes, and snippets.

@MartinThoma
Created August 1, 2020 05:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinThoma/7f6b51da1091a9f9c81df3691e836102 to your computer and use it in GitHub Desktop.
Save MartinThoma/7f6b51da1091a9f9c81df3691e836102 to your computer and use it in GitHub Desktop.
# 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