diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2010-12-08 21:45:01 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2010-12-08 21:45:01 +0100 |
commit | 7a5d49413bef5d9866d401dee1b817ec941a4ef7 (patch) | |
tree | 1d3ff283a971a78d7a9ad3120e9f58213beab359 /test | |
parent | 6734ebcb98ce248ce9c975b3a06a6b65935f6c54 (diff) | |
download | pyexiv2-7a5d49413bef5d9866d401dee1b817ec941a4ef7.tar.gz |
Use isinstance(…) instead of type(…) everywhere, as recommended by Python’s documentation
(http://docs.python.org/library/functions.html#type).
Diffstat (limited to 'test')
-rw-r--r-- | test/ReadMetadataTestCase.py | 4 | ||||
-rw-r--r-- | test/metadata.py | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/test/ReadMetadataTestCase.py b/test/ReadMetadataTestCase.py index 1ca9e5d..40f0843 100644 --- a/test/ReadMetadataTestCase.py +++ b/test/ReadMetadataTestCase.py @@ -38,12 +38,12 @@ class ReadMetadataTestCase(unittest.TestCase): """ def check_type_and_value(self, tag, etype, evalue): - self.assertEqual(type(tag.value), etype) + self.assert_(isinstance(tag.value, etype)) self.assertEqual(tag.value, evalue) def check_type_and_values(self, tag, etype, evalues): for value in tag.value: - self.assertEqual(type(value), etype) + self.assert_(isinstance(value, etype)) self.assertEqual(tag.value, evalues) def assertCorrectFile(self, filename, md5sum): diff --git a/test/metadata.py b/test/metadata.py index 96a7510..13aaf97 100644 --- a/test/metadata.py +++ b/test/metadata.py @@ -180,7 +180,7 @@ class TestImageMetadata(unittest.TestCase): # Get an existing tag key = 'Exif.Image.Make' tag = self.metadata._get_exif_tag(key) - self.assertEqual(type(tag), ExifTag) + self.assert_(isinstance(tag, ExifTag)) self.assertEqual(self.metadata._tags['exif'][key], tag) # Try to get an nonexistent tag key = 'Exif.Photo.Sharpness' @@ -288,7 +288,7 @@ class TestImageMetadata(unittest.TestCase): # Get an existing tag key = 'Iptc.Application2.DateCreated' tag = self.metadata._get_iptc_tag(key) - self.assertEqual(type(tag), IptcTag) + self.assert_(isinstance(tag, IptcTag)) self.assertEqual(self.metadata._tags['iptc'][key], tag) # Try to get an nonexistent tag key = 'Iptc.Application2.Copyright' @@ -396,7 +396,7 @@ class TestImageMetadata(unittest.TestCase): # Get an existing tag key = 'Xmp.dc.subject' tag = self.metadata._get_xmp_tag(key) - self.assertEqual(type(tag), XmpTag) + self.assert_(isinstance(tag, XmpTag)) self.assertEqual(self.metadata._tags['xmp'][key], tag) # Try to get an nonexistent tag key = 'Xmp.xmp.Label' @@ -497,13 +497,13 @@ class TestImageMetadata(unittest.TestCase): # Get existing tags key = 'Exif.Image.DateTime' tag = self.metadata[key] - self.assertEqual(type(tag), ExifTag) + self.assert_(isinstance(tag, ExifTag)) key = 'Iptc.Application2.Caption' tag = self.metadata[key] - self.assertEqual(type(tag), IptcTag) + self.assert_(isinstance(tag, IptcTag)) key = 'Xmp.dc.format' tag = self.metadata[key] - self.assertEqual(type(tag), XmpTag) + self.assert_(isinstance(tag, XmpTag)) # Try to get nonexistent tags keys = ('Exif.Image.SamplesPerPixel', 'Iptc.Application2.FixtureId', 'Xmp.xmp.Rating', 'Wrong.Noluck.Raise') |