@@ -372,8 +372,6 @@ def test_keep_file_open_true_false_invalid():
372
372
# False | True | True | True
373
373
# True | False | True | n/a
374
374
# True | True | True | False
375
- # 'auto' | False | False | n/a
376
- # 'auto' | True | True | False
377
375
#
378
376
# Each test tuple contains:
379
377
# - file type - gzipped ('gz') or not ('bin'), or an open file handle
@@ -388,26 +386,18 @@ def test_keep_file_open_true_false_invalid():
388
386
('open' , False , True , False , False ),
389
387
('open' , True , False , False , False ),
390
388
('open' , True , True , False , False ),
391
- ('open' , 'auto' , False , False , False ),
392
- ('open' , 'auto' , True , False , False ),
393
389
# non-gzip file - have_igzip is irrelevant, decision should be made
394
390
# solely from kfo flag
395
391
('bin' , False , False , False , False ),
396
392
('bin' , False , True , False , False ),
397
393
('bin' , True , False , True , True ),
398
394
('bin' , True , True , True , True ),
399
- ('bin' , 'auto' , False , False , False ),
400
- ('bin' , 'auto' , True , False , False ),
401
- # gzip file. If igzip is present, we persist the ImageOpener. If kfo
402
- # is 'auto':
403
- # - if igzip is present, kfo -> True
404
- # - otherwise, kfo -> False
395
+ # gzip file. If igzip is present, we persist the ImageOpener.
405
396
('gz' , False , False , False , False ),
406
397
('gz' , False , True , True , False ),
407
398
('gz' , True , False , True , True ),
408
399
('gz' , True , True , True , True ),
409
- ('gz' , 'auto' , False , False , False ),
410
- ('gz' , 'auto' , True , True , True )]
400
+ ]
411
401
412
402
dtype = np .float32
413
403
data = np .arange (1000 , dtype = dtype ).reshape ((10 , 10 , 10 ))
@@ -477,12 +467,14 @@ def test_keep_file_open_true_false_invalid():
477
467
fname = 'testdata'
478
468
with open (fname , 'wb' ) as fobj :
479
469
fobj .write (data .tostring (order = 'F' ))
480
- with assert_raises (ValueError ):
481
- ArrayProxy (fname , ((10 , 10 , 10 ), dtype ), keep_file_open = 55 )
482
- with assert_raises (ValueError ):
483
- ArrayProxy (fname , ((10 , 10 , 10 ), dtype ), keep_file_open = 'autob' )
484
- with assert_raises (ValueError ):
485
- ArrayProxy (fname , ((10 , 10 , 10 ), dtype ), keep_file_open = 'cauto' )
470
+
471
+ for invalid_kfo in (55 , 'auto' , 'cauto' ):
472
+ with assert_raises (ValueError ):
473
+ ArrayProxy (fname , ((10 , 10 , 10 ), dtype ),
474
+ keep_file_open = invalid_kfo )
475
+ with patch_keep_file_open_default (invalid_kfo ):
476
+ with assert_raises (ValueError ):
477
+ ArrayProxy (fname , ((10 , 10 , 10 ), dtype ))
486
478
487
479
488
480
def test_pickle_lock ():
0 commit comments