Skip to content

Commit

Permalink
Divide test in two
Browse files Browse the repository at this point in the history
  • Loading branch information
Bajron committed Nov 14, 2023
1 parent b5eeb4b commit 65c9a44
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,29 @@ def test_required_variable_throws(string, message):
("XX=$TEST", "$TEST"),
("XX=${TEST}", "tt"),
("XX=\"${TEST}\"", "tt"),
("XX='${TEST}'", "tt"),
("XX='$TEST'", "$TEST"),
("XX='\\$\\{TEST\\}'", "\\$\\{TEST\\}"),
("XX=\\$\\{TEST\\}", "\\$\\{TEST\\}"),
("XX=\"\\$\\{TEST\\}\"", "\\$\\{TEST\\}"),
],
)
def test_document_expansions(string, expected_xx):
test_env = {"TEST": "tt"}
with mock.patch.dict(os.environ, test_env, clear=True):
stream = io.StringIO(string)
stream.seek(0)

result = dotenv.dotenv_values(stream=stream, interpolate=True)

assert result["XX"] == expected_xx


@pytest.mark.parametrize(
"string,expected_xx",
[
("XX=${TEST}", "tt"),
("XX=\"${TEST}\"", "tt"),
("XX='${TEST}'", "${TEST}"),
],
)
Expand Down

0 comments on commit 65c9a44

Please sign in to comment.