Skip to content

Commit

Permalink
lint tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Linux-cpp-lisp committed Nov 16, 2021
1 parent f84abcd commit 4135e9d
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 33 deletions.
2 changes: 0 additions & 2 deletions examples/monkeypatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
convolution for later analysis.
"""

from typing import Optional

import torch

from nequip.utils import Config, find_first_of_type
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/data/test_dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@

class TestInit:
def test_init(self, npz_dataset):
dl = DataLoader(
npz_dataset, batch_size=2, shuffle=True, exclude_keys=["energy"]
)
DataLoader(npz_dataset, batch_size=2, shuffle=True, exclude_keys=["energy"])

def test_subset(self, npz_dataset):
subset = npz_dataset[[1, 3]]
npz_dataset[[1, 3]]


class TestLoop:
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/data/test_dataset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from attr import fields
import numpy as np
import pytest
import tempfile
Expand All @@ -8,7 +7,6 @@

from ase.data import chemical_symbols
from ase.io import write
from torch.functional import _return_counts

from nequip.data import (
AtomicDataDict,
Expand Down
1 change: 0 additions & 1 deletion tests/unit/model/test_eng_force.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import logging
import tempfile
import torch
from os.path import isfile

import numpy as np

Expand Down
3 changes: 0 additions & 3 deletions tests/unit/nn/test_embed.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import torch

from e3nn.util.test import assert_auto_jitable

from nequip.data import AtomicDataDict
from nequip.utils.test import assert_AtomicData_equivariant
from nequip.nn.radial_basis import BesselBasis
from nequip.nn.cutoffs import PolynomialCutoff
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/trainer/test_metrics.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import inspect
import pytest
import torch
from nequip.data import AtomicDataDict
from nequip.train import Metrics

from .test_loss import data

# all the config to test init
# only the last one will be used to test the loss and mae
Expand Down Expand Up @@ -96,7 +94,7 @@ def test_per_species(self, data, per_comp):
@pytest.fixture(scope="class", params=metrics_tests)
def metrics(request):
""""""
coeffs = request.param
coeffs = request.param # noqa
instance = Metrics(components=request.param)
yield instance

Expand Down
11 changes: 5 additions & 6 deletions tests/unit/trainer/test_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ def test_duplicate_id_2(self, temp_data):
minimal_config["root"] = temp_data

model = DummyNet(3)
c1 = Trainer(model=model, **minimal_config)
Trainer(model=model, **minimal_config)

with pytest.raises(RuntimeError):
c2 = Trainer(model=model, **minimal_config)
Trainer(model=model, **minimal_config)


class TestSaveLoad:
Expand Down Expand Up @@ -203,10 +203,9 @@ def test_load_w_revision(self, trainer):
assert trainer1.max_epochs == minimal_config["max_epochs"] * 2

def test_restart_training(self, trainer, nequip_dataset):

model = trainer.model
device = trainer.device
optimizer = trainer.optim
_ = trainer.model
_ = trainer.device
_ = trainer.optim
trainer.set_dataset(nequip_dataset)
trainer.train()

Expand Down
5 changes: 0 additions & 5 deletions tests/unit/utils/test_config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
"""
Config tests
"""


import numpy as np
import pytest

import torch

from os import remove

from nequip.utils import Config
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/utils/test_instantiate.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ def __init__(self, cls_b, cls_b_kwargs):


class C:
def __init__(self, cls_c, cls_c_kwargs):
self.c_obj = c_cls(**c_cls_kwargs)
def __init__(self, cls_c, cls_c_kwargs): # noqa
self.c_obj = c_cls(**c_cls_kwargs) # noqa


def test_deep_nests():
Expand Down
5 changes: 0 additions & 5 deletions tests/unit/utils/test_output.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
"""
Config tests
"""


import numpy as np
import pytest
import tempfile
import torch

from os import remove
from os.path import isdir

from nequip.utils.output import Output
Expand Down

0 comments on commit 4135e9d

Please sign in to comment.