Skip to content

Commit 545c20d

Browse files
authored
Fix failing ruff PT001 on master (materialsproject#4003)
* bump ruff version in pre-commit * fix PT001
1 parent 532281f commit 545c20d

File tree

7 files changed

+33
-34
lines changed

7 files changed

+33
-34
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ci:
88

99
repos:
1010
- repo: https://github.com/astral-sh/ruff-pre-commit
11-
rev: v0.5.7
11+
rev: v0.6.0
1212
hooks:
1313
- id: ruff
1414
args: [--fix, --unsafe-fixes]
@@ -65,6 +65,6 @@ repos:
6565
args: [--drop-empty-cells, --keep-output]
6666

6767
- repo: https://github.com/RobertCraigie/pyright-python
68-
rev: v1.1.375
68+
rev: v1.1.376
6969
hooks:
7070
- id: pyright

tests/core/test_xcfunc.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,11 @@ def test_pickle_serialize(self):
5353
# Test if object can be serialized with Pickle
5454
self.serialize_with_pickle(self.ixc_11)
5555

56-
@pytest.mark.skip()
56+
@pytest.mark.skip(reason="TODO:")
5757
def test_msonable(self):
5858
# Test if object supports MSONable
59-
# TODO
6059
self.ixc_11.x.as_dict()
61-
self.assertMSONable(self.ixc_11)
60+
self.assert_msonable(self.ixc_11)
6261

6362
def test_from(self):
6463
# GGA-PBE from ixc given in abinit-libxc mode

tests/entries/test_mixing_scheme.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def all_entries(self):
156156
return self.gga_entries + self.scan_entries
157157

158158

159-
@pytest.fixture()
159+
@pytest.fixture
160160
def mixing_scheme_no_compat():
161161
"""Get an instance of MaterialsProjectDFTMixingScheme with no additional
162162
compatibility schemes (e.g., compat_1=None). Used by most of the tests where
@@ -205,7 +205,7 @@ def mixing_scheme_no_compat():
205205
)
206206

207207

208-
@pytest.fixture()
208+
@pytest.fixture
209209
def ms_complete():
210210
"""Mixing state where we have R2SCAN for all GGA."""
211211
gga_entries = [
@@ -370,7 +370,7 @@ def ms_complete():
370370
return MixingState(gga_entries, scan_entries, mixing_state)
371371

372372

373-
@pytest.fixture()
373+
@pytest.fixture
374374
def ms_scan_only(ms_complete):
375375
"""Mixing state with only R2SCAN entries."""
376376
gga_entries = []
@@ -391,7 +391,7 @@ def ms_scan_only(ms_complete):
391391
return MixingState(gga_entries, scan_entries, mixing_state)
392392

393393

394-
@pytest.fixture()
394+
@pytest.fixture
395395
def ms_gga_only(ms_complete):
396396
"""Mixing state with only GGA entries."""
397397
gga_entries = ms_complete.gga_entries
@@ -412,7 +412,7 @@ def ms_gga_only(ms_complete):
412412
return MixingState(gga_entries, scan_entries, mixing_state)
413413

414414

415-
@pytest.fixture()
415+
@pytest.fixture
416416
def ms_gga_1_scan(ms_complete):
417417
"""
418418
Mixing state with all GGA entries and one R2SCAN, corresponding to the GGA
@@ -434,7 +434,7 @@ def ms_gga_1_scan(ms_complete):
434434
return MixingState(gga_entries, scan_entries, mixing_state)
435435

436436

437-
@pytest.fixture()
437+
@pytest.fixture
438438
def ms_gga_1_scan_novel(ms_complete):
439439
"""
440440
Mixing state with all GGA entries and 1 R2SCAN, corresponding to a composition
@@ -464,7 +464,7 @@ def ms_gga_1_scan_novel(ms_complete):
464464
return MixingState(gga_entries, scan_entries, mixing_state)
465465

466466

467-
@pytest.fixture()
467+
@pytest.fixture
468468
def ms_gga_2_scan_same(ms_complete):
469469
"""
470470
Mixing state with all GGA entries and 2 R2SCAN, corresponding to the GGA
@@ -486,7 +486,7 @@ def ms_gga_2_scan_same(ms_complete):
486486
return MixingState(gga_entries, scan_entries, mixing_state)
487487

488488

489-
@pytest.fixture()
489+
@pytest.fixture
490490
def ms_gga_2_scan_diff_match(ms_complete):
491491
"""
492492
Mixing state with all GGA entries and 2 R2SCAN entries corresponding to
@@ -510,7 +510,7 @@ def ms_gga_2_scan_diff_match(ms_complete):
510510
return MixingState(gga_entries, scan_entries, mixing_state)
511511

512512

513-
@pytest.fixture()
513+
@pytest.fixture
514514
def ms_gga_2_scan_diff_no_match(ms_complete):
515515
"""
516516
Mixing state with all GGA entries and 2 R2SCAN, corresponding to the GGA
@@ -552,7 +552,7 @@ def ms_gga_2_scan_diff_no_match(ms_complete):
552552
return MixingState(gga_entries, scan_entries, mixing_state)
553553

554554

555-
@pytest.fixture()
555+
@pytest.fixture
556556
def ms_all_gga_scan_gs(ms_complete):
557557
"""
558558
Mixing state with all GGA entries and R2SCAN entries corresponding to all GGA
@@ -576,7 +576,7 @@ def ms_all_gga_scan_gs(ms_complete):
576576
return MixingState(gga_entries, scan_entries, mixing_state)
577577

578578

579-
@pytest.fixture()
579+
@pytest.fixture
580580
def ms_all_gga_scan_gs_plus_novel(ms_all_gga_scan_gs):
581581
"""
582582
Mixing state with all GGA entries and R2SCAN entries corresponding to all GGA
@@ -617,7 +617,7 @@ def ms_all_gga_scan_gs_plus_novel(ms_all_gga_scan_gs):
617617
return MixingState(gga_entries, scan_entries, mixing_state)
618618

619619

620-
@pytest.fixture()
620+
@pytest.fixture
621621
def ms_all_scan_novel(ms_complete):
622622
"""
623623
Mixing state with all GGA entries and all R2SCAN, with an additional unstable
@@ -658,7 +658,7 @@ def ms_all_scan_novel(ms_complete):
658658
return MixingState(gga_entries, scan_entries, mixing_state)
659659

660660

661-
@pytest.fixture()
661+
@pytest.fixture
662662
def ms_incomplete_gga_all_scan(ms_complete):
663663
"""Mixing state with an incomplete GGA phase diagram."""
664664
gga_entries = [entry for entry in ms_complete.gga_entries if entry.reduced_formula != "Sn"]
@@ -678,7 +678,7 @@ def ms_incomplete_gga_all_scan(ms_complete):
678678
return MixingState(gga_entries, scan_entries, mixing_state)
679679

680680

681-
@pytest.fixture()
681+
@pytest.fixture
682682
def ms_scan_chemsys_superset(ms_complete):
683683
"""
684684
Mixing state where we have R2SCAN for all GGA, and there is an additional R2SCAN
@@ -709,7 +709,7 @@ def ms_scan_chemsys_superset(ms_complete):
709709
return MixingState(gga_entries, scan_entries, mixing_state)
710710

711711

712-
@pytest.fixture()
712+
@pytest.fixture
713713
def ms_complete_duplicate_structs(ms_complete):
714714
"""
715715
Mixing state where we have R2SCAN for all GGA, plus extra entries that duplicate

tests/io/aims/test_aims_parsers.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
parser_file_dir = Path(__file__).parent / "parser_checks"
2424

2525

26-
@pytest.fixture()
26+
@pytest.fixture
2727
def default_chunk():
2828
lines = ["TEST", "A", "TEST", "| Number of atoms: 200 atoms"]
2929
return AimsOutChunk(lines)
@@ -50,7 +50,7 @@ def test_search_parse_scalar(default_chunk):
5050
assert default_chunk.parse_scalar("n_electrons") is None
5151

5252

53-
@pytest.fixture()
53+
@pytest.fixture
5454
def empty_header_chunk():
5555
return AimsOutHeaderChunk([])
5656

@@ -89,7 +89,7 @@ def test_default_header_k_point_weights(empty_header_chunk):
8989
assert empty_header_chunk.k_point_weights is None
9090

9191

92-
@pytest.fixture()
92+
@pytest.fixture
9393
def initial_lattice():
9494
return np.array(
9595
[
@@ -100,7 +100,7 @@ def initial_lattice():
100100
)
101101

102102

103-
@pytest.fixture()
103+
@pytest.fixture
104104
def header_chunk():
105105
with gzip.open(f"{parser_file_dir}/header_chunk.out.gz", mode="rt") as hc_file:
106106
lines = hc_file.readlines()
@@ -155,7 +155,7 @@ def test_header_n_k_points(header_chunk):
155155
assert header_chunk.n_k_points == 8
156156

157157

158-
@pytest.fixture()
158+
@pytest.fixture
159159
def k_points():
160160
return np.array(
161161
[
@@ -203,7 +203,7 @@ def test_header_header_summary(header_chunk, k_points):
203203
assert val == header_summary[key]
204204

205205

206-
@pytest.fixture()
206+
@pytest.fixture
207207
def empty_calc_chunk(header_chunk):
208208
return AimsOutCalcChunk([], header_chunk)
209209

@@ -288,7 +288,7 @@ def test_default_calc_converged(empty_calc_chunk):
288288
assert not empty_calc_chunk.converged
289289

290290

291-
@pytest.fixture()
291+
@pytest.fixture
292292
def calc_chunk(header_chunk):
293293
with gzip.open(f"{parser_file_dir}/calc_chunk.out.gz", mode="rt") as file:
294294
lines = file.readlines()
@@ -298,7 +298,7 @@ def calc_chunk(header_chunk):
298298
return AimsOutCalcChunk(lines, header_chunk)
299299

300300

301-
@pytest.fixture()
301+
@pytest.fixture
302302
def numerical_stress_chunk(header_chunk):
303303
with gzip.open(f"{parser_file_dir}/numerical_stress.out.gz", mode="rt") as file:
304304
lines = file.readlines()
@@ -419,7 +419,7 @@ def test_calc_hirshfeld_dipole(calc_chunk):
419419
assert calc_chunk.hirshfeld_dipole is None
420420

421421

422-
@pytest.fixture()
422+
@pytest.fixture
423423
def molecular_header_chunk():
424424
with gzip.open(f"{parser_file_dir}/molecular_header_chunk.out.gz", mode="rt") as file:
425425
lines = file.readlines()
@@ -451,7 +451,7 @@ def test_molecular_header_initial_structure(molecular_header_chunk, molecular_po
451451
)
452452

453453

454-
@pytest.fixture()
454+
@pytest.fixture
455455
def molecular_calc_chunk(molecular_header_chunk):
456456
with gzip.open(f"{parser_file_dir}/molecular_calc_chunk.out.gz", mode="rt") as file:
457457
lines = file.readlines()
@@ -461,7 +461,7 @@ def molecular_calc_chunk(molecular_header_chunk):
461461
return AimsOutCalcChunk(lines, molecular_header_chunk)
462462

463463

464-
@pytest.fixture()
464+
@pytest.fixture
465465
def molecular_positions():
466466
return np.array([[-0.00191785, -0.00243279, 0], [0.97071531, -0.00756333, 0], [-0.25039746, 0.93789612, 0]])
467467

tests/io/qchem/test_outputs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def _test_property(self, key, single_outs, multi_outs):
301301
else:
302302
assert_allclose(sub_output.data.get(key), multi_job_dict[filename][idx].get(key), atol=1e-6)
303303

304-
@pytest.mark.skip() # self._test_property(key, single_outs, multi_outs) fails with
304+
@pytest.mark.skip # self._test_property(key, single_outs, multi_outs) fails with
305305
# ValueError: The truth value of an array with more than one element is ambiguous
306306
@pytest.mark.skipif(openbabel is None, reason="OpenBabel not installed.")
307307
def test_all(self):

tests/io/test_openff.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
pybel = pytest.importorskip("openbabel.pybel")
2727

2828

29-
@pytest.fixture()
29+
@pytest.fixture
3030
def mol_files():
3131
return {
3232
"CCO_xyz": f"{TEST_DIR}/CCO.xyz",

tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pytest import MonkeyPatch
1515

1616

17-
@pytest.fixture()
17+
@pytest.fixture
1818
def cd_tmp_path(tmp_path: Path, monkeypatch: MonkeyPatch):
1919
monkeypatch.chdir(tmp_path)
2020
return tmp_path

0 commit comments

Comments
 (0)