Skip to content

Commit 963a1cb

Browse files
committed
improved snippet intendation
1 parent 71de386 commit 963a1cb

File tree

1 file changed

+76
-75
lines changed

1 file changed

+76
-75
lines changed

graalpython/com.oracle.graal.python.test/src/tests/standalone/test_gradle_plugin.py

Lines changed: 76 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import shutil
4444
import util
4545
import sys
46+
import textwrap
4647

4748
def append(file, txt):
4849
with open(file, "a") as f:
@@ -382,54 +383,54 @@ def copy_build_files(self, target_dir):
382383
"repositories {", f"repositories {{\n {mvn_repos}")
383384

384385
def packages_termcolor(self):
385-
return """
386-
graalPy {
387-
packages = ["termcolor"]
388-
}
389-
"""
386+
return textwrap.dedent("""
387+
graalPy {
388+
packages = ["termcolor"]
389+
}
390+
""")
390391

391392
def packages_termcolor_ujson(self):
392-
return """
393-
graalPy {
394-
packages = ["termcolor", "ujson"]
395-
}
396-
"""
393+
return textwrap.dedent("""
394+
graalPy {
395+
packages = ["termcolor", "ujson"]
396+
}
397+
""")
397398

398399
def packages_termcolor_resource_dir(self, resources_dir):
399400
resources_dir = resources_dir if 'win32' != sys.platform else resources_dir.replace("\\", "\\\\")
400-
return f"""
401-
graalPy {{
402-
packages = ["termcolor"]
403-
pythonResourcesDirectory = file("{resources_dir}")
404-
}}
405-
"""
401+
return textwrap.dedent(f"""
402+
graalPy {{
403+
packages = ["termcolor"]
404+
pythonResourcesDirectory = file("{resources_dir}")
405+
}}
406+
""")
406407

407408
def home_includes(self):
408-
return """
409-
graalPy {
410-
pythonHome {
411-
includes = [".*__init__.py"]
412-
excludes = [".*html/__init__.py"]
413-
}
414-
}
415-
"""
409+
return textwrap.dedent("""
410+
graalPy {
411+
pythonHome {
412+
includes = [".*__init__.py"]
413+
excludes = [".*html/__init__.py"]
414+
}
415+
}
416+
""")
416417

417418
def empty_home_includes(self):
418-
return """
419-
graalPy {
420-
pythonHome {
421-
includes = []
422-
excludes = []
423-
}
424-
}
425-
"""
419+
return textwrap.dedent("""
420+
graalPy {
421+
pythonHome {
422+
includes = []
423+
excludes = []
424+
}
425+
}
426+
""")
426427

427428
def empty_packages(self):
428-
return """
429-
graalPy {
430-
packages = []
431-
}
432-
"""
429+
return textwrap.dedent("""
430+
graalPy {
431+
packages = []
432+
}
433+
""")
433434

434435
class GradlePluginKotlinTest(GradlePluginTestBase):
435436

@@ -455,54 +456,54 @@ def copy_build_files(self, target_dir):
455456
util.replace_in_file(settings_file, "repositories {", f"repositories {{\n {mvn_repos}")
456457

457458
def packages_termcolor(self):
458-
return """
459-
graalPy {
460-
packages.add("termcolor")
461-
}
462-
"""
459+
return textwrap.dedent("""
460+
graalPy {
461+
packages.add("termcolor")
462+
}
463+
""")
463464

464465
def packages_termcolor_ujson(self):
465-
return """
466-
graalPy {
467-
packages.add("termcolor")
468-
packages.add("ujson")
469-
}
470-
"""
466+
return textwrap.dedent("""
467+
graalPy {
468+
packages.add("termcolor")
469+
packages.add("ujson")
470+
}
471+
""")
471472

472473
def packages_termcolor_resource_dir(self, resources_dir):
473474
resources_dir = resources_dir if 'win32' != sys.platform else resources_dir.replace("\\", "\\\\")
474-
return f"""
475-
graalPy {{
476-
packages.add("termcolor")
477-
pythonResourcesDirectory = file("{resources_dir}")
478-
}}
479-
"""
475+
return textwrap.dedent(f"""
476+
graalPy {{
477+
packages.add("termcolor")
478+
pythonResourcesDirectory = file("{resources_dir}")
479+
}}
480+
""")
480481

481482
def home_includes(self):
482-
return """
483-
graalPy {
484-
pythonHome {
485-
includes.add(".*__init__.py")
486-
excludes.add(".*html/__init__.py")
487-
}
488-
}
489-
"""
483+
return textwrap.dedent("""
484+
graalPy {
485+
pythonHome {
486+
includes.add(".*__init__.py")
487+
excludes.add(".*html/__init__.py")
488+
}
489+
}
490+
""")
490491

491492
def empty_home_includes(self):
492-
return """
493-
graalPy {
494-
pythonHome {
495-
includes
496-
excludes
497-
}
498-
}
499-
"""
493+
return textwrap.dedent("""
494+
graalPy {
495+
pythonHome {
496+
includes
497+
excludes
498+
}
499+
}
500+
""")
500501

501502
def empty_packages(self):
502-
return """
503-
graalPy {
504-
packages
505-
}
506-
"""
503+
return textwrap.dedent("""
504+
graalPy {
505+
packages
506+
}
507+
""")
507508

508509
unittest.skip_deselected_test_functions(globals())

0 commit comments

Comments
 (0)