def test_weight_filter_validator(): """ Make sure the weight filter simple validators work. """ weight = workflow_components.MolecularWeightFilter() weight.minimum_weight = 0.0 assert weight.minimum_weight == 0 assert "openmm_units" in weight.provenance() assert "OpenforcefieldToolkit" in weight.provenance()
def test_weight_filter_apply(): """ Make sure the weight filter returns molecules within the limits. """ weight = workflow_components.MolecularWeightFilter() weight.minimum_weight = 0 weight.maximum_weight = 80 molecules = get_tautomers() result = weight.apply(molecules, processors=1) assert result.n_molecules == 14 assert result.n_filtered == 36
def test_adding_multipule_workflow_components(factory_type): """ Test adding a list of workflow components. """ factory = factory_type() efilter = workflow_components.ElementFilter() weight = workflow_components.MolecularWeightFilter() conformer = workflow_components.StandardConformerGenerator() components = [efilter, weight, conformer] factory.add_workflow_component(components) assert len(factory.workflow) == 3 for component in components: assert component.component_name in factory.workflow
def test_get_wrokflow_component(factory_type): """ Test retrieving a workflow component. """ factory = factory_type() efilter = workflow_components.ElementFilter() weight = workflow_components.MolecularWeightFilter() conformer = workflow_components.StandardConformerGenerator() components = [efilter, weight, conformer] factory.add_workflow_component(components) for component in components: assert factory.get_workflow_component( component.component_name) == component
def test_remove_workflow_componet(factory_type): """ Test removing a workflow component through the API. """ factory = factory_type() efilter = workflow_components.ElementFilter() weight = workflow_components.MolecularWeightFilter() conformer = workflow_components.StandardConformerGenerator() components = [efilter, weight, conformer] factory.add_workflow_component(components) assert len(factory.workflow) == 3 for component in components: factory.remove_workflow_component(component.component_name) assert factory.workflow == {}
def test_clear_workflow(factory_type): """ Test clearing out the workflow. """ factory = factory_type() efilter = workflow_components.ElementFilter() weight = workflow_components.MolecularWeightFilter() conformer = workflow_components.StandardConformerGenerator() components = [efilter, weight, conformer] factory.add_workflow_component(components) factory.clear_workflow() assert factory.workflow == {} factory.add_workflow_component(components) factory.workflow = {} assert factory.workflow == {}