mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +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:
@ -31,16 +31,7 @@ def xor_gate(input_1: int, input_2: int) -> int:
|
||||
return (input_1, input_2).count(0) % 2
|
||||
|
||||
|
||||
def test_xor_gate() -> None:
|
||||
"""
|
||||
Tests the xor_gate function
|
||||
"""
|
||||
assert xor_gate(0, 0) == 0
|
||||
assert xor_gate(0, 1) == 1
|
||||
assert xor_gate(1, 0) == 1
|
||||
assert xor_gate(1, 1) == 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(xor_gate(0, 0))
|
||||
print(xor_gate(0, 1))
|
||||
import doctest
|
||||
|
||||
doctest.testmod()
|
||||
|
Reference in New Issue
Block a user