-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use pytest everywhere * Set pytest as test requirement * Update outdated build-system information * Update install docs * Add pytest config file * Run CI with pytest * Switch to codecov * Update docs section about CI * Point to correct directory * Drop plus from doctest flag * Increase fetch-depth * Increment version number
- Loading branch information
Showing
17 changed files
with
192 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from .util import E3FPWarning, E3FPDeprecationWarning | ||
|
||
version_info = (1, 2, 2) | ||
version_info = (1, 2, 3) | ||
version = ".".join(str(c) for c in version_info) | ||
__version__ = version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,10 @@ | |
E-mail: [email protected] | ||
""" | ||
import os | ||
import unittest | ||
|
||
|
||
class ConfigTestCases(unittest.TestCase): | ||
class TestConfig: | ||
def test_config_file_exists(self): | ||
from e3fp.config.params import DEF_PARAM_FILE | ||
|
||
self.assertTrue(os.path.isfile(DEF_PARAM_FILE)) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() | ||
assert os.path.isfile(DEF_PARAM_FILE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,9 @@ | |
Author: Seth Axen | ||
E-mail: [email protected] | ||
""" | ||
import unittest | ||
|
||
|
||
class ConformerTestCases(unittest.TestCase): | ||
class TestConformer: | ||
def test_standardisation(self): | ||
import rdkit.Chem | ||
from e3fp.conformer.util import ( | ||
|
@@ -16,10 +15,10 @@ def test_standardisation(self): | |
|
||
smiles = "C[N-]c1cccc[n+]1C" | ||
mol = mol_from_smiles(smiles, "tmp") | ||
self.assertEqual(rdkit.Chem.MolToSmiles(mol), smiles) | ||
assert rdkit.Chem.MolToSmiles(mol) == smiles | ||
|
||
mol = mol_to_standardised_mol(mol) | ||
self.assertEqual(rdkit.Chem.MolToSmiles(mol), "CN=c1ccccn1C") | ||
assert rdkit.Chem.MolToSmiles(mol) == "CN=c1ccccn1C" | ||
|
||
def test_default_is_unseeded(self): | ||
import rdkit.Chem | ||
|
@@ -46,7 +45,7 @@ def test_default_is_unseeded(self): | |
if rms > 1e-2: | ||
fail = False | ||
break | ||
self.assertFalse(fail) | ||
assert not fail | ||
|
||
def test_seed_produces_same_conformers(self): | ||
import rdkit.Chem | ||
|
@@ -73,8 +72,4 @@ def test_seed_produces_same_conformers(self): | |
if rms > 1e-2: | ||
fail = True | ||
break | ||
self.assertFalse(fail) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() | ||
assert not fail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,9 @@ | |
Author: Seth Axen | ||
E-mail: [email protected] | ||
""" | ||
import unittest | ||
|
||
|
||
class RequiredDependenciesTestCase(unittest.TestCase): | ||
class TestRequiredDependencies: | ||
def test_rdkit(self): | ||
import rdkit | ||
|
||
|
@@ -23,15 +22,15 @@ def test_python_utilities(self): | |
import python_utilities | ||
|
||
|
||
class OptionalFeatureDependenciesTestCase(unittest.TestCase): | ||
class TestOptionalFeatureDependencies: | ||
def test_h5py(self): | ||
import h5py | ||
|
||
def test_standardiser(self): | ||
import standardiser | ||
|
||
|
||
class OptionalParallelDependenciesTestCase(unittest.TestCase): | ||
class TestOptionalParallelDependencies: | ||
def test_mpi4py(self): | ||
import mpi4py | ||
|
||
|
@@ -40,7 +39,3 @@ def test_concurrent(self): | |
|
||
def test_python_utilities(self): | ||
import python_utilities.parallel | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,9 @@ | |
Author: Seth Axen | ||
E-mail: [email protected] | ||
""" | ||
import unittest | ||
import pytest | ||
|
||
|
||
class FingerprintIOTestCases(unittest.TestCase): | ||
class TestFingerprintIO: | ||
def test_fprint_from_indices(self): | ||
from e3fp.fingerprint.fprint import ( | ||
Fingerprint, | ||
|
@@ -18,7 +17,7 @@ def test_fprint_from_indices(self): | |
in_indices = [3, 1, 4, 5] | ||
bits = 32 | ||
fprint = fp_type.from_indices(in_indices, bits=bits) | ||
self.assertEqual(sorted(in_indices), sorted(fprint.indices)) | ||
assert sorted(in_indices) == sorted(fprint.indices) | ||
|
||
def test_fprint_from_fprint(self): | ||
from e3fp.fingerprint.fprint import ( | ||
|
@@ -32,7 +31,7 @@ def test_fprint_from_fprint(self): | |
bits = 32 | ||
fprint1 = fp_type.from_indices(in_indices, bits=bits) | ||
fprint2 = fp_type.from_fingerprint(fprint1) | ||
self.assertEqual(fprint1, fprint2) | ||
assert fprint1 == fprint2 | ||
|
||
def test_countfprint_from_counts(self): | ||
from e3fp.fingerprint.fprint import CountFingerprint | ||
|
@@ -41,7 +40,7 @@ def test_countfprint_from_counts(self): | |
bits = 32 | ||
fprint = CountFingerprint.from_counts(in_counts, bits=bits) | ||
out_counts = fprint.counts | ||
self.assertEqual(in_counts, out_counts) | ||
assert in_counts == out_counts | ||
|
||
def test_floatfprint_from_counts(self): | ||
from e3fp.fingerprint.fprint import FloatFingerprint | ||
|
@@ -50,7 +49,7 @@ def test_floatfprint_from_counts(self): | |
bits = 32 | ||
fprint = FloatFingerprint.from_counts(in_counts, bits=bits) | ||
out_counts = fprint.counts | ||
self.assertEqual(in_counts, out_counts) | ||
assert in_counts == out_counts | ||
|
||
def test_unique_indices(self): | ||
from e3fp.fingerprint.fprint import ( | ||
|
@@ -63,7 +62,7 @@ def test_unique_indices(self): | |
in_indices = [3, 1, 4, 5, 1, 5, 9] | ||
bits = 32 | ||
fprint = fp_type.from_indices(in_indices, bits=bits) | ||
self.assertEqual(sorted(set(in_indices)), sorted(fprint.indices)) | ||
assert sorted(set(in_indices)) == sorted(fprint.indices) | ||
|
||
def test_bitstring_io(self): | ||
from e3fp.fingerprint.fprint import ( | ||
|
@@ -76,7 +75,7 @@ def test_bitstring_io(self): | |
in_bitstring = "1001001111011000" | ||
fprint = fp_type.from_bitstring(in_bitstring) | ||
out_bitstring = fprint.to_bitstring() | ||
self.assertEqual(in_bitstring, out_bitstring) | ||
assert in_bitstring == out_bitstring | ||
|
||
def test_vector_io(self): | ||
from e3fp.fingerprint.fprint import ( | ||
|
@@ -106,7 +105,7 @@ def test_rdkit_io(self): | |
rdkit_fprint1 = fprint1.to_rdkit() | ||
fprint2 = fp_type.from_rdkit(rdkit_fprint1) | ||
rdkit_fprint2 = fprint2.to_rdkit() | ||
self.assertEqual(rdkit_fprint1, rdkit_fprint2) | ||
assert rdkit_fprint1 == rdkit_fprint2 | ||
|
||
def test_basic_properties(self): | ||
from e3fp.fingerprint.fprint import ( | ||
|
@@ -123,21 +122,15 @@ def test_basic_properties(self): | |
level = int(np.random.randint(0, 10)) | ||
for fp_type in (Fingerprint, CountFingerprint, FloatFingerprint): | ||
fp = fp_type.from_indices(indices, bits=bits, level=level) | ||
self.assertEqual(fp.bits, bits) | ||
self.assertEqual(len(fp), bits) | ||
self.assertEqual(fp.bit_count, unique_inds.size) | ||
self.assertAlmostEqual( | ||
fp.density, float(unique_inds.size) / bits | ||
) | ||
assert fp.bits == bits | ||
assert len(fp) == bits | ||
assert fp.bit_count == unique_inds.size | ||
assert fp.density == pytest.approx(float(unique_inds.size) / bits) | ||
|
||
|
||
class FingerprintAlgebraTestCases(unittest.TestCase): | ||
class TestFingerprintAlgebra: | ||
pass | ||
|
||
|
||
class FingerprintComparisonTestCases(unittest.TestCase): | ||
class TestFingerprintComparison: | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
Oops, something went wrong.