mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-09 06:24:52 +03:00
Improvements and enhancements made on test_hooks.py:
Used a variable (expected_content) for the expected content of the gitignore file to enhance readability. Ensured consistent newlines (os.linesep) in the expected content. Separated the import statements to make them clearer. Added more whitespace for better readability.
This commit is contained in:
parent
4391f1da5c
commit
641e90320d
|
@ -21,7 +21,11 @@ def working_directory(tmp_path):
|
||||||
def test_append_to_gitignore_file(working_directory):
|
def test_append_to_gitignore_file(working_directory):
|
||||||
gitignore_file = working_directory / ".gitignore"
|
gitignore_file = working_directory / ".gitignore"
|
||||||
gitignore_file.write_text("node_modules/\n")
|
gitignore_file.write_text("node_modules/\n")
|
||||||
|
|
||||||
append_to_gitignore_file(".envs/*")
|
append_to_gitignore_file(".envs/*")
|
||||||
|
|
||||||
linesep = os.linesep.encode()
|
linesep = os.linesep.encode()
|
||||||
assert gitignore_file.read_bytes() == b"node_modules/" + linesep + b".envs/*" + linesep
|
expected_content = b"node_modules/" + linesep + b".envs/*" + linesep
|
||||||
|
|
||||||
|
assert gitignore_file.read_bytes() == expected_content
|
||||||
assert gitignore_file.read_text() == "node_modules/\n.envs/*\n"
|
assert gitignore_file.read_text() == "node_modules/\n.envs/*\n"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user