Skip to content

Commit fe48cbd

Browse files
committed
add test to check open CIF from pathlib.Path
1 parent bfd0b0f commit fe48cbd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/diffpy/structure/tests/testloadstructure.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""Unit tests for the loadStructure factory.
44
"""
55

6+
from pathlib import Path
67
import unittest
78
from diffpy.structure.tests.testutils import datafile
89
from diffpy.structure import loadStructure
@@ -41,6 +42,15 @@ def test_cif(self):
4142
self.assertFalse(isinstance(stru, PDFFitStructure))
4243
return
4344

45+
def test_cif_pathlib(self):
46+
"""check loading of CIF file format from pathlib.Path
47+
"""
48+
f = datafile('PbTe.cif')
49+
f = Path(f)
50+
stru = loadStructure(f)
51+
self.assertTrue(isinstance(stru, Structure))
52+
self.assertFalse(isinstance(stru, PDFFitStructure))
53+
return
4454

4555
def test_badfile(self):
4656
"""check loading of CIF file format

0 commit comments

Comments
 (0)