psdi-data-conversion 0.0.36__py3-none-any.whl → 0.0.38__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- psdi_data_conversion/app.py +122 -16
- psdi_data_conversion/constants.py +6 -5
- psdi_data_conversion/converter.py +13 -6
- psdi_data_conversion/converters/base.py +58 -55
- psdi_data_conversion/converters/c2x.py +1 -0
- psdi_data_conversion/converters/openbabel.py +10 -10
- psdi_data_conversion/database.py +335 -113
- psdi_data_conversion/main.py +151 -69
- psdi_data_conversion/static/content/download.htm +22 -9
- psdi_data_conversion/static/javascript/data.js +18 -4
- psdi_data_conversion/static/javascript/format.js +22 -9
- psdi_data_conversion/static/styles/psdi-common.css +5 -4
- psdi_data_conversion/templates/index.htm +59 -45
- psdi_data_conversion/testing/constants.py +9 -3
- psdi_data_conversion/testing/conversion_callbacks.py +9 -7
- psdi_data_conversion/testing/conversion_test_specs.py +128 -27
- psdi_data_conversion/testing/gui.py +428 -0
- psdi_data_conversion/testing/utils.py +121 -60
- {psdi_data_conversion-0.0.36.dist-info → psdi_data_conversion-0.0.38.dist-info}/METADATA +160 -60
- {psdi_data_conversion-0.0.36.dist-info → psdi_data_conversion-0.0.38.dist-info}/RECORD +23 -22
- {psdi_data_conversion-0.0.36.dist-info → psdi_data_conversion-0.0.38.dist-info}/WHEEL +1 -1
- {psdi_data_conversion-0.0.36.dist-info → psdi_data_conversion-0.0.38.dist-info}/entry_points.txt +1 -0
- {psdi_data_conversion-0.0.36.dist-info → psdi_data_conversion-0.0.38.dist-info}/licenses/LICENSE +0 -0
@@ -57,53 +57,67 @@
|
|
57
57
|
|
58
58
|
<form name="gui" class="gui">
|
59
59
|
<div class="max-width-box">
|
60
|
-
<p>
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
tested) and whether or not the converter is supported on this site.</p>
|
66
|
-
<p>
|
67
|
-
<label for="searchFrom" id="fromLabel">Convert from:</label><br>
|
68
|
-
<input type="text" placeholder="-- type here to filter options --" size="12" id="searchFrom"
|
69
|
-
class="large-width"><br>
|
70
|
-
<select size="4" id="fromList" class="large-width"></select>
|
60
|
+
<p>Your one-stop shop for file format conversion, PSDI's Data Conversion Service enables users to seamlessly
|
61
|
+
convert between different file formats and assess the quality of proposed conversions. This is the web version
|
62
|
+
of our service. To find out more about Data Conversion and our other tools, click
|
63
|
+
<a href="https://resources.psdi.ac.uk/resource-themes/7bcc430a-fdc9-413e-bf32-bf163236430b" id="more"
|
64
|
+
target="_blank">here.</a>
|
71
65
|
</p>
|
72
|
-
<div
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
<
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
<
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
66
|
+
<div id="format-selection">
|
67
|
+
<p>Select 'from' and 'to' file formats in the 'Convert from/to' boxes, in either order. Typing where indicated
|
68
|
+
filters the options (case insensitive); for example, typing 'can' or 'NON' reduces the number of options to
|
69
|
+
one:
|
70
|
+
'can: Canonical SMILES.' If you change your mind about a conversion, it is advisable to click on the 'Reset'
|
71
|
+
button. When both formats have been selected, converters able to carry out this conversion appear in the
|
72
|
+
'Conversion options' box along with an indication of conversion quality (many conversions have not yet been
|
73
|
+
tested) and whether or not the converter is supported on this site.</p>
|
74
|
+
<p>
|
75
|
+
<label for="searchFrom" id="fromLabel">Convert from:</label><br>
|
76
|
+
<input type="text" placeholder="-- type here to filter options --" size="12" id="searchFrom"
|
77
|
+
class="large-width"><br>
|
78
|
+
<select size="4" id="fromList" class="large-width"></select>
|
79
|
+
</p>
|
80
|
+
<div class="smallGap"></div>
|
81
|
+
<p>
|
82
|
+
<label for="searchTo" id="toLabel">Convert to:</label><br>
|
83
|
+
<input type="text" placeholder="-- type here to filter options --" size="12" id="searchTo"
|
84
|
+
class="large-width"><br>
|
85
|
+
<select size="4" id="toList" class="large-width"></select>
|
86
|
+
</p>
|
87
|
+
<input type="button" class="button" value=" Reset " name="resetButton" id="resetButton">
|
88
|
+
<br><br>
|
89
|
+
<p>Selecting a converter displays information
|
90
|
+
about it, along with a link to a relevant website. Selecting a supported converter affords the opportunity to
|
91
|
+
carry out a conversion on this site. Clicking on the 'Yes' button takes us to the 'Conversion' page. If a
|
92
|
+
file format has not been found, or if there are no converters capable of carrying out a required conversion
|
93
|
+
please click on 'Report Missing Format/Conversion' in the navigation bar.</p>
|
94
|
+
<p>
|
95
|
+
<label for="success">Select from available conversion
|
96
|
+
options:</label><br>
|
97
|
+
<select size="4" id="success" class="large-width"></select>
|
98
|
+
</p>
|
99
|
+
<span class="normalText">Show how the conversion quality was determined for the selected converter.</span>
|
100
|
+
<input type="button" class="button" value=" Show " name="showButton" id="showButton">
|
101
|
+
<br>
|
102
|
+
<h6>Converter details:</h6>
|
103
|
+
<p id="converter" , class="init-hidden">
|
104
|
+
<span id="name"></span>
|
105
|
+
<br><span id="description"></span>
|
106
|
+
<br><span id="url"></span>
|
107
|
+
<br><span id="info"></span>
|
108
|
+
<a id="visit" target="_blank">this website.</a>
|
109
|
+
<div id="formatWarning" class="init-hidden"></div>
|
110
|
+
<div id="offer" class="init-hidden">
|
111
|
+
<span id="question"></span>
|
112
|
+
<input type="button" class="button" value=" Yes " name="yesButton" id="yesButton">
|
113
|
+
</div>
|
114
|
+
</p>
|
115
|
+
</div>
|
116
|
+
<div id="database-error" class="init-hidden">
|
117
|
+
<p><strong>ERROR:</strong> Connection to the conversion database failed. Please try refreshing this page. If
|
118
|
+
this issue persists, please report it to us using the "Contact" link in the header. You can also download
|
119
|
+
a version of this service for local use using the "Download" link in the header if you'd prefer.</p>
|
105
120
|
</div>
|
106
|
-
</p>
|
107
121
|
<div class="medGap"></div>
|
108
122
|
</div>
|
109
123
|
</form>
|
@@ -6,7 +6,13 @@ Constants related to unit testing
|
|
6
6
|
|
7
7
|
import os
|
8
8
|
|
9
|
-
|
9
|
+
# Locations relative to the root directory of the project - to ensure the files are found, tests should chdir to this
|
10
|
+
# directory before searching for files
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
TEST_DATA_LOC_IN_PROJECT = "./test_data"
|
13
|
+
|
14
|
+
INPUT_TEST_DATA_LOC_IN_PROJECT = TEST_DATA_LOC_IN_PROJECT
|
15
|
+
OUTPUT_TEST_DATA_LOC_IN_PROJECT = os.path.join(TEST_DATA_LOC_IN_PROJECT, "output")
|
16
|
+
|
17
|
+
DEFAULT_ORIGIN = "http://127.0.0.1:5000"
|
18
|
+
"""The default location of the server for running GUI unit tests"""
|
@@ -15,8 +15,8 @@ from tempfile import TemporaryDirectory
|
|
15
15
|
from psdi_data_conversion.constants import DATETIME_RE_RAW
|
16
16
|
from psdi_data_conversion.file_io import unpack_zip_or_tar
|
17
17
|
from psdi_data_conversion.log_utility import string_with_placeholders_matches
|
18
|
-
from psdi_data_conversion.testing.constants import
|
19
|
-
from psdi_data_conversion.testing.utils import ConversionTestInfo,
|
18
|
+
from psdi_data_conversion.testing.constants import OUTPUT_TEST_DATA_LOC_IN_PROJECT
|
19
|
+
from psdi_data_conversion.testing.utils import ConversionTestInfo, check_file_match
|
20
20
|
|
21
21
|
|
22
22
|
class MultiCallback:
|
@@ -326,7 +326,7 @@ class CheckException:
|
|
326
326
|
"""Callable class which checks an exception raised for its type, status code, and message. Tests will only be
|
327
327
|
run on tests with the python library, as that's the only route that provides exceptions."""
|
328
328
|
|
329
|
-
ex_type: type[Exception]
|
329
|
+
ex_type: type[Exception] | None = None
|
330
330
|
"""The expected type of the raised exception (subclasses of it will also be allowed)"""
|
331
331
|
|
332
332
|
ex_message: str | None = None
|
@@ -339,7 +339,8 @@ class CheckException:
|
|
339
339
|
def __call__(self, test_info: ConversionTestInfo) -> str:
|
340
340
|
"""Perform the check on the exception"""
|
341
341
|
|
342
|
-
|
342
|
+
# Skip check on CLA, since this won't catch any exceptions
|
343
|
+
if test_info.run_type == "cla":
|
343
344
|
return ""
|
344
345
|
|
345
346
|
# Confirm that an exception was indeed raised
|
@@ -350,8 +351,9 @@ class CheckException:
|
|
350
351
|
l_errors: list[str] = []
|
351
352
|
|
352
353
|
# Check the exception type
|
353
|
-
if not issubclass(exc_info.type, self.ex_type):
|
354
|
-
l_errors.append(f"ERROR: Raised exception is of type '{exc_info.type}', but expected '{self.ex_type}'"
|
354
|
+
if self.ex_type and not issubclass(exc_info.type, self.ex_type):
|
355
|
+
l_errors.append(f"ERROR: Raised exception is of type '{exc_info.type}', but expected '{self.ex_type}'. "
|
356
|
+
f"Raised exception's message was: {str(exc_info)}")
|
355
357
|
|
356
358
|
exc = exc_info.value
|
357
359
|
|
@@ -389,6 +391,6 @@ class MatchOutputFile:
|
|
389
391
|
def __call__(self, test_info: ConversionTestInfo):
|
390
392
|
"""Run the check comparing the two files"""
|
391
393
|
|
392
|
-
qualified_ex_output_filename = os.path.join(
|
394
|
+
qualified_ex_output_filename = os.path.join(OUTPUT_TEST_DATA_LOC_IN_PROJECT, self.ex_output_filename)
|
393
395
|
|
394
396
|
return check_file_match(test_info.qualified_out_filename, qualified_ex_output_filename)
|
@@ -8,32 +8,45 @@ application, and GUI.
|
|
8
8
|
|
9
9
|
from psdi_data_conversion import constants as const
|
10
10
|
from psdi_data_conversion.converters.atomsk import CONVERTER_ATO
|
11
|
-
from psdi_data_conversion.converters.base import (FileConverterAbortException,
|
12
|
-
|
11
|
+
from psdi_data_conversion.converters.base import (FileConverterAbortException, FileConverterInputException,
|
12
|
+
FileConverterSizeException)
|
13
13
|
from psdi_data_conversion.converters.c2x import CONVERTER_C2X
|
14
14
|
from psdi_data_conversion.converters.openbabel import CONVERTER_OB, COORD_GEN_KEY, COORD_GEN_QUAL_KEY
|
15
|
+
from psdi_data_conversion.database import FileConverterDatabaseException
|
15
16
|
from psdi_data_conversion.testing.conversion_callbacks import (CheckArchiveContents, CheckException, CheckLogContents,
|
16
17
|
CheckLogContentsSuccess, CheckFileStatus,
|
17
18
|
CheckStderrContents, CheckStdoutContents,
|
18
19
|
MatchOutputFile, MultiCallback as MCB)
|
19
20
|
from psdi_data_conversion.testing.utils import ConversionTestSpec as Spec
|
20
21
|
|
21
|
-
|
22
22
|
l_all_test_specs: list[Spec] = []
|
23
23
|
"""All test specs defined in this file"""
|
24
24
|
|
25
|
-
l_all_test_specs.append(Spec(name="
|
26
|
-
filename=
|
25
|
+
l_all_test_specs.append(Spec(name="Standard Single Test",
|
26
|
+
filename="standard_test.cdxml",
|
27
|
+
to_format="inchi",
|
28
|
+
callback=MCB(CheckFileStatus(),
|
29
|
+
CheckLogContentsSuccess(),
|
30
|
+
MatchOutputFile("standard_test.inchi")),
|
31
|
+
))
|
32
|
+
|
33
|
+
l_all_test_specs.append(Spec(name="Standard Multiple Tests",
|
34
|
+
filename=["1NE6.mmcif",
|
27
35
|
"hemoglobin.pdb", "aceticacid.mol", "nacl.cif",
|
28
36
|
"hemoglobin.pdb", "hemoglobin.pdb", "nacl.cif",
|
29
37
|
"hemoglobin.pdb", "hemoglobin.pdb", "nacl.cif",
|
30
38
|
"ethanol.xyz"],
|
31
|
-
to_format=["pdb",
|
39
|
+
to_format=["pdb-0",
|
32
40
|
"cif", "mol2", "xyz",
|
33
41
|
"cif", "xyz", "xyz",
|
34
42
|
"cif", "xyz", "xyz",
|
35
43
|
"cml"],
|
36
|
-
|
44
|
+
from_format=[None,
|
45
|
+
None, None, None,
|
46
|
+
None, None, None,
|
47
|
+
"pdb-0", "pdb-0", None,
|
48
|
+
None],
|
49
|
+
converter_name=[CONVERTER_OB,
|
37
50
|
CONVERTER_OB, CONVERTER_OB, CONVERTER_OB,
|
38
51
|
CONVERTER_ATO, CONVERTER_ATO, CONVERTER_ATO,
|
39
52
|
CONVERTER_C2X, CONVERTER_C2X, CONVERTER_C2X,
|
@@ -57,24 +70,42 @@ l_all_test_specs.append(Spec(name="Archive",
|
|
57
70
|
filename=["caffeine-smi.zip",
|
58
71
|
"caffeine-smi.tar",
|
59
72
|
"caffeine-smi.tar.gz"],
|
73
|
+
from_format="smi",
|
60
74
|
to_format="inchi",
|
61
75
|
callback=archive_callback,
|
62
76
|
))
|
63
77
|
"""A test of converting a archives of files"""
|
64
78
|
|
65
|
-
l_all_test_specs.append(Spec(name="Archive (wrong format)",
|
79
|
+
l_all_test_specs.append(Spec(name="Archive (wrong format) - Library and CLA",
|
66
80
|
filename="caffeine-smi.zip",
|
67
81
|
to_format="inchi",
|
68
|
-
|
69
|
-
|
82
|
+
from_format=["pdb-0", "pdb-0"],
|
83
|
+
conversion_kwargs=[{}, {"strict": True}],
|
70
84
|
expect_success=[True, False],
|
71
85
|
callback=[CheckStderrContents(const.ERR_WRONG_EXTENSIONS),
|
72
86
|
CheckException(ex_type=FileConverterInputException,
|
73
87
|
ex_message=const.ERR_WRONG_EXTENSIONS)],
|
88
|
+
compatible_with_gui=False,
|
74
89
|
))
|
75
90
|
"""A test that if the user provides the wrong input format for files in an archive, and error will be output to stderr
|
76
91
|
"""
|
77
92
|
|
93
|
+
l_all_test_specs.append(Spec(name="Archive (wrong format) - GUI",
|
94
|
+
filename="caffeine-smi.zip",
|
95
|
+
to_format="inchi",
|
96
|
+
from_format=["pdb-0", "pdb-0"],
|
97
|
+
conversion_kwargs=[{}, {"strict": True}],
|
98
|
+
expect_success=[False, False],
|
99
|
+
callback=CheckException(ex_type=FileConverterInputException,
|
100
|
+
ex_message=const.ERR_WRONG_EXTENSIONS),
|
101
|
+
compatible_with_library=False,
|
102
|
+
compatible_with_cla=False,
|
103
|
+
))
|
104
|
+
"""A test that if the user provides the wrong input format for files in an archive - variant for the GUI test, which is
|
105
|
+
more strict
|
106
|
+
"""
|
107
|
+
|
108
|
+
|
78
109
|
l_all_test_specs.append(Spec(name="Log mode",
|
79
110
|
conversion_kwargs=[{"log_mode": const.LOG_NONE},
|
80
111
|
{"log_mode": const.LOG_STDOUT},
|
@@ -124,7 +155,7 @@ Not compatible with GUI tests, since the GUI doesn't support quiet mode
|
|
124
155
|
|
125
156
|
l_all_test_specs.append(Spec(name="Open Babel Warning",
|
126
157
|
filename="1NE6.mmcif",
|
127
|
-
to_format="pdb",
|
158
|
+
to_format="pdb-0",
|
128
159
|
callback=CheckLogContentsSuccess(["Open Babel Warning",
|
129
160
|
"Failed to kekulize aromatic bonds",])
|
130
161
|
))
|
@@ -138,8 +169,12 @@ l_all_test_specs.append(Spec(name="Invalid Converter",
|
|
138
169
|
converter_name="INVALID",
|
139
170
|
expect_success=False,
|
140
171
|
callback=invalid_converter_callback,
|
172
|
+
compatible_with_gui=False,
|
141
173
|
))
|
142
|
-
"""A test that a proper error is returned if an invalid converter is requested
|
174
|
+
"""A test that a proper error is returned if an invalid converter is requested
|
175
|
+
|
176
|
+
Not compatible with GUI tests, since the GUI only offers valid converters to choose from
|
177
|
+
"""
|
143
178
|
|
144
179
|
quartz_quality_note_callback = CheckLogContentsSuccess(["WARNING",
|
145
180
|
const.QUAL_NOTE_OUT_MISSING.format(const.QUAL_2D_LABEL),
|
@@ -165,12 +200,17 @@ output and will be lost"""
|
|
165
200
|
l_all_test_specs.append(Spec(name="Cleanup input",
|
166
201
|
conversion_kwargs={"delete_input": True},
|
167
202
|
callback=CheckFileStatus(expect_input_exists=False),
|
203
|
+
compatible_with_gui=False,
|
168
204
|
))
|
169
|
-
"""A test that the input file to a conversion is deleted when cleanup is requested
|
205
|
+
"""A test that the input file to a conversion is deleted when cleanup is requested.
|
206
|
+
|
207
|
+
Not compatible with the GUI, since the GUI can't forcibly delete files uploaded from the user's computer
|
208
|
+
"""
|
170
209
|
|
171
210
|
l_all_test_specs.append(Spec(name="Failed conversion - bad input file",
|
172
211
|
filename=["quartz_err.xyz", "cyclopropane_err.mol"],
|
173
212
|
to_format=["inchi", "xyz"],
|
213
|
+
from_format=[None, "mol-0"],
|
174
214
|
expect_success=False,
|
175
215
|
converter_name=[CONVERTER_OB, CONVERTER_C2X],
|
176
216
|
callback=[MCB(CheckFileStatus(expect_output_exists=False,
|
@@ -186,46 +226,103 @@ l_all_test_specs.append(Spec(name="Failed conversion - bad input file",
|
|
186
226
|
|
187
227
|
quartz_error_ob_callback = CheckLogContents(["ERROR",
|
188
228
|
"Problems reading an XYZ file: Could not read line #11, file error"])
|
189
|
-
l_all_test_specs.append(Spec(name="Errors in logs",
|
229
|
+
l_all_test_specs.append(Spec(name="Errors in logs - Library and CLA",
|
190
230
|
filename="quartz_err.xyz",
|
191
231
|
to_format="inchi",
|
192
232
|
converter_name=CONVERTER_OB,
|
193
233
|
expect_success=False,
|
194
234
|
callback=quartz_error_ob_callback,
|
235
|
+
compatible_with_gui=False,
|
195
236
|
))
|
196
|
-
"""A test that when a conversion fails, logs are still produced and contain the expected error
|
237
|
+
"""A test that when a conversion fails in the library or CLA, logs are still produced and contain the expected error
|
238
|
+
message"""
|
239
|
+
|
240
|
+
l_all_test_specs.append(Spec(name="Errors in logs - GUI",
|
241
|
+
filename="quartz_err.xyz",
|
242
|
+
to_format="inchi",
|
243
|
+
converter_name=CONVERTER_OB,
|
244
|
+
expect_success=False,
|
245
|
+
callback=CheckException(ex_type=FileConverterAbortException,
|
246
|
+
ex_message=("Problems reading an XYZ file: Could not read line "
|
247
|
+
"#11, file error")),
|
248
|
+
compatible_with_library=False,
|
249
|
+
compatible_with_cla=False,
|
250
|
+
))
|
251
|
+
"""A test that when a conversion fails in the GUI, the log message is output to the alert box"""
|
197
252
|
|
198
253
|
l_all_test_specs.append(Spec(name="Failed conversion - invalid conversion",
|
199
254
|
filename=["Fapatite.ins", "nacl.mol"],
|
255
|
+
from_format=["ins", "mol-0"],
|
200
256
|
to_format=["cml", "xyz"],
|
201
257
|
expect_success=False,
|
202
|
-
converter_name=[
|
258
|
+
converter_name=[CONVERTER_C2X, CONVERTER_ATO],
|
203
259
|
callback=MCB(CheckFileStatus(expect_output_exists=False,
|
204
260
|
expect_log_exists=None),
|
205
|
-
CheckException(ex_type=
|
261
|
+
CheckException(ex_type=FileConverterDatabaseException,
|
206
262
|
ex_message="is not supported")),
|
263
|
+
compatible_with_gui=False,
|
207
264
|
))
|
208
|
-
"""A test that a conversion that fails due an unsupported conversion will properly fail
|
265
|
+
"""A test that a conversion that fails due an unsupported conversion will properly fail.
|
266
|
+
|
267
|
+
Not compatible with the GUI, since the GUI only offers valid conversions.
|
268
|
+
"""
|
209
269
|
|
210
|
-
l_all_test_specs.append(Spec(name="
|
270
|
+
l_all_test_specs.append(Spec(name="Blocked conversion - wrong input type",
|
211
271
|
filename="1NE6.mmcif",
|
212
272
|
to_format="cif",
|
213
|
-
|
273
|
+
from_format="pdb-0",
|
274
|
+
conversion_kwargs={"strict": True},
|
214
275
|
expect_success=False,
|
215
276
|
callback=MCB(CheckFileStatus(expect_output_exists=False,
|
216
|
-
|
277
|
+
expect_log_exists=None),
|
278
|
+
CheckException(ex_type=FileConverterInputException,
|
279
|
+
ex_message=("The file extension is not {} or a zip or tar "
|
280
|
+
"archive extension"))),
|
281
|
+
compatible_with_library=False,
|
282
|
+
compatible_with_cla=False,
|
283
|
+
))
|
284
|
+
"""A test that a conversion which is blocked in the GUI"""
|
285
|
+
|
286
|
+
l_all_test_specs.append(Spec(name="Failed conversion - wrong input type",
|
287
|
+
filename="1NE6.mmcif",
|
288
|
+
to_format="cif",
|
289
|
+
from_format="pdb-0",
|
290
|
+
conversion_kwargs={"strict": False},
|
291
|
+
expect_success=False,
|
292
|
+
callback=MCB(CheckFileStatus(expect_output_exists=False,
|
293
|
+
expect_log_exists=None),
|
217
294
|
CheckException(ex_type=FileConverterAbortException,
|
218
|
-
ex_message="not a valid {} file")),
|
295
|
+
ex_message=("not a valid {} file"))),
|
219
296
|
))
|
220
297
|
"""A test that a conversion which fails due to the wrong input file type will properly fail"""
|
221
298
|
|
222
|
-
l_all_test_specs.append(Spec(name="Large files",
|
299
|
+
l_all_test_specs.append(Spec(name="Large files - Library and CLA",
|
223
300
|
filename=["ch3cl-esp.cub", "benzyne.molden", "periodic_dmol3.outmol",
|
224
301
|
"fullRhinovirus.pdb"],
|
225
302
|
to_format=["cdjson", "dmol", "mol", "cif"],
|
303
|
+
from_format=[None, None, None, "pdb-0"],
|
304
|
+
conversion_kwargs=[{}, {}, {}, {"strict": False}],
|
226
305
|
converter_name=[CONVERTER_OB, CONVERTER_OB, CONVERTER_OB, CONVERTER_C2X],
|
227
306
|
callback=CheckFileStatus(),
|
307
|
+
compatible_with_gui=False,
|
228
308
|
))
|
309
|
+
"""Test that the library and CLA can process large files properly"""
|
310
|
+
|
311
|
+
l_all_test_specs.append(Spec(name="Large files - GUI",
|
312
|
+
filename=["ch3cl-esp.cub", "benzyne.molden",
|
313
|
+
"periodic_dmol3.outmol", "fullRhinovirus.pdb"],
|
314
|
+
to_format=["cdjson", "dmol", "mol", "cif"],
|
315
|
+
from_format=[None, None, None, "pdb-0"],
|
316
|
+
converter_name=[CONVERTER_OB, CONVERTER_OB, CONVERTER_OB, CONVERTER_C2X],
|
317
|
+
expect_success=[False, False, False, True],
|
318
|
+
callback=[CheckException(ex_type=FileConverterInputException),
|
319
|
+
CheckException(ex_type=FileConverterInputException),
|
320
|
+
CheckException(ex_type=FileConverterInputException),
|
321
|
+
CheckFileStatus()],
|
322
|
+
compatible_with_library=False,
|
323
|
+
compatible_with_cla=False,
|
324
|
+
))
|
325
|
+
"""Test that the GUI will refuse to process large files with OB, but will with other converters"""
|
229
326
|
|
230
327
|
max_size_callback = MCB(CheckFileStatus(expect_output_exists=False),
|
231
328
|
CheckLogContents("file exceeds maximum size"),
|
@@ -234,17 +331,21 @@ max_size_callback = MCB(CheckFileStatus(expect_output_exists=False),
|
|
234
331
|
ex_status_code=const.STATUS_CODE_SIZE))
|
235
332
|
l_all_test_specs.append(Spec(name="Max size exceeded",
|
236
333
|
filename=["1NE6.mmcif", "caffeine-smi.tar.gz"],
|
237
|
-
to_format="pdb",
|
334
|
+
to_format="pdb-0",
|
238
335
|
conversion_kwargs=[{"max_file_size": 0.0001}, {"max_file_size": 0.0005}],
|
239
336
|
expect_success=False,
|
240
337
|
callback=max_size_callback,
|
241
338
|
compatible_with_cla=False,
|
339
|
+
compatible_with_gui=False,
|
242
340
|
))
|
243
341
|
"""A set of test conversion that the maximum size constraint is properly applied. In the first test, the input file
|
244
342
|
will be greater than the maximum size, and the test should fail as soon as it checks it. In the second test, the input
|
245
343
|
archive is smaller than the maximum size, but the unpacked files in it are greater, so it should fail midway through.
|
246
344
|
|
247
345
|
Not compatible with CLA tests, since the CLA doesn't allow the imposition of a maximum size.
|
346
|
+
|
347
|
+
Not compatible with GUI tests in current setup of test implementation, which doesn't let us set env vars to control
|
348
|
+
things like maximum size on a per-test basis. May be possible to set up in the future though
|
248
349
|
"""
|
249
350
|
|
250
351
|
|
@@ -289,11 +390,11 @@ l_all_test_specs.append(Spec(name="Coord gen",
|
|
289
390
|
"""A set of tests which checks that coordinate generation options are processed correctly, by matching tests using them
|
290
391
|
to expected output files"""
|
291
392
|
|
292
|
-
l_library_test_specs = [x for x in l_all_test_specs if x.compatible_with_library]
|
393
|
+
l_library_test_specs = [x for x in l_all_test_specs if x.compatible_with_library and not x.skip_all]
|
293
394
|
"""All test specs which are compatible with being run on the Python library"""
|
294
395
|
|
295
|
-
l_cla_test_specs = [x for x in l_all_test_specs if x.compatible_with_cla]
|
396
|
+
l_cla_test_specs = [x for x in l_all_test_specs if x.compatible_with_cla and not x.skip_all]
|
296
397
|
"""All test specs which are compatible with being run on the command-line application"""
|
297
398
|
|
298
|
-
l_gui_test_specs = [x for x in l_all_test_specs if x.compatible_with_gui]
|
399
|
+
l_gui_test_specs = [x for x in l_all_test_specs if x.compatible_with_gui and not x.skip_all]
|
299
400
|
"""All test specs which are compatible with being run on the GUI"""
|