File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -304,6 +304,25 @@ def test_find_and_replace_verbatim_no_newline():
304
304
assert find_and_replace_header (text , info ) == text
305
305
306
306
307
+ def test_find_and_replace_preserve_indentation ():
308
+ """If the first thing in a file is indented, do not change that thing's
309
+ indentation.
310
+ """
311
+ info = ReuseInfo ({"GPL-3.0-or-later" }, {"SPDX-FileCopyrightText: Jane Doe" })
312
+ text = ' # Hello\n print("world")'
313
+
314
+ assert find_and_replace_header (text , info ) == cleandoc (
315
+ """
316
+ # SPDX-FileCopyrightText: Jane Doe
317
+ #
318
+ # SPDX-License-Identifier: GPL-3.0-or-later
319
+
320
+ # Hello
321
+ print("world")
322
+ """
323
+ )
324
+
325
+
307
326
def test_find_and_replace_newline_before_header ():
308
327
"""In a scenario where the header is preceded by whitespace, remove the
309
328
preceding whitespace.
You can’t perform that action at this time.
0 commit comments