Skip to content

Commit

Permalink
test(config): add test__as_bool
Browse files Browse the repository at this point in the history
  • Loading branch information
pivoshenko committed Apr 22, 2024
1 parent d7eaef6 commit 2a71065
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Tests for the module ``src/poetry_plugin_dotenv/config.py``."""

from __future__ import annotations

import pytest

from poetry_plugin_dotenv.config import _as_bool


@pytest.mark.parametrize(
argnames=("value", "expected_bool"),
argvalues=[
("y", True),
("yes", True),
("t", True),
("on", True),
("1", True),
("true", True),
("n", False),
("no", False),
("f", False),
("off", False),
("0", False),
("false", False),
pytest.param("nope", None, marks=pytest.mark.xfail(raises=ValueError)),
],
)
def test__as_bool(value: str, expected_bool: bool) -> None: # noqa: FBT001
"""Test for the ``_as_bool`` function."""

assert expected_bool == _as_bool(value)

0 comments on commit 2a71065

Please sign in to comment.