aboutsummaryrefslogtreecommitdiffstats
path: root/test/ReadMetadataTestCase.py
diff options
context:
space:
mode:
authorMark Lee <bzr@lazymalevolence.com>2010-02-16 16:10:13 -0800
committerMark Lee <bzr@lazymalevolence.com>2010-02-16 16:10:13 -0800
commitd0422faf99005ff3eee9870cb2b2e182c6289862 (patch)
tree3fa1f18b9dc6f7135d6144ff307919c503cfcaca /test/ReadMetadataTestCase.py
parent742ba51a3bf978de53f09865c2b50e7d555866aa (diff)
downloadpyexiv2-d0422faf99005ff3eee9870cb2b2e182c6289862.tar.gz
XMP: Check the tag value types, not the tag type.
Diffstat (limited to 'test/ReadMetadataTestCase.py')
-rw-r--r--test/ReadMetadataTestCase.py136
1 files changed, 68 insertions, 68 deletions
diff --git a/test/ReadMetadataTestCase.py b/test/ReadMetadataTestCase.py
index 358cf7c..44121be 100644
--- a/test/ReadMetadataTestCase.py
+++ b/test/ReadMetadataTestCase.py
@@ -127,110 +127,110 @@ class ReadMetadataTestCase(unittest.TestCase):
image = pyexiv2.ImageMetadata(filename)
image.read()
- xmpTags = [('Xmp.dc.creator', 'seq ProperName', [u'Ian Britton']),
- ('Xmp.dc.description', 'Lang Alt', {u'x-default': u'Communications'}),
- ('Xmp.dc.rights', 'Lang Alt', {u'x-default': u'ian Britton - FreeFoto.com'}),
- ('Xmp.dc.source', 'Text', u'FreeFoto.com'),
- ('Xmp.dc.subject', 'bag Text', [u'Communications']),
- ('Xmp.dc.title', 'Lang Alt', {u'x-default': u'Communications'}),
+ xmpTags = [('Xmp.dc.creator', list, [u'Ian Britton']),
+ ('Xmp.dc.description', dict, {u'x-default': u'Communications'}),
+ ('Xmp.dc.rights', dict, {u'x-default': u'ian Britton - FreeFoto.com'}),
+ ('Xmp.dc.source', unicode, u'FreeFoto.com'),
+ ('Xmp.dc.subject', list, [u'Communications']),
+ ('Xmp.dc.title', dict, {u'x-default': u'Communications'}),
('Xmp.exif.ApertureValue',
- 'Rational',
+ pyexiv2.utils.Rational,
pyexiv2.utils.Rational(8, 1)),
('Xmp.exif.BrightnessValue',
- 'Rational',
+ pyexiv2.utils.Rational,
pyexiv2.utils.Rational(333, 1280)),
- ('Xmp.exif.ColorSpace', 'Closed Choice of Integer', 1),
+ ('Xmp.exif.ColorSpace', int, 1),
('Xmp.exif.DateTimeOriginal',
- 'Date',
+ datetime.datetime,
datetime.datetime(2002, 7, 13, 15, 58, 28, tzinfo=pyexiv2.utils.FixedOffset())),
- ('Xmp.exif.ExifVersion', 'Closed Choice of Text', u'0200'),
+ ('Xmp.exif.ExifVersion', unicode, u'0200'),
('Xmp.exif.ExposureBiasValue',
- 'Rational',
+ pyexiv2.utils.Rational,
pyexiv2.utils.Rational(-13, 20)),
- ('Xmp.exif.ExposureProgram', 'Closed Choice of Integer', 4),
+ ('Xmp.exif.ExposureProgram', int, 4),
('Xmp.exif.FNumber',
- 'Rational',
+ pyexiv2.utils.Rational,
pyexiv2.utils.Rational(3, 5)),
- ('Xmp.exif.FileSource', 'Closed Choice of Integer', 0),
- ('Xmp.exif.FlashpixVersion', 'Closed Choice of Text', u'0100'),
+ ('Xmp.exif.FileSource', int, 0),
+ ('Xmp.exif.FlashpixVersion', unicode, u'0100'),
('Xmp.exif.FocalLength',
- 'Rational',
+ pyexiv2.utils.Rational,
pyexiv2.utils.Rational(0, 1)),
- ('Xmp.exif.FocalPlaneResolutionUnit', 'Closed Choice of Integer', 2),
+ ('Xmp.exif.FocalPlaneResolutionUnit', int, 2),
('Xmp.exif.FocalPlaneXResolution',
- 'Rational',
+ pyexiv2.utils.Rational,
pyexiv2.utils.Rational(3085, 256)),
('Xmp.exif.FocalPlaneYResolution',
- 'Rational',
+ pyexiv2.utils.Rational,
pyexiv2.utils.Rational(3085, 256)),
('Xmp.exif.GPSLatitude',
- 'GPSCoordinate',
+ pyexiv2.utils.GPSCoordinate,
pyexiv2.utils.GPSCoordinate.from_string('54,59.380000N')),
('Xmp.exif.GPSLongitude',
- 'GPSCoordinate',
+ pyexiv2.utils.GPSCoordinate,
pyexiv2.utils.GPSCoordinate.from_string('1,54.850000W')),
- ('Xmp.exif.GPSMapDatum', 'Text', u'WGS84'),
+ ('Xmp.exif.GPSMapDatum', unicode, u'WGS84'),
('Xmp.exif.GPSTimeStamp',
- 'Date',
+ datetime.datetime,
datetime.datetime(2002, 7, 13, 14, 58, 24, tzinfo=pyexiv2.utils.FixedOffset())),
- ('Xmp.exif.GPSVersionID', 'Text', u'2.0.0.0'),
- ('Xmp.exif.ISOSpeedRatings', 'seq Integer', [0]),
- ('Xmp.exif.MeteringMode', 'Closed Choice of Integer', 5),
- ('Xmp.exif.PixelXDimension', 'Integer', 2400),
- ('Xmp.exif.PixelYDimension', 'Integer', 1600),
- ('Xmp.exif.SceneType', 'Closed Choice of Integer', 0),
- ('Xmp.exif.SensingMethod', 'Closed Choice of Integer', 2),
+ ('Xmp.exif.GPSVersionID', unicode, u'2.0.0.0'),
+ ('Xmp.exif.ISOSpeedRatings', list, [0]),
+ ('Xmp.exif.MeteringMode', int, 5),
+ ('Xmp.exif.PixelXDimension', int, 2400),
+ ('Xmp.exif.PixelYDimension', int, 1600),
+ ('Xmp.exif.SceneType', int, 0),
+ ('Xmp.exif.SensingMethod', int, 2),
('Xmp.exif.ShutterSpeedValue',
- 'Rational',
+ pyexiv2.utils.Rational,
pyexiv2.utils.Rational(30827, 3245)),
- ('Xmp.pdf.Keywords', 'Text', u'Communications'),
- ('Xmp.photoshop.AuthorsPosition', 'Text', u'Photographer'),
- ('Xmp.photoshop.CaptionWriter', 'ProperName', u'Ian Britton'),
- ('Xmp.photoshop.Category', 'Text', u'BUS'),
- ('Xmp.photoshop.City', 'Text', u' '),
- ('Xmp.photoshop.Country', 'Text', u'Ubited Kingdom'),
- ('Xmp.photoshop.Credit', 'Text', u'Ian Britton'),
- ('Xmp.photoshop.DateCreated', 'Date', datetime.date(2002, 6, 20)),
- ('Xmp.photoshop.Headline', 'Text', u'Communications'),
- ('Xmp.photoshop.State', 'Text', u' '),
- ('Xmp.photoshop.SupplementalCategories', 'bag Text', [u'Communications']),
- ('Xmp.photoshop.Urgency', 'Integer', 5),
- ('Xmp.tiff.Artist', 'ProperName', u'Ian Britton'),
- ('Xmp.tiff.BitsPerSample', 'seq Integer', [8]),
- ('Xmp.tiff.Compression', 'Closed Choice of Integer', 6),
+ ('Xmp.pdf.Keywords', unicode, u'Communications'),
+ ('Xmp.photoshop.AuthorsPosition', unicode, u'Photographer'),
+ ('Xmp.photoshop.CaptionWriter', unicode, u'Ian Britton'),
+ ('Xmp.photoshop.Category', unicode, u'BUS'),
+ ('Xmp.photoshop.City', unicode, u' '),
+ ('Xmp.photoshop.Country', unicode, u'Ubited Kingdom'),
+ ('Xmp.photoshop.Credit', unicode, u'Ian Britton'),
+ ('Xmp.photoshop.DateCreated', datetime.date, datetime.date(2002, 6, 20)),
+ ('Xmp.photoshop.Headline', unicode, u'Communications'),
+ ('Xmp.photoshop.State', unicode, u' '),
+ ('Xmp.photoshop.SupplementalCategories', list, [u'Communications']),
+ ('Xmp.photoshop.Urgency', int, 5),
+ ('Xmp.tiff.Artist', unicode, u'Ian Britton'),
+ ('Xmp.tiff.BitsPerSample', list, [8]),
+ ('Xmp.tiff.Compression', int, 6),
('Xmp.tiff.Copyright',
- 'Lang Alt',
+ dict,
{u'x-default': u'ian Britton - FreeFoto.com'}),
- ('Xmp.tiff.ImageDescription', 'Lang Alt', {u'x-default': u'Communications'}),
- ('Xmp.tiff.ImageLength', 'Integer', 400),
- ('Xmp.tiff.ImageWidth', 'Integer', 600),
- ('Xmp.tiff.Make', 'ProperName', u'FUJIFILM'),
- ('Xmp.tiff.Model', 'ProperName', u'FinePixS1Pro'),
- ('Xmp.tiff.Orientation', 'Closed Choice of Integer', 1),
- ('Xmp.tiff.ResolutionUnit', 'Closed Choice of Integer', 2),
- ('Xmp.tiff.Software', 'AgentName', u'Adobe Photoshop 7.0'),
+ ('Xmp.tiff.ImageDescription', dict, {u'x-default': u'Communications'}),
+ ('Xmp.tiff.ImageLength', int, 400),
+ ('Xmp.tiff.ImageWidth', int, 600),
+ ('Xmp.tiff.Make', unicode, u'FUJIFILM'),
+ ('Xmp.tiff.Model', unicode, u'FinePixS1Pro'),
+ ('Xmp.tiff.Orientation', int, 1),
+ ('Xmp.tiff.ResolutionUnit', int, 2),
+ ('Xmp.tiff.Software', unicode, u'Adobe Photoshop 7.0'),
('Xmp.tiff.XResolution',
- 'Rational',
+ pyexiv2.utils.Rational,
pyexiv2.utils.Rational(300, 1)),
- ('Xmp.tiff.YCbCrPositioning', 'Closed Choice of Integer', 2),
+ ('Xmp.tiff.YCbCrPositioning', int, 2),
('Xmp.tiff.YResolution',
- 'Rational',
+ pyexiv2.utils.Rational,
pyexiv2.utils.Rational(300, 1)),
('Xmp.xmp.CreateDate',
- 'Date',
+ datetime.datetime,
datetime.datetime(2002, 7, 13, 15, 58, 28, tzinfo=pyexiv2.utils.FixedOffset())),
('Xmp.xmp.ModifyDate',
- 'Date',
+ datetime.datetime,
datetime.datetime(2002, 7, 19, 13, 28, 10, tzinfo=pyexiv2.utils.FixedOffset())),
- ('Xmp.xmpBJ.JobRef', 'bag Job', []),
- ('Xmp.xmpBJ.JobRef[1]', '', ''),
- ('Xmp.xmpBJ.JobRef[1]/stJob:name', '', 'Photographer'),
+ ('Xmp.xmpBJ.JobRef', list, []),
+ ('Xmp.xmpBJ.JobRef[1]', str, ''),
+ ('Xmp.xmpBJ.JobRef[1]/stJob:name', str, 'Photographer'),
('Xmp.xmpMM.DocumentID',
- 'URI',
+ str,
'adobe:docid:photoshop:84d4dba8-9b11-11d6-895d-c4d063a70fb0'),
- ('Xmp.xmpRights.Marked', 'Boolean', True),
- ('Xmp.xmpRights.WebStatement', 'URL', 'www.freefoto.com')]
+ ('Xmp.xmpRights.Marked', bool, True),
+ ('Xmp.xmpRights.WebStatement', str, 'www.freefoto.com')]
for key, xtype, value in xmpTags:
tag = image[key]
- self.assertEqual(tag.type, xtype)
+ self.assertEqual(type(tag.value), xtype)
self.assertEqual(tag.value, value)