summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2024-12-29 19:43:37 (GMT)
committerMats Wichmann <mats@linux.com>2024-12-29 19:46:47 (GMT)
commitcf94507e5568ad2554b5f68700160d7737db61cf (patch)
treed5fde93554a4fba854d6386c453a4a19b3f9419b /testing
parentc9d9fa58b796532320a2248ddc5be07b7280adf3 (diff)
downloadSCons-cf94507e5568ad2554b5f68700160d7737db61cf.zip
SCons-cf94507e5568ad2554b5f68700160d7737db61cf.tar.gz
SCons-cf94507e5568ad2554b5f68700160d7737db61cf.tar.bz2
Rework a TestCommon test to look less ugly [skip appveyor[
Insted of really long strings of repeated characters, use f-strings to compose the "expected" output for the banner function tests. This keeps the code formatter from breaking things an ugly way, and is really more "accurate" anyway. Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'testing')
-rw-r--r--testing/framework/TestCommonTests.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/testing/framework/TestCommonTests.py b/testing/framework/TestCommonTests.py
index 09e6bf6..3beca80 100644
--- a/testing/framework/TestCommonTests.py
+++ b/testing/framework/TestCommonTests.py
@@ -181,24 +181,24 @@ class banner_TestCase(TestCommonTestCase):
"""Test banner()"""
tc = TestCommon.TestCommon(workdir='')
- b = tc.banner('xyzzy ')
- assert (
- b
- == "xyzzy =========================================================================="
- ), b
+ text = 'xyzzy '
+ b = tc.banner(text)
+ expect = f"{text}{tc.banner_char * (tc.banner_width - len(text))}"
+ assert b == expect, b
tc.banner_width = 10
+ b = tc.banner(text)
+ expect = f"{text}{tc.banner_char * (tc.banner_width - len(text))}"
+ assert b == expect, b
- b = tc.banner('xyzzy ')
- assert b == "xyzzy ====", b
-
- b = tc.banner('xyzzy ', 20)
- assert b == "xyzzy ==============", b
+ b = tc.banner(text, 20)
+ expect = f"{text}{tc.banner_char * (20 - len(text))}"
+ assert b == expect, b
tc.banner_char = '-'
-
- b = tc.banner('xyzzy ')
- assert b == "xyzzy ----", b
+ b = tc.banner(text)
+ expect = f"{text}{tc.banner_char * (tc.banner_width - len(text))}"
+ assert b == expect, b
class must_be_writable_TestCase(TestCommonTestCase):