From 6cb7e04dbde3309e575223ec5dc09cc85e61ff11 Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Tue, 24 Feb 2009 09:37:53 +0100 Subject: IPTC String conversion. --- unittest/iptc.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'unittest') diff --git a/unittest/iptc.py b/unittest/iptc.py index 4ed0dc3..035b435 100644 --- a/unittest/iptc.py +++ b/unittest/iptc.py @@ -42,4 +42,13 @@ class TestIptcTag(unittest.TestCase): self.failUnlessRaises(IptcValueError, IptcTag._convert_to_python, '47.0001', xtype) self.failUnlessRaises(IptcValueError, IptcTag._convert_to_python, '1E3', xtype) + def test_convert_to_python_string(self): + xtype = 'String' + # Valid values + self.assertEqual(IptcTag._convert_to_python('Some text.', xtype), u'Some text.') + self.assertEqual(IptcTag._convert_to_python('Some text with exotic chàräctérʐ.', xtype), + u'Some text with exotic chàräctérʐ.') + # Invalid values + self.failUnlessRaises(IptcValueError, IptcTag._convert_to_python, None, xtype) + # TODO: other types -- cgit