Skip to content

Commit 15e1374

Browse files
committed
TST: Windows fix for backslashed unicode paths
Problem: backslashed path does not convert directly to unicode. Solution: work around that with forward slash.
1 parent 4385fb7 commit 15e1374

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/diffpy/structure/tests/testp_cif.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ def test_parseFile(self):
170170
self.assertEqual(str, type(c1.label))
171171
self.assertEqual('C1', c1.label)
172172
# filename with unicode encoding
173-
ugraphite = P_cif().parseFile(six.u(self.graphiteciffile))
173+
hasbs = '\\' in self.graphiteciffile
174+
uciffile = six.u(self.graphiteciffile.replace('\\', '/'))
175+
if hasbs: # pragma: no cover
176+
uciffile = uciffile.replace(u'/', u'\\')
177+
ugraphite = P_cif().parseFile(uciffile)
174178
self.assertEqual(4, len(ugraphite))
175179
# File with full space group name
176180
ptei = P_cif().parseFile(self.teiciffile)

0 commit comments

Comments
 (0)