Skip to content

Commit

Permalink
Update type test to satisfy new flake8 (deepchem#3521)
Browse files Browse the repository at this point in the history
  • Loading branch information
arunppsg authored Aug 10, 2023
1 parent 1bf5342 commit 7cc7e91
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion deepchem/feat/tests/test_dummy_featurizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ def test_featurize(self):
]])
featurizer = dc.feat.DummyFeaturizer()
out = featurizer.featurize(input_array)
assert (type(out) == np.ndarray)
assert isinstance(out, np.ndarray)
assert (out.shape == input_array.shape)
2 changes: 1 addition & 1 deletion deepchem/feat/tests/test_mat_featurizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_mat_featurizer(self):
"""
featurizer = MATFeaturizer()
out = featurizer.featurize(self.mol)
assert (type(out) == np.ndarray)
assert isinstance(out, np.ndarray)
assert (out[0].node_features.shape == (3, 36))
assert (out[0].adjacency_matrix.shape == (3, 3))
assert (out[0].distance_matrix.shape == (3, 3))
Expand Down
2 changes: 1 addition & 1 deletion deepchem/feat/tests/test_mxmnet_featurizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,5 @@ def test_node_pos_features(self):
pos_x=pos_x1,
pos_y=pos_y1,
pos_z=pos_z1)
assert type(graph_feat[0].node_pos_features) == np.ndarray
assert isinstance(graph_feat[0].node_pos_features, np.ndarray)
assert np.allclose(graph_feat[0].node_pos_features, node_pos, atol=1e-3)
2 changes: 1 addition & 1 deletion deepchem/models/torch_models/lcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def __init__(self,
"""

def init_weights(m):
if type(m) == nn.Linear:
if isinstance(m, nn.Linear):
torch.nn.init.xavier_uniform_(m.weight)

model = LCNN(n_occupancy, n_neighbor_sites_list, n_permutation_list,
Expand Down
6 changes: 3 additions & 3 deletions deepchem/molnet/tests/test_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ def test_defaults(self):
splits = get_defaults("splits")

fkey = next(iter(feats))
assert type(fkey) == str
assert isinstance(fkey, str)
assert issubclass(feats[fkey], Featurizer)

tkey = next(iter(trans))
assert type(tkey) == str
assert isinstance(tkey, str)
assert issubclass(trans[tkey], Transformer)

skey = next(iter(splits))
assert type(skey) == str
assert isinstance(skey, str)
assert issubclass(splits[skey], Splitter)

0 comments on commit 7cc7e91

Please sign in to comment.