aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2011-08-17 18:27:35 +0200
committerOlivier Tilloy <olivier@tilloy.net>2011-08-17 18:27:35 +0200
commitfa8a2a497ed8bf62bd53ff6198da62346c50af08 (patch)
tree15036ee68e9870edccf6fe783b44e9baaf8c0c1d /test
parent8db919cfb2e31409116026d76a72e82f4f0824c1 (diff)
downloadpyexiv2-fa8a2a497ed8bf62bd53ff6198da62346c50af08.tar.gz
Add a unit test to check that using the dictionary interface with an incorrect tag family raises a KeyError as expected.
Diffstat (limited to 'test')
-rw-r--r--test/metadata.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/metadata.py b/test/metadata.py
index 177ec9d..a00d9fa 100644
--- a/test/metadata.py
+++ b/test/metadata.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.
#
@@ -564,6 +564,13 @@ class TestImageMetadata(unittest.TestCase):
for key in keys:
self.metadata[key] = self.metadata[key]
+ def test_nonexistent_tag_family(self):
+ self.metadata.read()
+ key = 'Bleh.Image.DateTime'
+ self.failUnlessRaises(KeyError, self.metadata.__getitem__, key)
+ self.failUnlessRaises(KeyError, self.metadata.__setitem__, key, datetime.date.today())
+ self.failUnlessRaises(KeyError, self.metadata.__delitem__, key)
+
##########################
# Test the image comment #
##########################