Skip to content

Commit

Permalink
PR Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleswing committed Jun 6, 2020
1 parent d2a928b commit b6eb747
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 56 deletions.
7 changes: 3 additions & 4 deletions contrib/autoencoder_models/test_tensorflowEncoders.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from unittest import TestCase

from nose.tools import assert_equals
from nose.plugins.attrib import attr
import pytest
from rdkit import Chem

import deepchem as dc
Expand All @@ -12,7 +11,7 @@

class TestTensorflowEncoders(TestCase):

@pytest.mark.slow('slow')
@pytest.mark.slow
def test_fit(self):
tf_enc = TensorflowMoleculeEncoder.zinc_encoder()

Expand All @@ -36,4 +35,4 @@ def test_fit(self):
tf_de = TensorflowMoleculeDecoder.zinc_decoder()
one_hot_decoded = tf_de.predict_on_batch(prediction)
decoded_smiles = featurizer.untransform(one_hot_decoded)
assert_equals(len(decoded_smiles), len(smiles))
assert len(decoded_smiles) == len(smiles)
2 changes: 1 addition & 1 deletion deepchem/dock/tests/test_binding_pocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def test_convex_find_pockets(self):

assert len(pockets) < len(all_pockets)

@pytest.mark.skip(reson="Unknown")
@pytest.mark.skip(reason="Unknown")
def test_rf_convex_find_pockets(self):
"""Test that filter with pre-trained RF models works."""
if sys.version_info >= (3, 0):
Expand Down
38 changes: 1 addition & 37 deletions deepchem/dock/tests/test_docking.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"

import unittest
import os

import sys
import unittest

import pytest

Expand Down Expand Up @@ -106,38 +105,3 @@ def test_pocket_vina_grid_rf_docker_dock(self):
return

assert score.shape == (1,)

'''
@pytest.mark.slow("slow")
def test_vina_grid_dnn_docker_dock(self):
"""Test that VinaGridDNNDocker can dock."""
current_dir = os.path.dirname(os.path.realpath(__file__))
protein_file = os.path.join(current_dir, "1jld_protein.pdb")
ligand_file = os.path.join(current_dir, "1jld_ligand.sdf")
docker = dc.dock.VinaGridDNNDocker(exhaustiveness=1, detect_pockets=False)
(score, (protein_docked, ligand_docked)) = docker.dock(
protein_file, ligand_file)
# Check returned files exist
assert score.shape == (1,)
assert os.path.exists(protein_docked)
assert os.path.exists(ligand_docked)
@pytest.mark.slow('slow')
def test_pocket_vina_grid_dnn_docker_dock(self):
"""Test that VinaGridDNNDocker can dock."""
if sys.version_info >= (3, 0):
return
current_dir = os.path.dirname(os.path.realpath(__file__))
protein_file = os.path.join(current_dir, "1jld_protein.pdb")
ligand_file = os.path.join(current_dir, "1jld_ligand.sdf")
docker = dc.dock.VinaGridDNNDocker(exhaustiveness=1, detect_pockets=True)
(score, (protein_docked, ligand_docked)) = docker.dock(
protein_file, ligand_file, dry_run=True)
# Check returned files exist
assert score.shape == (1,)
'''
4 changes: 2 additions & 2 deletions deepchem/models/tests/test_atomic_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_atomic_conv(self):
atomic_convnet.fit(train, nb_epoch=300)
assert np.allclose(labels, atomic_convnet.predict(train), atol=0.01)

@pytest.mark.slow("slow")
@pytest.mark.slow
def test_atomic_conv_variable(self):
"""A simple test that initializes and fits an AtomicConvModel on variable input size."""
# For simplicity, let's assume both molecules have same number of
Expand Down Expand Up @@ -102,7 +102,7 @@ def test_atomic_conv_variable(self):
train = NumpyDataset(features, labels)
atomic_convnet.fit(train, nb_epoch=1)

@pytest.mark.slow("slow")
@pytest.mark.slow
def test_atomic_conv_with_feat(self):
"""A simple test for running an atomic convolution on featurized data."""
dir_path = os.path.dirname(os.path.realpath(__file__))
Expand Down
21 changes: 9 additions & 12 deletions deepchem/models/tests/test_overfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,17 @@
__license__ = "MIT"

import os
import tempfile

import numpy as np
import unittest
import sklearn
import shutil
import pytest
import tensorflow as tf
import deepchem as dc
import scipy.io
from deepchem.models.optimizers import Adam, ExponentialDecay
from tensorflow.python.framework import test_util
from flaky import flaky
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import RandomForestRegressor
from flaky import flaky
import pytest
from tensorflow.python.framework import test_util

import deepchem as dc
from deepchem.models.optimizers import Adam


class TestOverfit(test_util.TensorFlowTestCase):
Expand Down Expand Up @@ -573,7 +570,7 @@ def test_tf_robust_multitask_regression_overfit(self):
scores = model.evaluate(dataset, [regression_metric])
assert scores[regression_metric.name] < .2

@pytest.mark.slow('slow')
@pytest.mark.slow
def test_DAG_singletask_regression_overfit(self):
"""Test DAG regressor multitask overfits tiny data."""
np.random.seed(123)
Expand Down Expand Up @@ -691,7 +688,7 @@ def test_weave_singletask_regression_overfit(self):

assert scores[regression_metric.name] > .8

@pytest.mark.slow("slow")
@pytest.mark.slow
def test_MPNN_singletask_regression_overfit(self):
"""Test MPNN overfits tiny data."""
np.random.seed(123)
Expand Down

0 comments on commit b6eb747

Please sign in to comment.