Skip to content

Commit b36ed17

Browse files
authored
Merge pull request #369 from mabruzzo/address-flake8-other
adjust pygrackle/utilities/testing.py to satisfy flake8
2 parents 7794d2d + 02adf55 commit b36ed17

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed

src/python/pygrackle/utilities/testing.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,12 @@
1313

1414
import importlib
1515
import numpy as np
16-
from numpy.testing import assert_array_equal, assert_almost_equal, \
17-
assert_approx_equal, assert_array_almost_equal, assert_equal, \
18-
assert_array_less, assert_string_equal, assert_array_almost_equal_nulp,\
19-
assert_allclose, assert_raises
20-
import os
21-
import shutil
16+
from numpy.testing import assert_almost_equal
2217
import subprocess
2318

2419
def assert_rel_equal(a1, a2, decimals, err_msg='', verbose=True):
2520
if isinstance(a1, np.ndarray):
26-
assert(a1.size == a2.size)
21+
assert a1.size == a2.size
2722
# Mask out NaNs
2823
a1[np.isnan(a1)] = 1.0
2924
a2[np.isnan(a2)] = 1.0
@@ -49,6 +44,7 @@ def requires_module(module):
4944
"""
5045
def ffalse(func):
5146
return lambda: None
47+
5248
def ftrue(func):
5349
return func
5450
try:

src/python/setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[flake8]
22
max-line-length = 999
3-
exclude = pygrackle/utilities/testing.py
43
ignore = E111,E121,E122,E123,E124,E125,E127,E129,E131,E201,E202,E211,E221,E222,E227,E228,E241,E301,E203,E225,E226,E231,E251,E261,E262,E265,E266,E302,E303,E402,E502,E701,E731,W292,W293,W391,W503,W504
54
# when we switch to ruff-format (in the newchem-cpp branch) we won't need to
65
# ignore F401 (ruff-format provides a nice workaround)

src/python/tests/test_chemistry.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@
1414
import numpy as np
1515
import os
1616

17+
from numpy.testing import assert_array_less
18+
1719
from pygrackle import \
1820
chemistry_data, \
1921
setup_fluid_container, \
2022
set_cosmology_units
2123

22-
from pygrackle.utilities.testing import \
23-
random_logscale, \
24-
assert_rel_equal, \
25-
assert_array_less
24+
from pygrackle.utilities.testing import random_logscale, assert_rel_equal
2625

2726
from testing_common import grackle_data_dir
2827

src/python/tests/test_initialisation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
#Standard modules
1010
import h5py
1111
import os
12+
from numpy.testing import assert_allclose
1213

1314
#Chemistry_data struct from grackle
1415
from pygrackle import chemistry_data
1516
#Necessary constants from grackle
1617
from pygrackle.utilities.physical_constants import mass_hydrogen_cgs
17-
from pygrackle.utilities.testing import assert_allclose
1818

1919
#* Function which returns chemistry_data instance with default initialisation settings.
2020
def get_defChem():

0 commit comments

Comments
 (0)