From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Sun, 9 Nov 2025 16:54:35 +0000 (-0500) Subject: Use map (and KeyError) to avoid warning about mixed explicit/implicit returns X-Git-Tag: rec-5.4.0-alpha1~119^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b330a244b018a33296b7fe219904788d5d7eff6;p=thirdparty%2Fpdns.git Use map (and KeyError) to avoid warning about mixed explicit/implicit returns Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- diff --git a/regression-tests.dnsdist/test_DOH.py b/regression-tests.dnsdist/test_DOH.py index a7429bf005..2ef99f7de2 100644 --- a/regression-tests.dnsdist/test_DOH.py +++ b/regression-tests.dnsdist/test_DOH.py @@ -384,17 +384,18 @@ class DOHTests(object): except: pass + metricMap = { + 'connects': 2, + 'http/1.1': 3, + 'http/2': 4, + } + def getHTTPCounter(self, name): lines = self.sendConsoleCommand("showDOHFrontends()").splitlines() self.assertEqual(len(lines), 2) metrics = lines[1].split() self.assertEqual(len(metrics), 15) - if name == 'connects': - return int(metrics[2]) - if name == 'http/1.1': - return int(metrics[3]) - if name == 'http/2': - return int(metrics[4]) + return int(metrics[metricMap[name]]) def testDOHHTTP1(self): """