1212def test_licenseupdate ():
1313 with OpenTemporaryDirectory ():
1414 subprocess .run (["git" , "init" , "-q" ])
15- Path (".wpiformat" ).write_text (
16- r"""licenseUpdateExclude {
15+ Path (".wpiformat" ).write_text (r"""licenseUpdateExclude {
1716 Excluded\.hpp$
1817}
19- """
20- )
21- Path (".wpiformat-license" ).write_text (
22- """/*{padding}Company Name{padding}*/
18+ """ )
19+ Path (".wpiformat-license" ).write_text ("""/*{padding}Company Name{padding}*/
2320/* Copyright (c) {year} Company Name. All Rights Reserved.{padding}*/
24- """
25- )
21+ """ )
2622 subprocess .run (["git" , "add" , ".wpiformat" ])
2723 subprocess .run (["git" , "add" , ".wpiformat-license" ])
2824 subprocess .run (["git" , "commit" , "-q" , "-m" , '"Initial commit"' ])
@@ -75,8 +71,7 @@ def test_licenseupdate():
7571/* Company Name */
7672/* Copyright (c) { year } Company Name. All Rights Reserved. */
7773
78- """
79- + file_appendix ,
74+ """ + file_appendix ,
8075 f"""/* Company Name */
8176/* Copyright (c) { year } Company Name. All Rights Reserved. */
8277
@@ -216,8 +211,7 @@ def test_licenseupdate():
216211 """/* Company Name */
217212/* Copyright (c) 1992-2015 Company Name. All Rights Reserved. */
218213
219- """
220- + file_appendix ,
214+ """ + file_appendix ,
221215 f"""/* Company Name */
222216/* Copyright (c) 1992-{ year } Company Name. All Rights Reserved. */
223217
@@ -293,13 +287,10 @@ def test_licenseupdate():
293287 output , success = LicenseUpdate ().run_pipeline (
294288 config_file , last_year_cpp , lines + "change\n "
295289 )
296- assert (
297- output
298- == f"""// Copyright (c) 2017-{ year }
290+ assert output == f"""// Copyright (c) 2017-{ year }
299291
300292change
301293"""
302- )
303294
304295 # Erase changes made to last-year.cpp in previous test
305296 Path ("last-year.cpp" ).write_text (lines )
@@ -309,46 +300,35 @@ def test_licenseupdate():
309300 output , success = LicenseUpdate ().run_pipeline (
310301 config_file , this_year_cpp , lines
311302 )
312- assert (
313- output
314- == f"""// Copyright (c) 2017-{ year }
303+ assert output == f"""// Copyright (c) 2017-{ year }
315304
316305"""
317- )
318306
319307 # Run wpiformat on next-year.cpp
320308 lines = Path ("next-year.cpp" ).read_text ()
321309 output , success = LicenseUpdate ().run_pipeline (
322310 config_file , next_year_cpp , lines
323311 )
324- assert (
325- output
326- == f"""// Copyright (c) 2017-{ int (year ) + 1 }
312+ assert output == f"""// Copyright (c) 2017-{ int (year ) + 1 }
327313
328314"""
329- )
330315
331316 # Run wpiformat on no-year.cpp
332317 # Should have current calendar year
333318 lines = Path ("no-year.cpp" ).read_text ()
334319 output , success = LicenseUpdate ().run_pipeline (config_file , no_year_cpp , lines )
335- assert (
336- output
337- == f"""// Copyright (c) { year }
320+ assert output == f"""// Copyright (c) { year }
338321
339322"""
340- )
341323
342324 # Create git repo to test filename expansion
343325 with OpenTemporaryDirectory ():
344326 subprocess .run (["git" , "init" , "-q" ])
345327
346328 # Add base files
347- Path (".wpiformat-license" ).write_text (
348- """// Copyright (c) {year}
329+ Path (".wpiformat-license" ).write_text ("""// Copyright (c) {year}
349330// https://github.com/wpilibsuite/styleguide/blob/main/{filename}
350- """
351- )
331+ """ )
352332 subprocess .run (["git" , "add" , ".wpiformat" ])
353333 subprocess .run (["git" , "add" , ".wpiformat-license" ])
354334 subprocess .run (["git" , "commit" , "-q" , "-m" , '"Initial commit"' ])
@@ -360,10 +340,7 @@ def test_licenseupdate():
360340
361341 # Empty file
362342 output , success = LicenseUpdate ().run_pipeline (config_file , file , "" )
363- assert (
364- output
365- == f"""// Copyright (c) { year }
343+ assert output == f"""// Copyright (c) { year }
366344// https://github.com/wpilibsuite/styleguide/blob/main/dir/empty.cpp
367345
368346"""
369- )
0 commit comments