Remove unclosed file guards

This commit is contained in:
Steven Silvester
2015-07-14 07:44:34 -05:00
parent 3272b85f86
commit e1596aef1b
2 changed files with 9 additions and 9 deletions
+6 -6
View File
@@ -119,7 +119,7 @@ def color_check(plugin, fmt='png'):
testing.assert_allclose(img2.astype(np.uint8), r2)
img3 = img_as_float(img)
with expected_warnings(['precision loss|unclosed file']):
with expected_warnings(['precision loss']):
r3 = roundtrip(img3, plugin, fmt)
testing.assert_allclose(r3, img)
@@ -131,12 +131,12 @@ def color_check(plugin, fmt='png'):
r4 = roundtrip(img4, plugin, fmt)
testing.assert_allclose(r4, img4)
else:
with expected_warnings(['sign loss|precision loss|unclosed file']):
with expected_warnings(['sign loss|precision loss']):
r4 = roundtrip(img4, plugin, fmt)
testing.assert_allclose(r4, img_as_ubyte(img4))
img5 = img_as_uint(img)
with expected_warnings(['precision loss|unclosed file']):
with expected_warnings(['precision loss']):
r5 = roundtrip(img5, plugin, fmt)
testing.assert_allclose(r5, img)
@@ -156,14 +156,14 @@ def mono_check(plugin, fmt='png'):
testing.assert_allclose(img2.astype(np.uint8), r2)
img3 = img_as_float(img)
with expected_warnings(['precision|unclosed file|\A\Z']):
with expected_warnings(['precision|\A\Z']):
r3 = roundtrip(img3, plugin, fmt)
if r3.dtype.kind == 'f':
testing.assert_allclose(img3, r3)
else:
testing.assert_allclose(r3, img_as_uint(img))
with expected_warnings(['precision loss|unclosed file']):
with expected_warnings(['precision loss']):
img4 = img_as_int(img)
if fmt.lower() in (('tif', 'tiff')):
img4 -= 100
@@ -171,7 +171,7 @@ def mono_check(plugin, fmt='png'):
r4 = roundtrip(img4, plugin, fmt)
testing.assert_allclose(r4, img4)
else:
with expected_warnings(['precision loss|sign loss|unclosed file']):
with expected_warnings(['precision loss|sign loss']):
r4 = roundtrip(img4, plugin, fmt)
testing.assert_allclose(r4, img_as_uint(img4))
+3 -3
View File
@@ -160,7 +160,7 @@ def test_imsave_filelike():
s = BytesIO()
# save to file-like object
with expected_warnings(['precision loss|unclosed file',
with expected_warnings(['precision loss',
'is a low contrast image']):
imsave(s, image)
@@ -230,9 +230,9 @@ class TestSaveTIF:
def roundtrip(self, dtype, x, compress):
with temporary_file(suffix='.tif') as fname:
if dtype == np.bool:
expected = ['low contrast|unclosed file']
expected = ['low contrast']
else:
expected = ['unclosed file|\A\Z']
expected = ['\A\Z']
with expected_warnings(expected):
if compress > 0:
imsave(fname, x, compress=compress)