diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/exif.py | 2 | ||||
-rw-r--r-- | test/iptc.py | 8 | ||||
-rw-r--r-- | test/metadata.py | 32 | ||||
-rw-r--r-- | test/xmp.py | 12 |
4 files changed, 27 insertions, 27 deletions
diff --git a/test/exif.py b/test/exif.py index 5736562..2bfbc67 100644 --- a/test/exif.py +++ b/test/exif.py @@ -335,7 +335,7 @@ class TestExifTag(unittest.TestCase): def test_set_raw_value_invalid(self): tag = ExifTag('Exif.GPSInfo.GPSVersionID') value = '2 0 0 foo' - self.failUnlessRaises(ValueError, tag._set_raw_value, value) + self.failUnlessRaises(ValueError, setattr, tag, 'raw_value', value) def test_makernote_types(self): # Makernote tags not attached to an image have an Undefined type by diff --git a/test/iptc.py b/test/iptc.py index c207f5a..872990a 100644 --- a/test/iptc.py +++ b/test/iptc.py @@ -2,7 +2,7 @@ # ****************************************************************************** # -# Copyright (C) 2009-2010 Olivier Tilloy <olivier@tilloy.net> +# Copyright (C) 2009-2011 Olivier Tilloy <olivier@tilloy.net> # # This file is part of the pyexiv2 distribution. # @@ -214,7 +214,7 @@ class TestIptcTag(unittest.TestCase): def test_set_single_value_raises(self): tag = IptcTag('Iptc.Application2.City', ['Seattle']) - self.failUnlessRaises(TypeError, tag._set_values, 'Barcelona') + self.failUnlessRaises(TypeError, setattr, tag, 'values', 'Barcelona') def test_set_values(self): tag = IptcTag('Iptc.Application2.City', ['Seattle']) @@ -225,12 +225,12 @@ class TestIptcTag(unittest.TestCase): def test_set_raw_values_invalid(self): tag = IptcTag('Iptc.Envelope.DateSent') values = ['foo'] - self.failUnlessRaises(ValueError, tag._set_raw_values, values) + self.failUnlessRaises(ValueError, setattr, tag, 'raw_values', values) def test_set_values_non_repeatable(self): tag = IptcTag('Iptc.Application2.ReleaseDate') values = [datetime.date.today(), datetime.date.today()] - self.failUnlessRaises(KeyError, tag._set_values, values) + self.failUnlessRaises(KeyError, setattr, tag, 'values', values) def test_deprecated_properties(self): # The .raw_values and .values properties are deprecated in favour of diff --git a/test/metadata.py b/test/metadata.py index a00d9fa..29e8d05 100644 --- a/test/metadata.py +++ b/test/metadata.py @@ -68,11 +68,11 @@ class TestImageMetadata(unittest.TestCase): def test_not_read_raises(self): # http://bugs.launchpad.net/pyexiv2/+bug/687373 self.assertRaises(IOError, self.metadata.write) - self.assertRaises(IOError, self.metadata.__getattribute__, 'dimensions') - self.assertRaises(IOError, self.metadata.__getattribute__, 'mime_type') - self.assertRaises(IOError, self.metadata.__getattribute__, 'exif_keys') - self.assertRaises(IOError, self.metadata.__getattribute__, 'iptc_keys') - self.assertRaises(IOError, self.metadata.__getattribute__, 'xmp_keys') + self.assertRaises(IOError, getattr, self.metadata, 'dimensions') + self.assertRaises(IOError, getattr, self.metadata, 'mime_type') + self.assertRaises(IOError, getattr, self.metadata, 'exif_keys') + self.assertRaises(IOError, getattr, self.metadata, 'iptc_keys') + self.assertRaises(IOError, getattr, self.metadata, 'xmp_keys') self.assertRaises(IOError, self.metadata._get_exif_tag, 'Exif.Image.Make') self.assertRaises(IOError, self.metadata._get_iptc_tag, 'Iptc.Application2.Caption') self.assertRaises(IOError, self.metadata._get_xmp_tag, 'Xmp.dc.format') @@ -82,25 +82,25 @@ class TestImageMetadata(unittest.TestCase): self.assertRaises(IOError, self.metadata._delete_exif_tag, 'Exif.Image.Make') self.assertRaises(IOError, self.metadata._delete_iptc_tag, 'Iptc.Application2.Caption') self.assertRaises(IOError, self.metadata._delete_xmp_tag, 'Xmp.dc.format') - self.assertRaises(IOError, self.metadata._get_comment) - self.assertRaises(IOError, self.metadata._set_comment, 'foobar') - self.assertRaises(IOError, self.metadata._del_comment) - self.assertRaises(IOError, self.metadata.__getattribute__, 'previews') + self.assertRaises(IOError, getattr, self.metadata, 'comment') + self.assertRaises(IOError, setattr, self.metadata, 'comment', 'foobar') + self.assertRaises(IOError, delattr, self.metadata, 'comment') + self.assertRaises(IOError, getattr, self.metadata, 'previews') other = ImageMetadata(self.pathname) self.assertRaises(IOError, self.metadata.copy, other) - self.assertRaises(IOError, self.metadata.__getattribute__, 'buffer') + self.assertRaises(IOError, getattr, self.metadata, 'buffer') thumb = self.metadata.exif_thumbnail - self.assertRaises(IOError, thumb.__getattribute__, 'mime_type') - self.assertRaises(IOError, thumb.__getattribute__, 'extension') + self.assertRaises(IOError, getattr, thumb, 'mime_type') + self.assertRaises(IOError, getattr, thumb, 'extension') self.assertRaises(IOError, thumb.write_to_file, '/tmp/foobar.jpg') self.assertRaises(IOError, thumb.erase) self.assertRaises(IOError, thumb.set_from_file, '/tmp/foobar.jpg') - self.assertRaises(IOError, thumb.__getattribute__, 'data') - self.assertRaises(IOError, thumb.__setattr__, 'data', EMPTY_JPG_DATA) - self.assertRaises(IOError, self.metadata.__getattribute__, 'iptc_charset') + self.assertRaises(IOError, getattr, thumb, 'data') + self.assertRaises(IOError, setattr, thumb, 'data', EMPTY_JPG_DATA) + self.assertRaises(IOError, getattr, self.metadata, 'iptc_charset') def test_read(self): - self.assertRaises(IOError, self.metadata.__getattribute__, '_image') + self.assertRaises(IOError, getattr, self.metadata, '_image') self.metadata.read() self.failIfEqual(self.metadata._image, None) diff --git a/test/xmp.py b/test/xmp.py index 6183277..ba5b0b6 100644 --- a/test/xmp.py +++ b/test/xmp.py @@ -359,22 +359,22 @@ class TestXmpTag(unittest.TestCase): def test_set_value_empty(self): tag = XmpTag('Xmp.dc.creator') self.failUnlessEqual(tag.type, 'seq ProperName') - self.failUnlessRaises(ValueError, tag._set_value, []) + self.failUnlessRaises(ValueError, setattr, tag, 'value', []) tag = XmpTag('Xmp.dc.title') self.failUnlessEqual(tag.type, 'Lang Alt') - self.failUnlessRaises(ValueError, tag._set_value, {}) + self.failUnlessRaises(ValueError, setattr, tag, 'value', {}) def test_set_value_incorrect_type(self): # Expecting a list of values tag = XmpTag('Xmp.dc.publisher') self.failUnlessEqual(tag.type, 'bag ProperName') - self.failUnlessRaises(TypeError, tag._set_value, None) - self.failUnlessRaises(TypeError, tag._set_value, 'bleh') + self.failUnlessRaises(TypeError, setattr, tag, 'value', None) + self.failUnlessRaises(TypeError, setattr, tag, 'value', 'bleh') # Expecting a dictionary mapping language codes to values tag = XmpTag('Xmp.dc.description') self.failUnlessEqual(tag.type, 'Lang Alt') - self.failUnlessRaises(TypeError, tag._set_value, None) - self.failUnlessRaises(TypeError, tag._set_value, ['bleh']) + self.failUnlessRaises(TypeError, setattr, tag, 'value', None) + self.failUnlessRaises(TypeError, setattr, tag, 'value', ['bleh']) def test_set_value_basestring_for_langalt(self): tag = XmpTag('Xmp.dc.description') |