quick test.
This commit is contained in:
parent
e85a857134
commit
2176b0ca00
2 changed files with 49 additions and 1 deletions
|
|
@ -0,0 +1,47 @@
|
|||
import pytest
|
||||
from bubble_sort import sorter, sorter_one_level_depth, decompress_braces, sorter_one_level_depth_lower, add_one_level_depth, add
|
||||
|
||||
|
||||
def test_sort():
|
||||
input = [5, 4, 3, 2, 1, 0]
|
||||
output = sorter(input)
|
||||
assert output == [0, 1, 2, 3, 4, 5]
|
||||
|
||||
input = [5.0, 4.0, 3.0, 2.0, 1.0, 0.0]
|
||||
output = sorter(input)
|
||||
assert output == [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
|
||||
|
||||
input = list(reversed(range(5000)))
|
||||
output = sorter(input)
|
||||
assert output == list(range(5000))
|
||||
def test_sort():
|
||||
input = [5, 4, 3, 2, 1, 0]
|
||||
output = sorter(input)
|
||||
assert output == [0, 1, 2, 3, 4, 5]
|
||||
|
||||
input = [5.0, 4.0, 3.0, 2.0, 1.0, 0.0]
|
||||
output = sorter(input)
|
||||
assert output == [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
|
||||
|
||||
input = list(reversed(range(5000)))
|
||||
output = sorter(input)
|
||||
assert output == list(range(5000))
|
||||
|
||||
|
||||
def test_sorter_one_level_depth():
|
||||
input = [3, 2, 1]
|
||||
output = sorter_one_level_depth(input)
|
||||
assert output == [1, 2, 3]
|
||||
|
||||
|
||||
def test_add_one_level_depth():
|
||||
assert add_one_level_depth(1, 2) == 3
|
||||
assert add_one_level_depth(-1, 1) == 0
|
||||
assert add_one_level_depth(0, 0) == 0
|
||||
|
||||
|
||||
def test_add():
|
||||
assert add(1, 2) == 3
|
||||
assert add(-1, 1) == 0
|
||||
assert add(0, 0) == 0
|
||||
|
||||
|
|
@ -35,7 +35,8 @@ def format_code(formatter_cmds: list[str], path: Path) -> str:
|
|||
result = subprocess.run(formatter_cmd_list, capture_output=True, check=False)
|
||||
if result.returncode == 0:
|
||||
logger.info("FORMATTING OK")
|
||||
logger.error(f"Failed to format code with {' '.join(formatter_cmd_list)}")
|
||||
else:
|
||||
logger.error(f"Failed to format code with {' '.join(formatter_cmd_list)}")
|
||||
except FileNotFoundError as e:
|
||||
from rich.panel import Panel
|
||||
from rich.text import Text
|
||||
|
|
|
|||
Loading…
Reference in a new issue