Clean up line breaks in tests.
See https://github.com/jensengroup/propka-3.1/issues/43
This commit is contained in:
@@ -22,7 +22,8 @@ MAX_ERR_DECIMALS = 2
|
||||
TEST_DIR = Path("tests")
|
||||
# Location for test PDBs
|
||||
PDB_DIR = Path("pdb")
|
||||
# Location for results for comparing output (allow running from tests/ and ../tests/)
|
||||
# Location for results for comparing output (allow running from tests/ and
|
||||
# ../tests/)
|
||||
RESULTS_DIR = Path("tests/results")
|
||||
if not RESULTS_DIR.is_dir():
|
||||
_LOGGER.warning("Switching to sub-directory")
|
||||
@@ -47,7 +48,8 @@ def get_test_dirs():
|
||||
if test_path.is_dir():
|
||||
path_dict[key] = test_path
|
||||
else:
|
||||
errstr = "Can't find %s test files in %s" % (key, [TEST_DIR / path, path])
|
||||
errstr = ("Can't find %s test files in %s"
|
||||
% (key, [TEST_DIR / path, path]))
|
||||
raise FileNotFoundError(errstr)
|
||||
return path_dict
|
||||
|
||||
@@ -63,11 +65,12 @@ def run_propka(options, pdb_path, tmp_path):
|
||||
options += [str(pdb_path)]
|
||||
args = propka.lib.loadOptions(options)
|
||||
try:
|
||||
_LOGGER.warning("Working in tmpdir %s because of PROPKA file output; need to fix this.",
|
||||
tmp_path)
|
||||
_LOGGER.warning("Working in tmpdir %s because of PROPKA file output; "
|
||||
"need to fix this.", tmp_path)
|
||||
cwd = Path.cwd()
|
||||
os.chdir(tmp_path)
|
||||
molecule = propka.molecular_container.Molecular_container(str(pdb_path), args)
|
||||
molecule = propka.molecular_container.Molecular_container(
|
||||
str(pdb_path), args)
|
||||
molecule.calculate_pka()
|
||||
molecule.write_pka()
|
||||
finally:
|
||||
@@ -103,9 +106,11 @@ def compare_output(pdb, tmp_path, ref_path):
|
||||
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,
|
||||
err_msg=errstr, verbose=True)
|
||||
errstr = ("Error exceeds maximum allowed value (%d decimal places)"
|
||||
% MAX_ERR_DECIMALS)
|
||||
assert_almost_equal(
|
||||
test_data, ref_data, decimal=MAX_ERR_DECIMALS, err_msg=errstr,
|
||||
verbose=True)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("pdb, options", [
|
||||
|
||||
Reference in New Issue
Block a user