Skip to content

Collect possible issues might come with Python 3.12 #3775

Closed
@DanielYang59

Description

Collect some Python 3.12 related issues

Might be good to collect some Python 3.12 related issues.

1. For UserDict, d.get(key) and d[key] return different values, as .get method don't call __getitem__

As previously noticed in #3757 (comment).

2. Vasprun: Two unit tests might fail for the following additional warning:

Testing an element's truth value will raise an exception in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.

def test_unconverged(self):
filepath = f"{VASP_OUT_DIR}/vasprun.unconverged.xml.gz"
with pytest.warns(
UnconvergedVASPWarning, match="vasprun.unconverged.xml.gz is an unconverged VASP run"
) as warns:
vasprun_unconverged = Vasprun(filepath, parse_potcar_file=False)
assert len(warns) == 1

and

def test_potcar_not_found(self):
filepath = f"{VASP_OUT_DIR}/vasprun.xml.gz"
# Ensure no potcar is found and nothing is updated
with pytest.warns(UserWarning, match="No POTCAR file with matching TITEL fields was found in") as warns:
vasp_run = Vasprun(filepath, parse_potcar_file=".")
assert len(warns) == 2

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions