mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 17:34:49 +08:00
Converted tests into doctests (#10572)
* Converted tests into doctests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Removed commented code * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -32,19 +32,7 @@ def and_gate(input_1: int, input_2: int) -> int:
|
||||
return int((input_1, input_2).count(0) == 0)
|
||||
|
||||
|
||||
def test_and_gate() -> None:
|
||||
"""
|
||||
Tests the and_gate function
|
||||
"""
|
||||
assert and_gate(0, 0) == 0
|
||||
assert and_gate(0, 1) == 0
|
||||
assert and_gate(1, 0) == 0
|
||||
assert and_gate(1, 1) == 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_and_gate()
|
||||
print(and_gate(1, 0))
|
||||
print(and_gate(0, 0))
|
||||
print(and_gate(0, 1))
|
||||
print(and_gate(1, 1))
|
||||
import doctest
|
||||
|
||||
doctest.testmod()
|
||||
|
Reference in New Issue
Block a user