Skip to content

Commit 008a290

Browse files
committed
Use from __future__ import annotations in tests
1 parent d78b937 commit 008a290

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

python/spglib/spglib.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
# POSSIBILITY OF SUCH DAMAGE.
3535

3636
import warnings
37-
from typing import Dict, Optional
3837

3938
import numpy as np
4039

@@ -745,7 +744,7 @@ def get_spacegroup_type(hall_number):
745744

746745
def get_spacegroup_type_from_symmetry(
747746
rotations, translations, lattice=None, symprec=1e-5
748-
) -> Optional[Dict]:
747+
):
749748
"""Space group type information is obtained from a set of symmetry operations.
750749
751750
Parameters

python/test/conftest.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""Pytest configuration."""
2-
from io import StringIO
2+
from __future__ import annotations
3+
34
from pathlib import Path
4-
from typing import Callable, List, Tuple
5+
from typing import Callable
56

67
import numpy as np
78
import pytest
@@ -22,13 +23,13 @@
2223

2324

2425
@pytest.fixture(scope="session")
25-
def dirnames() -> Tuple:
26+
def dirnames() -> list[Path]:
2627
"""Return test directory names."""
27-
return (_data_dir / d for d in _dirnames)
28+
return [_data_dir / d for d in _dirnames]
2829

2930

3031
@pytest.fixture(scope="session")
31-
def all_filenames() -> List:
32+
def all_filenames() -> list:
3233
"""Return all filenames in test directories."""
3334
all_filenames = []
3435
for d in (_data_dir / _d for _d in _dirnames):
@@ -44,13 +45,12 @@ def _read_vasp(filename):
4445
with open(filename) as f:
4546
lines = f.readlines()
4647
return _get_cell(lines)
47-
return None
4848

4949
return _read_vasp
5050

5151

52-
def read_vasp_from_strings(strings):
53-
return _get_cell(StringIO(strings).readlines())
52+
# def read_vasp_from_strings(strings):
53+
# return _get_cell(StringIO(strings).readlines())
5454

5555

5656
def _get_cell(lines):

python/test/test_spacegrouop_type_from_symmetry.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
"""Test of spacegroup_type_from_symmetry."""
2+
from __future__ import annotations
3+
24
import os
35
from pathlib import Path
4-
from typing import Callable, List
6+
from typing import Callable
57

68
import pytest
79

@@ -16,7 +18,7 @@
1618

1719
@pytest.mark.parametrize("lattice_None", [True, False])
1820
def test_spacegroup_type_from_symmetry(
19-
all_filenames: List[Path], read_vasp: Callable, lattice_None: bool
21+
all_filenames: list[Path], read_vasp: Callable, lattice_None: bool
2022
):
2123
"""Test spacegroup_type_from_symmetry."""
2224
for fname in all_filenames:

0 commit comments

Comments
 (0)