Skip to content

Commit 6243638

Browse files
authored
Merge pull request #146 from ycexiao/catch-YapsSyntaxError
fix: let tests compatible to newer versions of `pycifrw`
2 parents 9379e80 + b910f87 commit 6243638

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

news/catch-YapsSyntaxError.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* <news item>
4+
5+
**Changed:**
6+
7+
* <news item>
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* Let ``diffpy.structure`` pass the tests with ``pycifrw`` installed from ``PyPI``.
20+
21+
**Security:**
22+
23+
* <news item>

src/diffpy/structure/parsers/p_cif.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from contextlib import contextmanager
3333

3434
import numpy
35+
from CifFile.yapps3_compiled_rt import YappsSyntaxError
3536

3637
from diffpy.structure import Atom, Lattice, Structure
3738
from diffpy.structure.parsers import StructureParser
@@ -408,7 +409,7 @@ def _parseCifDataSource(self, datasource):
408409
# stop after reading the first structure
409410
if self.stru is not None:
410411
break
411-
except (StarError, ValueError, IndexError) as err:
412+
except (YappsSyntaxError, StarError, ValueError, IndexError) as err:
412413
exc_type, exc_value, exc_traceback = sys.exc_info()
413414
emsg = str(err).strip()
414415
e = StructureFormatError(emsg)

0 commit comments

Comments
 (0)