Skip to content

Added Unit Tests for Shor’s Algorithm (#12318) #12546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/cryptography/test_shor_algorithm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import pytest

Check failure on line 1 in tests/cryptography/test_shor_algorithm.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (INP001)

tests/cryptography/test_shor_algorithm.py:1:1: INP001 File `tests/cryptography/test_shor_algorithm.py` is part of an implicit namespace package. Add an `__init__.py`.
from algorithms.cryptography.shor_algorithm import shor_algorithm

Check failure on line 2 in tests/cryptography/test_shor_algorithm.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

tests/cryptography/test_shor_algorithm.py:1:1: I001 Import block is un-sorted or un-formatted

@pytest.mark.parametrize("N, expected_factors", [

Check failure on line 4 in tests/cryptography/test_shor_algorithm.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (PT006)

tests/cryptography/test_shor_algorithm.py:4:26: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
(15, (3, 5)),
(21, (3, 7)),
(35, (5, 7)),
(55, (5, 11)),
])
def test_shor_algorithm(N, expected_factors):

Check failure on line 10 in tests/cryptography/test_shor_algorithm.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (N803)

tests/cryptography/test_shor_algorithm.py:10:25: N803 Argument name `N` should be lowercase
factors = shor_algorithm(N)
assert sorted(factors) == sorted(expected_factors), f"Failed for N={N}"
Loading