Skip to content

Commit

Permalink
[PATCH] Made the unit tests a bit more intresting
Browse files Browse the repository at this point in the history
  • Loading branch information
Diapolo10 committed Sep 18, 2023
1 parent c05b5dd commit 7e07078
Showing 1 changed file with 54 additions and 42 deletions.
96 changes: 54 additions & 42 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,93 +7,105 @@
def red_foreground_example_text() -> list[tuple[str, str]]:
"""Returns a list of tuples containing a string and an expected result"""

messages = (
"Hello, world!",
"I'm really feeling it!",
)

return [
(
"Hello, world!",
"\x1b[31;49mHello, world!\x1b[0m",
),
(
"I'm really feeling it!",
"\x1b[31;49mI'm really feeling it!\x1b[0m",
),
message,
f"\x1b[31;49m{message}\x1b[0m",
)
for message in messages
]


@pytest.fixture()
def green_foreground_example_text() -> list[tuple[str, str]]:
"""Returns a list of tuples containing a string and an expected result"""

messages = (
"Tempus edax rerum.",
"Time, the devourer of all things.",
)

return [
(
"Hello, world!",
"\x1b[32;49mHello, world!\x1b[0m",
),
(
"I'm really feeling it!",
"\x1b[32;49mI'm really feeling it!\x1b[0m",
),
message,
f"\x1b[32;49m{message}\x1b[0m",
)
for message in messages
]


@pytest.fixture()
def blue_foreground_example_text() -> list[tuple[str, str]]:
"""Returns a list of tuples containing a string and an expected result"""

messages = (
"Oderint dum metuant.",
"Let them hate so long as they fear.",
)

return [
(
"Hello, world!",
"\x1b[34;49mHello, world!\x1b[0m",
),
(
"I'm really feeling it!",
"\x1b[34;49mI'm really feeling it!\x1b[0m",
),
message,
f"\x1b[34;49m{message}\x1b[0m",
)
for message in messages
]


@pytest.fixture()
def red_background_example_text() -> list[tuple[str, str]]:
"""Returns a list of tuples containing a string and an expected result"""

messages = (
"Sic semper tyrannis.",
"Thus always to tyrants.",
)

return [
(
"Hello, world!",
"\x1b[39;41mHello, world!\x1b[0m",
),
(
"I'm really feeling it!",
"\x1b[39;41mI'm really feeling it!\x1b[0m",
),
message,
f"\x1b[39;41m{message}\x1b[0m",
)
for message in messages
]


@pytest.fixture()
def green_background_example_text() -> list[tuple[str, str]]:
"""Returns a list of tuples containing a string and an expected result"""

messages = (
"Vincit qui se vincit.",
"He conquers who conquers himself.",
)

return [
(
"Hello, world!",
"\x1b[39;42mHello, world!\x1b[0m",
),
(
"I'm really feeling it!",
"\x1b[39;42mI'm really feeling it!\x1b[0m",
),
message,
f"\x1b[39;42m{message}\x1b[0m",
)
for message in messages
]


@pytest.fixture()
def blue_background_example_text() -> list[tuple[str, str]]:
"""Returns a list of tuples containing a string and an expected result"""

messages = (
"Astra inclinant, sed non obligant.",
"The stars incline us, they do not bind us.",
)

return [
(
"Hello, world!",
"\x1b[39;44mHello, world!\x1b[0m",
),
(
"I'm really feeling it!",
"\x1b[39;44mI'm really feeling it!\x1b[0m",
),
message,
f"\x1b[39;44m{message}\x1b[0m",
)
for message in messages
]

0 comments on commit 7e07078

Please sign in to comment.