Fix handling of errors with newer spglib version
Summary
- Catch
SpglibCppErrorraised by spglib ≥ 2.7 inget_primitive_structureand normalize it to the existingValueError, maintaining consistent behavior across spglib versions. - Add two parametrized mock tests covering both failure modes:
Nonereturn (< 2.7) andSpglibCppError(≥ 2.7).
Background
spglib 2.7 introduced SpglibCppError (from spglib._spglib) as a new exception type for
C++-level failures. Prior versions returned None on failure. The behavior will become the
default in 2.8 and the None-return path will be removed in 3.0.