summaryrefslogtreecommitdiff
path: root/tests/files
diff options
context:
space:
mode:
authorShai Berger <shai@platonix.com>2015-06-05 10:32:29 +0300
committerShai Berger <shai@platonix.com>2015-06-05 12:57:20 +0300
commit071801ccff970682a799ce754431a3c3ce3d6902 (patch)
tree838e774455719f7110b15e74e3d7cb6722e1d8f0 /tests/files
parent1f28521e0ac81dcc660a5b9891f45a20306e093a (diff)
downloaddjango-071801ccff970682a799ce754431a3c3ce3d6902.tar.gz
Cleanup: Removed the try-except-fail antipattern from tests
Found cases where testing code was doing try: whatever except (some excption type): self.fail("exception shouldn't be thrown") replaced it with just whatever as this makes the unexpected errors easier to debug, and the tests would fail just as much and aren't rendered less readable. Thanks Markus Holtermann for review
Diffstat (limited to 'tests/files')
-rw-r--r--tests/files/tests.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/tests/files/tests.py b/tests/files/tests.py
index 13560e509c..cd2ccaf9f1 100644
--- a/tests/files/tests.py
+++ b/tests/files/tests.py
@@ -6,7 +6,6 @@ import os
import struct
import tempfile
import unittest
-import zlib
from io import BytesIO, StringIO
from django.core.files import File
@@ -233,10 +232,7 @@ class InconsistentGetImageDimensionsBug(unittest.TestCase):
get_image_dimensions fails on some pngs, while Image.size is working good on them
"""
img_path = os.path.join(os.path.dirname(upath(__file__)), "magic.png")
- try:
- size = images.get_image_dimensions(img_path)
- except zlib.error:
- self.fail("Exception raised from get_image_dimensions().")
+ size = images.get_image_dimensions(img_path)
with open(img_path, 'rb') as fh:
self.assertEqual(size, Image.open(fh).size)