diff --git a/tests/test_basic_regression.py b/tests/test_basic_regression.py index 7e2a687..60a72ba 100644 --- a/tests/test_basic_regression.py +++ b/tests/test_basic_regression.py @@ -100,8 +100,8 @@ def compare_output(pdb, tmp_path, ref_path): elif line.startswith("---"): at_pka = False else: - m = re.search(r'([0-9]+\.[0-9]+)', line) - value = float(m.group(0)) + match = re.search(r'([0-9]+\.[0-9]+)', line) + value = float(match.group(0)) test_data.append(value) errstr = "Error exceeds maximum allowed value (%d decimal places)" % MAX_ERR_DECIMALS assert_almost_equal(test_data, ref_data, decimal=MAX_ERR_DECIMALS, @@ -113,9 +113,10 @@ def compare_output(pdb, tmp_path, ref_path): pytest.param('1HPX', [], id="1HPX: no options"), pytest.param('4DFR', [], id="4DFR: no options"), pytest.param('3SGB', [], id="3SGB: no options"), - pytest.param('3SGB-subset', ["--titrate_only", - "E:17,E:18,E:19,E:29,E:44,E:45,E:46,E:118,E:119,E:120,E:139"], - id="3SGB: --titrate_only"), + pytest.param('3SGB-subset', [ + "--titrate_only", + "E:17,E:18,E:19,E:29,E:44,E:45,E:46,E:118,E:119,E:120,E:139"], + id="3SGB: --titrate_only"), pytest.param('1HPX-warn', ['--quiet'], id="1HPX-warn: --quiet")]) def test_regression(pdb, options, tmp_path): """Basic regression test of PROPKA functionality.""" diff --git a/tests/test_hybrid36.py b/tests/test_hybrid36.py index 1af74d0..261db2a 100644 --- a/tests/test_hybrid36.py +++ b/tests/test_hybrid36.py @@ -1,9 +1,13 @@ +"""Test the hybrid36 module.""" import unittest - import propka.hybrid36 as hybrid36 + class Hybrid36Test(unittest.TestCase): - def testDecode(self): + """Test class for hybrid36.""" + + def test_decode(self): + """Test decoding functions.""" test_values = { "99999": 99999, "A0000": 100000, @@ -37,11 +41,11 @@ class Hybrid36Test(unittest.TestCase): "A001Z": 100071, "B0000": 1779616, } + for key, value in test_values.items(): + self.assertEqual(hybrid36.decode(key), value) - for k, v in test_values.items(): - self.assertEqual(hybrid36.decode(k), v) - - def testErrors(self): + def test_errors(self): + """Test values that should raise errors.""" test_values = [ "99X99", "X9-99", @@ -50,8 +54,7 @@ class Hybrid36Test(unittest.TestCase): "-", "!NotOk", ] - - for v in test_values: - with self.assertRaises(ValueError) as e: - hybrid36.decode(v) - self.assertTrue(v in str(e.exception)) \ No newline at end of file + for value in test_values: + with self.assertRaises(ValueError) as err: + hybrid36.decode(value) + self.assertTrue(value in str(err.exception))