Add tests for app/print_table.py #15
@ -18,6 +18,6 @@ def generate_prefix_string(prefixes: list) -> Union[str, None]:
|
||||
return None
|
||||
|
||||
|
||||
def print_table(table_data) -> None:
|
||||
def print_table(table_data) -> None: # pragma: no cover
|
||||
"""Print table generated by tabulate."""
|
||||
print(tabulate(table_data))
|
||||
|
19
tests/test_print_table.py
Normal file
19
tests/test_print_table.py
Normal file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
"""MODULE: Provides test cases for app/print_table.py."""
|
||||
|
||||
from app.print_table import generate_prefix_string # pragma: no cover
|
||||
|
||||
|
||||
def test_generate_prefix_string_small() -> None:
|
||||
"""TEST: Verifies if a small prefix list results in one line."""
|
||||
test_query = ["abc", "def"]
|
||||
result = generate_prefix_string(prefixes=test_query)
|
||||
assert result == "abc, def\n"
|
||||
|
||||
|
||||
def test_generate_prefix_string_large() -> None:
|
||||
"""TEST: Verifies if a large prefix list results in multiple lines."""
|
||||
test_query = ["abc", "def", "ghi", "jkl", "mno", "pqr"]
|
||||
result = generate_prefix_string(prefixes=test_query)
|
||||
assert result == "abc, def, ghi, jkl\nmno, pqr\n"
|
Loading…
x
Reference in New Issue
Block a user