From c309375eb9972bab48cc8e84187a40c33a59e713 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sat, 5 Nov 2022 07:36:08 -0600 Subject: Maintenance: fix some fiddly checker errors A rawstring to avoid an invalid escape warning. A couple of instances where code is comparing type () calls, advice is to is isinstance() instead. Missing backslashes on escapes in framewok test (rarely run) Updating expected traceback msg in framework test after the code which forces the exception changed in a previous revision. Signed-off-by: Mats Wichmann --- .../docbook/docbook-xsl-1.76.1/extensions/docbook.py | 6 +++--- testing/framework/TestCommonTests.py | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/SCons/Tool/docbook/docbook-xsl-1.76.1/extensions/docbook.py b/SCons/Tool/docbook/docbook-xsl-1.76.1/extensions/docbook.py index d79ece3..17241bb 100644 --- a/SCons/Tool/docbook/docbook-xsl-1.76.1/extensions/docbook.py +++ b/SCons/Tool/docbook/docbook-xsl-1.76.1/extensions/docbook.py @@ -157,7 +157,7 @@ def convertLength(length): global pixelsPerInch global unitHash - m = re.search('([+-]?[\d.]+)(\S+)', length) + m = re.search(r'([+-]?[\d.]+)(\S+)', length) if m is not None and m.lastindex > 1: unit = pixelsPerInch if m.group(2) in unitHash: @@ -204,11 +204,11 @@ def lookupVariable(tctxt, varName, default): return default # If it's a list, get the first element - if type(varString) == type([]): + if isinstance(varString, list): varString = varString[0] # If it's not a string, it must be a node, get its content - if type(varString) != type(""): + if not isinstance(varString, str): varString = varString.content return varString diff --git a/testing/framework/TestCommonTests.py b/testing/framework/TestCommonTests.py index 525f263..68f52cf 100644 --- a/testing/framework/TestCommonTests.py +++ b/testing/framework/TestCommonTests.py @@ -1880,7 +1880,7 @@ class run_TestCase(TestCommonTestCase): FAILED test of .*fail \\tat line \\d+ of .*TestCommon\\.py \\(_complete\\) \\tfrom line \\d+ of .*TestCommon\\.py \\(run\\) - \\tfrom line \\d+ of ( \(\))? + \\tfrom line \\d+ of ( \\(\\))? """) expect_stderr = re.compile(expect_stderr, re.M) @@ -1940,13 +1940,13 @@ class run_TestCase(TestCommonTestCase): Traceback \\(most recent call last\\): File "", line \\d+, in (\\?|) File "[^"]+TestCommon.py", line \\d+, in run - TestCmd.run\\(self, \\*\\*kw\\) + super().run\\(\\*\\*kw\\) File "[^"]+TestCmd.py", line \\d+, in run - .* + p = self.start(program=program, File "[^"]+TestCommon.py", line \\d+, in start raise e File "[^"]+TestCommon.py", line \\d+, in start - return TestCmd.start\\(self, program, interpreter, arguments, + return super().start\\(program, interpreter, arguments, File "", line \\d+, in raise_exception TypeError: forced TypeError """ % re.escape(repr(sys.executable))) @@ -2066,7 +2066,7 @@ class run_TestCase(TestCommonTestCase): FAILED test of .*pass \\tat line \\d+ of .*TestCommon\\.py \\(_complete\\) \\tfrom line \\d+ of .*TestCommon\\.py \\(run\\) - \\tfrom line \\d+ of ( \(\))? + \\tfrom line \\d+ of ( \\(\\))? """) expect_stderr = re.compile(expect_stderr, re.M) @@ -2096,7 +2096,7 @@ class run_TestCase(TestCommonTestCase): FAILED test of .*fail \\tat line \\d+ of .*TestCommon\\.py \\(_complete\\) \\tfrom line \\d+ of .*TestCommon\\.py \\(run\\) - \\tfrom line \\d+ of ( \(\))? + \\tfrom line \\d+ of ( \\(\\))? """) expect_stderr = re.compile(expect_stderr, re.M) @@ -2128,7 +2128,7 @@ class run_TestCase(TestCommonTestCase): FAILED test of .*pass \\tat line \\d+ of .*TestCommon\\.py \\(_complete\\) \\tfrom line \\d+ of .*TestCommon\\.py \\(run\\) - \\tfrom line \\d+ of ( \(\))? + \\tfrom line \\d+ of ( \\(\\))? """) expect_stderr = re.compile(expect_stderr, re.M) @@ -2162,7 +2162,7 @@ class run_TestCase(TestCommonTestCase): FAILED test of .*stderr \\tat line \\d+ of .*TestCommon\\.py \\(_complete\\) \\tfrom line \\d+ of .*TestCommon\\.py \\(run\\) - \\tfrom line \\d+ of ( \(\))? + \\tfrom line \\d+ of ( \\(\\))? """) expect_stderr = re.compile(expect_stderr, re.M) -- cgit v0.12