Hypothesis strategies for RDKit
Project description
hypothesis-rdkit
A strategy to generate random molecules for the hypothesis testing framework.
Installation
pip install -U hypothesis-rdkit
Usage
The module hypothesis-rdkit
provides a strategy for generating RDKit
molecules. During the installation of the package, this strategy is linked to the
rdkit.Chem.Mol
type:
from hypothesis import given
from rdkit.Chem import Mol
@given(...)
def test_molecule_method(mol : Mol):
# mol is a randomly generated molecule
assert mol.GetNumAtoms() > 0
You can use the mols
strategy directly for further customization:
from hypothesis import given # import hypothesis before hypothesis_rdkit!
from hypothesis_rdkit import mols
from rdkit.Chem import GetMolFrags, Mol
from rdkit.Chem.rdMolDescriptors import CalcNumRotatableBonds
@given(mols(n_connected_components=2, max_rotatable_bonds=5))
def test_molecule_mixtures(mol : Mol):
frags = GetMolFrags(mol, asMols=True)
assert len(frags) == 2
for frag in frags:
assert CalcNumRotatableBonds(frag) <= 5
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hypothesis-rdkit-0.5.3.tar.gz
(6.2 MB
view hashes)
Built Distribution
Close
Hashes for hypothesis_rdkit-0.5.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c41df8850ef2f0e4dd782e3cc8e1d3099c44e921e6bc38d86a1f0e95e96656a |
|
MD5 | d2b35869c140189890a6121198a1238b |
|
BLAKE2b-256 | 0febcf95f5318204c20b32ed79b3008e439028993ae78ee3cfce50ff28169806 |