Skip to content

Commit 38997ee

Browse files
Fix jdftx.outputs usage of 3.11+ only syntax (#4484)
* capture expected warning * fix python 3.10 syntaxerror * pre-commit auto-fixes * test 3.10 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 12011a1 commit 38997ee

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ jobs:
3131
# newest version (currently 3.13) on ubuntu (to get complete coverage on unix).
3232
config:
3333
- os: windows-latest
34-
python: "3.11"
34+
python: "3.10"
3535
resolution: highest
3636
extras: ci,optional,prototypes
3737
- os: windows-latest
3838
python: "3.11"
3939
resolution: highest
4040
extras: ci,prototypes,optional,numpy-v1 # Test NP1 on Windows (quite buggy ATM)
41-
- os: ubuntu-latest
42-
python: "3.13"
43-
resolution: lowest-direct
44-
extras: ci,prototypes,optional
4541
- os: macos-latest
4642
python: "3.12"
4743
resolution: lowest-direct
4844
extras: ci,prototypes # test with only required dependencies installed
45+
- os: ubuntu-latest
46+
python: "3.13"
47+
resolution: lowest-direct
48+
extras: ci,prototypes,optional
4949

5050
# pytest-split automatically distributes work load so parallel jobs finish in similar time
5151
# update durations file with `pytest --store-durations --durations-path tests/files/.pytest-split-durations`

src/pymatgen/io/jdftx/outputs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,8 @@ def _get_pmg_projections(self) -> dict | None:
325325
projections[spins[i]] = np.zeros([nbands, nkpt, norbmax, len(self.outfile.structure)])
326326
# TODO: Consider jitting this loop
327327
for u in range(nproj):
328-
projections[spins[i]][:, :, *u_to_oa_map[u]] += proj_sjku[i, :, :, u]
328+
idx = (slice(None), slice(None), *tuple(u_to_oa_map[u]))
329+
projections[spins[i]][idx] += proj_sjku[i, :, :, u]
329330
return projections
330331

331332

tests/io/abinit/test_netcdf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,5 @@ def test_api(self):
122122
assert str(head)
123123
assert head.to_str(verbose=2, title="title")
124124
# PLEASE DO NOT REMOVE THIS LINE AS THIS API HAS BEEN AROUND FOR SEVERAL YEARS,
125-
assert head.to_string(verbose=2, title="title")
125+
with pytest.warns(FutureWarning, match="to_string is deprecated"):
126+
assert head.to_string(verbose=2, title="title")

0 commit comments

Comments
 (0)