Skip to content

Fix doctests and builds in various files #6233

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

Merged
merged 4 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions arithmetic_analysis/in_static_equilibrium.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ def polar_force(
True
>>> math.isclose(force[1], 7.0710678118654755)
True
>>> polar_force(10, 3.14, radian_mode=True)
[-9.999987317275396, 0.01592652916486828]
>>> force = polar_force(10, 3.14, radian_mode=True)
>>> math.isclose(force[0], -9.999987317275396)
True
>>> math.isclose(force[1], 0.01592652916486828)
True
"""
if radian_mode:
return [magnitude * cos(angle), magnitude * sin(angle)]
Expand Down
4 changes: 2 additions & 2 deletions quantum/ripple_adder_classic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://en.wikipedia.org/wiki/Controlled_NOT_gate

from qiskit import Aer, QuantumCircuit, execute
from qiskit.providers import BaseBackend
from qiskit.providers import Backend


def store_two_classics(val1: int, val2: int) -> tuple[QuantumCircuit, str, str]:
Expand Down Expand Up @@ -62,7 +62,7 @@ def full_adder(
def ripple_adder(
val1: int,
val2: int,
backend: BaseBackend = Aer.get_backend("qasm_simulator"), # noqa: B008
backend: Backend = Aer.get_backend("qasm_simulator"), # noqa: B008
) -> int:
"""
Quantum Equivalent of a Ripple Adder Circuit
Expand Down
2 changes: 2 additions & 0 deletions strings/hamming_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def hamming_distance(string1: str, string2: str) -> int:
>>> hamming_distance("00000", "11111")
5
>>> hamming_distance("karolin", "kath")
Traceback (most recent call last):
...
ValueError: String lengths must match!
"""
if len(string1) != len(string2):
Expand Down