digiflow 3.7.0__tar.gz → 3.7.2__tar.gz
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.
- {digiflow-3.7.0/src/digiflow.egg-info → digiflow-3.7.2}/PKG-INFO +1 -1
- {digiflow-3.7.0 → digiflow-3.7.2}/pyproject.toml +1 -1
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/__init__.py +1 -1
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/validate/__init__.py +3 -1
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/validate/common.py +4 -1
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/validate/imgdata.py +55 -33
- {digiflow-3.7.0 → digiflow-3.7.2/src/digiflow.egg-info}/PKG-INFO +1 -1
- {digiflow-3.7.0 → digiflow-3.7.2}/tests/test_validate_imgdata.py +39 -8
- {digiflow-3.7.0 → digiflow-3.7.2}/LICENCE +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/MANIFEST.in +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/README.md +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/setup.cfg +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/digflow_identifier.py +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/digiflow_export.py +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/digiflow_generate.py +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/digiflow_io.py +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/digiflow_metadata.py +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/digiflow_validate.py +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/resources/digilife.ini +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/resources/xsd/alto_4-2.xsd +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/resources/xsd/mets_1-12.xsd +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/resources/xsd/mix_2-0.xsd +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/resources/xsd/mods_3-7.xsd +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/resources/xsd/page_2019-07-15.xsd +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/resources/xsd/xlink.xsd +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/resources/xsd/xml.xsd +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/resources/xsl/ddb_validierung_mets-mods-ap-digitalisierte-medien.xsl +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/resources/xsl/ddb_validierung_mets-mods-ap-digitalisierte-zeitungen.xsl +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow/validate/fsdata.py +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow.egg-info/SOURCES.txt +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow.egg-info/dependency_links.txt +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow.egg-info/requires.txt +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/src/digiflow.egg-info/top_level.txt +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/tests/test_digiflow_generate.py +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/tests/test_digiflow_identifier.py +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/tests/test_digiflow_io.py +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/tests/test_digiflow_metadata.py +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/tests/test_digiflow_metadata_transform.py +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/tests/test_digiflow_validate_mets.py +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/tests/test_export_saf.py +0 -0
- {digiflow-3.7.0 → digiflow-3.7.2}/tests/test_validate_fsdata.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: digiflow
|
|
3
|
-
Version: 3.7.
|
|
3
|
+
Version: 3.7.2
|
|
4
4
|
Summary: Father's Little Digitization Workflow Helper
|
|
5
5
|
Author-email: Universitäts- und Landesbibliothek Sachsen-Anhalt <development@bibliothek.uni-halle.de>
|
|
6
6
|
Project-URL: Homepage, https://github.com/ulb-sachsen-anhalt/digital-flow
|
|
@@ -13,7 +13,9 @@ from typing import (
|
|
|
13
13
|
|
|
14
14
|
UNSET_LABEL = 'n.a.'
|
|
15
15
|
UNSET_NUMBR = -1
|
|
16
|
-
|
|
16
|
+
INVALID_LABEL_UNSET = 'INVALID_UNSET'
|
|
17
|
+
INVALID_LABEL_RANGE = 'INVALID_RANGE'
|
|
18
|
+
INVALID_LABEL_TYPE = 'INVALID_TYPE'
|
|
17
19
|
|
|
18
20
|
LABEL_VALIDATOR_SCAN_COMBINED = 'ScanCombinedValidator'
|
|
19
21
|
LABEL_VALIDATOR_SCAN_CHANNEL = 'ScanMetadataChannel'
|
|
@@ -28,6 +30,7 @@ class Invalid:
|
|
|
28
30
|
"""Container for invalid data"""
|
|
29
31
|
|
|
30
32
|
label: str
|
|
33
|
+
location: str
|
|
31
34
|
info: str
|
|
32
35
|
|
|
33
36
|
|
|
@@ -46,11 +46,13 @@ from .common import (
|
|
|
46
46
|
LABEL_VALIDATOR_SCAN_FILEDATA,
|
|
47
47
|
LABEL_VALIDATOR_SCAN_CHANNEL,
|
|
48
48
|
LABEL_VALIDATOR_SCAN_COMPRESSION,
|
|
49
|
-
|
|
49
|
+
LABEL_VALIDATOR_SCAN_RESOLUTION,
|
|
50
50
|
LABEL_VALIDATOR_SCAN_PHOTOMETRICS,
|
|
51
|
+
INVALID_LABEL_RANGE,
|
|
52
|
+
INVALID_LABEL_TYPE,
|
|
53
|
+
INVALID_LABEL_UNSET,
|
|
51
54
|
UNSET_LABEL,
|
|
52
55
|
UNSET_NUMBR,
|
|
53
|
-
INVALID_UNSET_LABEL,
|
|
54
56
|
Validator,
|
|
55
57
|
Invalid,
|
|
56
58
|
)
|
|
@@ -171,7 +173,7 @@ class Image:
|
|
|
171
173
|
except Exception as exc:
|
|
172
174
|
raise InvalidImageDataException(exc.args[0])
|
|
173
175
|
|
|
174
|
-
def _read(self, img_data:TiffImageFile) -> ImageMetadata:
|
|
176
|
+
def _read(self, img_data: TiffImageFile) -> ImageMetadata:
|
|
175
177
|
"""Read present TIFF metadata information
|
|
176
178
|
Please note, ICC Profile requires special
|
|
177
179
|
care since this is included in bytes
|
|
@@ -226,13 +228,14 @@ class ScanFileValidator(Validator):
|
|
|
226
228
|
raise FSReadException(f'No permission to read {self.input_data}!')
|
|
227
229
|
_file_size = os.path.getsize(self.input_data)
|
|
228
230
|
if _file_size < MIN_SCAN_FILESIZE:
|
|
229
|
-
_msg = f"
|
|
230
|
-
self.invalids.append(Invalid(self.label, _msg))
|
|
231
|
-
_input: Image = self.input_data
|
|
231
|
+
_msg = f"{INVALID_LABEL_RANGE} filesize {_file_size}b < {MIN_SCAN_FILESIZE}b"
|
|
232
|
+
self.invalids.append(Invalid(self.label, self.input_data, _msg))
|
|
233
|
+
_input: Image = Image(self.input_data)
|
|
232
234
|
_input.read()
|
|
233
235
|
_imd: ImageMetadata = _input.metadata
|
|
234
236
|
if not _imd.width or not _imd.height:
|
|
235
|
-
self.invalids.append(Invalid(self.label,
|
|
237
|
+
self.invalids.append(Invalid(self.label, self.input_data,
|
|
238
|
+
f"{INVALID_LABEL_UNSET} width/height"))
|
|
236
239
|
return super().valid()
|
|
237
240
|
|
|
238
241
|
|
|
@@ -246,17 +249,22 @@ class ScanChannelValidator(Validator):
|
|
|
246
249
|
super().__init__(LABEL_VALIDATOR_SCAN_CHANNEL, input_data)
|
|
247
250
|
|
|
248
251
|
def valid(self) -> bool:
|
|
252
|
+
_label_spp = TIFF_METADATA_LABELS[SAMPLESPERPIXEL]
|
|
249
253
|
_input: Image = self.input_data
|
|
250
254
|
_imd: ImageMetadata = _input.metadata
|
|
251
|
-
|
|
252
|
-
if
|
|
253
|
-
self.invalids.append(Invalid(self.label,
|
|
254
|
-
|
|
255
|
-
|
|
255
|
+
_spp = _imd.samples_per_pixel
|
|
256
|
+
if _spp == UNSET_LABEL:
|
|
257
|
+
self.invalids.append(Invalid(self.label, _input.local_path,
|
|
258
|
+
f"{INVALID_LABEL_UNSET} {_label_spp}"))
|
|
259
|
+
elif _spp not in GREYSCALE_OR_RGB:
|
|
260
|
+
self.invalids.append(Invalid(self.label, _input.local_path,
|
|
261
|
+
f"{INVALID_LABEL_RANGE} {_label_spp} {_spp} not in {GREYSCALE_OR_RGB}"))
|
|
256
262
|
if not all(c <= MAX_CHANNEL_DEPTH for c in _imd.channel):
|
|
257
|
-
|
|
263
|
+
_label_ch = TIFF_METADATA_LABELS[BITSPERSAMPLE]
|
|
264
|
+
self.invalids.append(Invalid(self.label, _input.local_path,
|
|
265
|
+
f"{INVALID_LABEL_RANGE} {_label_ch} {_imd.channel} > {MAX_CHANNEL_DEPTH}"))
|
|
258
266
|
return super().valid()
|
|
259
|
-
|
|
267
|
+
|
|
260
268
|
|
|
261
269
|
class ScanCompressionValidator(Validator):
|
|
262
270
|
"""Validate EXIF metadata uncompressed set"""
|
|
@@ -270,7 +278,8 @@ class ScanCompressionValidator(Validator):
|
|
|
270
278
|
_input: Image = self.input_data
|
|
271
279
|
_imd: ImageMetadata = _input.metadata
|
|
272
280
|
if _imd.compression != 1:
|
|
273
|
-
|
|
281
|
+
_info = f"{INVALID_LABEL_RANGE} {TIFF_METADATA_LABELS[COMPRESSION]} {_imd.compression} != 1"
|
|
282
|
+
self.invalids.append(Invalid(self.label, _input.local_path, _info))
|
|
274
283
|
return super().valid()
|
|
275
284
|
|
|
276
285
|
|
|
@@ -286,31 +295,41 @@ class ScanResolutionValidator(Validator):
|
|
|
286
295
|
|
|
287
296
|
def valid(self) -> bool:
|
|
288
297
|
_input: Image = self.input_data
|
|
298
|
+
_loc = _input.local_path
|
|
289
299
|
_imd: ImageMetadata = _input.metadata
|
|
290
300
|
_prefix = self.label
|
|
291
301
|
_lbl_x = f"{TIFF_METADATA_LABELS[X_RESOLUTION]}"
|
|
292
302
|
_lbl_y = f"{TIFF_METADATA_LABELS[Y_RESOLUTION]}"
|
|
293
303
|
_lbl_unit = f"{TIFF_METADATA_LABELS[RESOLUTION_UNIT]}"
|
|
294
304
|
if _imd.resolution_unit == UNSET_NUMBR:
|
|
295
|
-
|
|
305
|
+
_inv01 = Invalid(_prefix, _loc, f"{INVALID_LABEL_UNSET} {_lbl_unit}")
|
|
306
|
+
self.invalids.append(_inv01)
|
|
296
307
|
if _imd.resolution_unit != RES_UNIT_DPI:
|
|
297
|
-
|
|
308
|
+
_inv02 = Invalid(
|
|
309
|
+
_prefix, _loc, f"{INVALID_LABEL_RANGE} {_lbl_unit} {_imd.resolution_unit} != {RES_UNIT_DPI}")
|
|
310
|
+
self.invalids.append(_inv02)
|
|
298
311
|
if _imd.xRes == UNSET_NUMBR:
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
312
|
+
_inv03 = Invalid(_prefix, _loc, f"{INVALID_LABEL_UNSET} {_lbl_x}")
|
|
313
|
+
self.invalids.append(_inv03)
|
|
314
|
+
# if _imd.xRes < MIN_SCAN_RESOLUTION:
|
|
315
|
+
# _inv04 = Invalid(_prefix, _loc, f"{INVALID_LABEL_RANGE}{_lbl_x}: {_imd.xRes}")
|
|
316
|
+
# self.invalids.append(_inv04)
|
|
302
317
|
if _imd.yRes == UNSET_NUMBR:
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
318
|
+
_inv05 = Invalid(_prefix, _loc, f"{INVALID_LABEL_UNSET} {_lbl_y}")
|
|
319
|
+
self.invalids.append(_inv05)
|
|
320
|
+
# if _imd.yRes < MIN_SCAN_RESOLUTION:
|
|
321
|
+
# _inv06 = Invalid(_prefix, _loc, f"{INVALID_LABEL_RANGE} {_lbl_y}: {_imd.yRes}")
|
|
322
|
+
# self.invalids.append(_inv06)
|
|
306
323
|
_xres: IFDRational = _imd.xRes
|
|
307
324
|
if _xres.real.denominator != 1:
|
|
308
|
-
|
|
325
|
+
_inv07 = Invalid(_prefix, _loc, f"{INVALID_LABEL_TYPE} {_lbl_x}: {_imd.xRes}")
|
|
326
|
+
self.invalids.append(_inv07)
|
|
309
327
|
_yres: IFDRational = _imd.yRes
|
|
310
328
|
if _yres.real.denominator != 1:
|
|
311
|
-
|
|
329
|
+
_inv08 = Invalid(_prefix, _loc, f"{INVALID_LABEL_TYPE} {_lbl_y}: {_imd.yRes}")
|
|
330
|
+
self.invalids.append(_inv08)
|
|
312
331
|
return super().valid()
|
|
313
|
-
|
|
332
|
+
|
|
314
333
|
|
|
315
334
|
class ScanPhotometricValidator(Validator):
|
|
316
335
|
"""Check EXIF Photometric information
|
|
@@ -326,9 +345,13 @@ class ScanPhotometricValidator(Validator):
|
|
|
326
345
|
_imd: ImageMetadata = _input.metadata
|
|
327
346
|
_pmetric = _imd.photometric_interpretation
|
|
328
347
|
if _pmetric not in PHOTOMETRICS:
|
|
329
|
-
|
|
348
|
+
_label_pi = TIFF_METADATA_LABELS[PHOTOMETRIC_INTERPRETATION]
|
|
349
|
+
self.invalids.append(Invalid(self.label, _input.local_path,
|
|
350
|
+
f"{INVALID_LABEL_RANGE} {_label_pi} {_pmetric} not in {PHOTOMETRICS}"))
|
|
330
351
|
if _pmetric == 2 and _input.profile != ADOBE_PROFILE_NAME:
|
|
331
|
-
|
|
352
|
+
_label_pro = TIFF_METADATA_LABELS[ICCPROFILE]
|
|
353
|
+
self.invalids.append(Invalid(self.label, _input.local_path,
|
|
354
|
+
f"{INVALID_LABEL_RANGE} {_label_pro} != {ADOBE_PROFILE_NAME}"))
|
|
332
355
|
return super().valid()
|
|
333
356
|
|
|
334
357
|
|
|
@@ -344,7 +367,7 @@ DEFAULT_VALIDATORS = [
|
|
|
344
367
|
class CombinedScanValidator(Validator):
|
|
345
368
|
"""Encapsulate image validation"""
|
|
346
369
|
|
|
347
|
-
def __init__(self, path_input:Path, validator_labels:List[str]):
|
|
370
|
+
def __init__(self, path_input: Path, validator_labels: List[str]):
|
|
348
371
|
super().__init__(LABEL_VALIDATOR_SCAN_COMBINED, path_input)
|
|
349
372
|
self.path_input = path_input
|
|
350
373
|
self.validator_labels: List[str] = validator_labels
|
|
@@ -356,7 +379,7 @@ class CombinedScanValidator(Validator):
|
|
|
356
379
|
self.img_data.read()
|
|
357
380
|
for _label in self.validator_labels:
|
|
358
381
|
_val_clazz = ValidatorFactory.get(_label)
|
|
359
|
-
_val:Validator = _val_clazz(self.img_data)
|
|
382
|
+
_val: Validator = _val_clazz(self.img_data)
|
|
360
383
|
if not _val.valid():
|
|
361
384
|
self.invalids.extend(_val.invalids)
|
|
362
385
|
return super().valid()
|
|
@@ -368,7 +391,6 @@ VALIDATORS = {
|
|
|
368
391
|
LABEL_VALIDATOR_SCAN_CHANNEL: ScanChannelValidator,
|
|
369
392
|
LABEL_VALIDATOR_SCAN_COMPRESSION: ScanCompressionValidator,
|
|
370
393
|
LABEL_VALIDATOR_SCAN_RESOLUTION: ScanResolutionValidator,
|
|
371
|
-
LABEL_VALIDATOR_SCAN_FILEDATA: TiffImageFile,
|
|
372
394
|
LABEL_VALIDATOR_SCAN_PHOTOMETRICS: ScanPhotometricValidator,
|
|
373
395
|
}
|
|
374
396
|
|
|
@@ -376,9 +398,9 @@ VALIDATORS = {
|
|
|
376
398
|
class ValidatorFactory:
|
|
377
399
|
|
|
378
400
|
@staticmethod
|
|
379
|
-
def get(validator_label:str) -> Validator:
|
|
401
|
+
def get(validator_label: str) -> Validator:
|
|
380
402
|
"""Get Validator object for label"""
|
|
381
|
-
|
|
403
|
+
|
|
382
404
|
if not validator_label in VALIDATORS:
|
|
383
405
|
raise Exception(f"Missing Implementation for {validator_label}!")
|
|
384
406
|
return VALIDATORS[validator_label]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: digiflow
|
|
3
|
-
Version: 3.7.
|
|
3
|
+
Version: 3.7.2
|
|
4
4
|
Summary: Father's Little Digitization Workflow Helper
|
|
5
5
|
Author-email: Universitäts- und Landesbibliothek Sachsen-Anhalt <development@bibliothek.uni-halle.de>
|
|
6
6
|
Project-URL: Homepage, https://github.com/ulb-sachsen-anhalt/digital-flow
|
|
@@ -9,12 +9,17 @@ from pathlib import (
|
|
|
9
9
|
import pytest
|
|
10
10
|
|
|
11
11
|
from digiflow.validate import (
|
|
12
|
+
INVALID_LABEL_RANGE,
|
|
13
|
+
INVALID_LABEL_TYPE,
|
|
12
14
|
LABEL_VALIDATOR_SCAN_CHANNEL,
|
|
15
|
+
LABEL_VALIDATOR_SCAN_FILEDATA,
|
|
13
16
|
LABEL_VALIDATOR_SCAN_RESOLUTION,
|
|
14
17
|
Image,
|
|
15
18
|
CombinedScanValidator,
|
|
16
19
|
ScanChannelValidator,
|
|
17
20
|
ScanResolutionValidator,
|
|
21
|
+
Validator,
|
|
22
|
+
ValidatorFactory,
|
|
18
23
|
validate_tiff,
|
|
19
24
|
)
|
|
20
25
|
|
|
@@ -39,7 +44,10 @@ def test_tiff_channel_depth_invalid(tmp_path):
|
|
|
39
44
|
|
|
40
45
|
# assert
|
|
41
46
|
assert len(_outcomes.invalids) == 1
|
|
42
|
-
|
|
47
|
+
_inv = _outcomes.invalids[0]
|
|
48
|
+
assert _inv.label == LABEL_VALIDATOR_SCAN_CHANNEL
|
|
49
|
+
assert _inv.location == file_target
|
|
50
|
+
assert f'{INVALID_LABEL_RANGE} channel (16, 16, 16) > 8' == _inv.info
|
|
43
51
|
|
|
44
52
|
|
|
45
53
|
def test_tiff_resolution_invalid(tmp_path):
|
|
@@ -59,11 +67,11 @@ def test_tiff_resolution_invalid(tmp_path):
|
|
|
59
67
|
# assert
|
|
60
68
|
assert len(_outcomes.invalids) == 2
|
|
61
69
|
assert str(_outcomes.path_input).endswith(file_name)
|
|
62
|
-
assert 'xRes: 470.55' == _outcomes.invalids[0].info
|
|
63
|
-
assert 'yRes: 470.55' == _outcomes.invalids[1].info
|
|
70
|
+
assert f'{INVALID_LABEL_TYPE} xRes: 470.55' == _outcomes.invalids[0].info
|
|
71
|
+
assert f'{INVALID_LABEL_TYPE} yRes: 470.55' == _outcomes.invalids[1].info
|
|
64
72
|
|
|
65
73
|
|
|
66
|
-
def
|
|
74
|
+
def test_tiff_validate_only_channels_valid(tmp_path):
|
|
67
75
|
"""Ensure that validation can be controlled
|
|
68
76
|
by provided labels so in this case only
|
|
69
77
|
channels are validate (although image still
|
|
@@ -94,7 +102,7 @@ def _fixture_img_resolution_invalid(tmp_path):
|
|
|
94
102
|
yield _img
|
|
95
103
|
|
|
96
104
|
|
|
97
|
-
def
|
|
105
|
+
def test_tiffexifresolution_resolution_invalid(img_resolution_invalid):
|
|
98
106
|
"""Ensure invalid resolution is recognized"""
|
|
99
107
|
|
|
100
108
|
# arrange
|
|
@@ -106,11 +114,11 @@ def test_tiffexifresolution_resolution_not_integral(img_resolution_invalid):
|
|
|
106
114
|
# assert
|
|
107
115
|
assert _tiff_exif_val.label == LABEL_VALIDATOR_SCAN_RESOLUTION
|
|
108
116
|
assert len(_tiff_exif_val.invalids) == 2
|
|
109
|
-
assert 'xRes: 470.55' == _tiff_exif_val.invalids[0].info
|
|
110
|
-
assert 'yRes: 470.55' == _tiff_exif_val.invalids[1].info
|
|
117
|
+
assert f'{INVALID_LABEL_TYPE} xRes: 470.55' == _tiff_exif_val.invalids[0].info
|
|
118
|
+
assert f'{INVALID_LABEL_TYPE} yRes: 470.55' == _tiff_exif_val.invalids[1].info
|
|
111
119
|
|
|
112
120
|
|
|
113
|
-
def
|
|
121
|
+
def test_tiffexifresolution_channels_valid(img_resolution_invalid):
|
|
114
122
|
"""Ensure channel data is valid this time"""
|
|
115
123
|
|
|
116
124
|
# arrange
|
|
@@ -164,3 +172,26 @@ def test_tiff_grayscale_newspaper_valid(tmp_path):
|
|
|
164
172
|
assert _img_data.metadata.yRes == 470
|
|
165
173
|
assert _img_data.metadata.resolution_unit == 2
|
|
166
174
|
assert str(_img_data.url).endswith(file_name)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def test_tiff_grayscale_newspaper_only_scanfiledata_valid(tmp_path):
|
|
178
|
+
"""Prevent regression: don't map validator to
|
|
179
|
+
'TiffImageFile' since this a class from
|
|
180
|
+
'PIL.TiffImagePlugin' and all will crack
|
|
181
|
+
"""
|
|
182
|
+
|
|
183
|
+
# arrange
|
|
184
|
+
file_name = '1667522809_J_0025_0512.tif'
|
|
185
|
+
file_source = Path(TEST_RES) / 'image' / file_name
|
|
186
|
+
file_target = Path(str(tmp_path), file_name)
|
|
187
|
+
shutil.copy(file_source, file_target)
|
|
188
|
+
|
|
189
|
+
# act
|
|
190
|
+
_scan_file_validator_clazz = ValidatorFactory.get(LABEL_VALIDATOR_SCAN_FILEDATA)
|
|
191
|
+
_validator: Validator = _scan_file_validator_clazz(file_target)
|
|
192
|
+
|
|
193
|
+
# assert
|
|
194
|
+
assert _validator.valid()
|
|
195
|
+
assert _validator.label == LABEL_VALIDATOR_SCAN_FILEDATA
|
|
196
|
+
assert _validator.input_data == file_target
|
|
197
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|