Skip to content

Commit fc4c84e

Browse files
committed
DEP: use of camel case diffpy.Structure
1 parent 679ab54 commit fc4c84e

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/diffpy/srreal/tests/testutils.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,26 @@
44
"""
55

66

7-
import sys
87
import copy
98
import numpy
109
import pickle
1110

1211
from diffpy.srreal.structureconverters import convertObjCrystCrystal
1312
from diffpy.srreal.tests import logger
1413

15-
# Handle renamed diffpy.structure module by importing it to a common name.
16-
# TODO simplify when Python 2 support is dropped.
14+
# Deprecated in 1.3 - import of old camel-case diffpy.Structure names.
15+
# TODO drop this in version 1.4.
1716

18-
if sys.version_info[0] >= 3:
17+
try:
1918
import diffpy.structure as mod_structure
2019
from diffpy.structure.parsers import getParser
21-
else:
22-
import diffpy.Structure as mod_structure
23-
from diffpy.Structure.Parsers import getParser
20+
except ImportError as e:
21+
try:
22+
import diffpy.Structure as mod_structure
23+
from diffpy.Structure.Parsers import getParser
24+
except ImportError:
25+
raise e
26+
del e
2427

2528
# Resolve availability of optional packages.
2629

0 commit comments

Comments
 (0)