Remove unused append_linesep parameter

This commit is contained in:
Bruno Alla 2023-01-27 07:17:12 +00:00
parent f70a2fe05a
commit 4cf5544e75
No known key found for this signature in database
2 changed files with 9 additions and 20 deletions

View File

@ -14,13 +14,11 @@ DOTENV_FILE = BASE_DIR / ".env"
def merge(
output_file: Path,
files_to_merge: Sequence[Path],
append_linesep: bool = True,
) -> None:
merged_content = ""
for merge_file in files_to_merge:
merged_content += merge_file.read_text()
if append_linesep:
merged_content += os.linesep
merged_content += os.linesep
output_file.write_text(merged_content)

View File

@ -6,28 +6,19 @@ from merge_production_dotenvs_in_dotenv import merge
@pytest.mark.parametrize(
("input_contents", "append_linesep", "expected_output"),
("input_contents", "expected_output"),
[
# No line separator
([], False, ""),
([""], False, ""),
(["\n"], False, "\n"),
(["TEST=1"], False, "TEST=1"),
(["THIS=2", "THAT='example'"], False, "THIS=2THAT='example'"),
(["ONE=1\n", "TWO=2"], False, "ONE=1\nTWO=2"),
(["A=0", "B=1", "C=2"], False, "A=0B=1C=2"),
# With line separator
([], True, ""),
([""], True, "\n"),
(["JANE=doe"], True, "JANE=doe\n"),
(["SEP=true", "AR=ator"], True, "SEP=true\nAR=ator\n"),
(["X=x\n", "Y=y", "Z=z\n"], True, "X=x\n\nY=y\nZ=z\n\n"),
([], ""),
([""], "\n"),
(["JANE=doe"], "JANE=doe\n"),
(["SEP=true", "AR=ator"], "SEP=true\nAR=ator\n"),
(["A=0", "B=1", "C=2"], "A=0\nB=1\nC=2\n"),
(["X=x\n", "Y=y", "Z=z\n"], "X=x\n\nY=y\nZ=z\n\n"),
],
)
def test_merge(
tmp_path: Path,
input_contents: list[str],
append_linesep: bool,
expected_output: str,
):
output_file = tmp_path / ".env"
@ -38,6 +29,6 @@ def test_merge(
merge_file.write_text(input_content)
files_to_merge.append(merge_file)
merge(output_file, files_to_merge, append_linesep)
merge(output_file, files_to_merge)
assert output_file.read_text() == expected_output