Replace pandas with numpy.testing
Addresses https://github.com/jensengroup/propka-3.1/pull/36#discussion_r429104797
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
pytest
|
||||
pandas
|
||||
numpy
|
||||
2
setup.py
2
setup.py
@@ -57,6 +57,6 @@ See http://propka.org/ for the PROPKA web server.
|
||||
},
|
||||
zip_safe=True,
|
||||
python_requires='>=3.5',
|
||||
tests_require=["pandas", "pytest"],
|
||||
tests_require=["pandas", "numpy"],
|
||||
test_suite="tests",
|
||||
)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Testing PROPKA
|
||||
|
||||
These tests assume that PROPKA is installed as a module on your system.
|
||||
These tests assume that PROPKA is installed as a module on your system the
|
||||
dependencies in `../requirements.txt` are satisfied.
|
||||
If you are running in a virtual environment and want to make changes to your
|
||||
code, module installation accomplished by
|
||||
```
|
||||
|
||||
@@ -4,7 +4,7 @@ import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
import pytest
|
||||
import pandas as pd
|
||||
from numpy.testing import assert_almost_equal
|
||||
import propka.lib
|
||||
import propka.molecular_container
|
||||
|
||||
@@ -12,9 +12,10 @@ import propka.molecular_container
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# Maximum error set by number of decimal places in pKa output as well as need
|
||||
# to make unmodified code work on WSL Ubuntu 18.04
|
||||
MAX_ERR = 0.01
|
||||
# Number of decimal places for maximum tolerable error. Set by number of
|
||||
# decimal places in pKa output as well as need to make unmodified code work
|
||||
# on WSL Ubuntu 18.04
|
||||
MAX_ERR_DECIMALS = 2
|
||||
|
||||
|
||||
# This directory
|
||||
@@ -102,13 +103,9 @@ def compare_output(pdb, tmp_path, ref_path):
|
||||
m = re.search(r'([0-9]+\.[0-9]+)', line)
|
||||
value = float(m.group(0))
|
||||
test_data.append(value)
|
||||
|
||||
df = pd.DataFrame({"reference": ref_data, "test": test_data})
|
||||
df["difference"] = df["reference"] - df["test"]
|
||||
max_err = df["difference"].abs().max()
|
||||
if max_err > MAX_ERR:
|
||||
errstr = "Error in test (%g) exceeds maximum (%g)" % (max_err, MAX_ERR)
|
||||
raise ValueError(errstr)
|
||||
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