Code Duplication    Length = 23-24 lines in 2 locations

tests/test_generate_files.py 2 locations

@@ 218-241 (lines=24) @@
215
    assert tests_script_file_mode == input_script_file_mode
216
217
218
def test_generate_files_with_overwrite_if_exists_with_skip_if_file_exists(tmp_path):
219
    """Verify `skip_if_file_exist` has priority over `overwrite_if_exists`."""
220
    simple_file = Path(tmp_path, 'inputpizzä/simple.txt')
221
    simple_with_new_line_file = Path(tmp_path, 'inputpizzä/simple-with-newline.txt')
222
223
    Path(tmp_path, 'inputpizzä').mkdir(parents=True)
224
    with open(simple_file, 'w') as f:
225
        f.write('temp')
226
227
    generate.generate_files(
228
        context={'cookiecutter': {'food': 'pizzä'}},
229
        repo_dir='tests/test-generate-files',
230
        overwrite_if_exists=True,
231
        skip_if_file_exists=True,
232
        output_dir=tmp_path,
233
    )
234
235
    assert Path(simple_file).is_file()
236
    assert Path(simple_file).exists()
237
    assert Path(simple_with_new_line_file).is_file()
238
    assert Path(simple_with_new_line_file).exists()
239
240
    simple_text = open(simple_file, 'rt', encoding='utf-8').read()
241
    assert simple_text == 'temp'
242
243
244
def test_generate_files_with_skip_if_file_exists(tmp_path):
@@ 270-292 (lines=23) @@
267
    assert simple_text == 'temp'
268
269
270
def test_generate_files_with_overwrite_if_exists(tmp_path):
271
    """Verify overwrite_if_exists overwrites old files."""
272
    simple_file = Path(tmp_path, 'inputpizzä/simple.txt')
273
    simple_with_new_line_file = Path(tmp_path, 'inputpizzä/simple-with-newline.txt')
274
275
    Path(tmp_path, 'inputpizzä').mkdir(parents=True)
276
    with open(simple_file, 'w') as f:
277
        f.write('temp')
278
279
    generate.generate_files(
280
        context={'cookiecutter': {'food': 'pizzä'}},
281
        repo_dir='tests/test-generate-files',
282
        overwrite_if_exists=True,
283
        output_dir=tmp_path,
284
    )
285
286
    assert Path(simple_file).is_file()
287
    assert Path(simple_file).exists()
288
    assert Path(simple_with_new_line_file).is_file()
289
    assert Path(simple_with_new_line_file).exists()
290
291
    simple_text = open(simple_file, 'rt', encoding='utf-8').read()
292
    assert simple_text == 'I eat pizzä'
293
294
295
@pytest.fixture