diff options
author | Thomas Vander Stichele <thomas (at) apestaart (dot) org> | 2009-06-01 19:08:47 +0200 |
---|---|---|
committer | Thomas Vander Stichele <thomas (at) apestaart (dot) org> | 2009-06-01 19:08:47 +0200 |
commit | 88f3323bfe15ae6aee762ba64588980b6036d4ea (patch) | |
tree | d9c8a06650aa3db02d9615429bc44f59271397fb /testsuite | |
parent | eb3701dfe57d57b8e5dc7b2c7aa6ce189d02d2be (diff) |
Convert unicode objects to utf-8 encoded G_STRINGs
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/test_struct.py | 4 | ||||
-rw-r--r-- | testsuite/test_taglist.py | 22 |
2 files changed, 24 insertions, 2 deletions
diff --git a/testsuite/test_struct.py b/testsuite/test_struct.py index d86339d..5ab75d3 100644 --- a/testsuite/test_struct.py +++ b/testsuite/test_struct.py @@ -44,11 +44,11 @@ class StructureTest(TestCase): def testString(self): assert self.struct.has_key('foo') - assert isinstance(self.struct['foo'], str) + assert isinstance(self.struct['foo'], unicode) assert self.struct['foo'] == 'bar', self.struct['foo'] self.struct['foo'] = 'baz' assert self.struct.has_key('foo') - assert isinstance(self.struct['foo'], str) + assert isinstance(self.struct['foo'], unicode) assert self.struct['foo'] == 'baz', self.struct['foo'] def testBoolean(self): diff --git a/testsuite/test_taglist.py b/testsuite/test_taglist.py index c9c0a41..227a812 100644 --- a/testsuite/test_taglist.py +++ b/testsuite/test_taglist.py @@ -43,3 +43,25 @@ class TestTagList(TestCase): keys = taglist.keys() keys.sort() self.assertEqual(keys, ['key1', 'key2']) + + def testUnicode(self): + taglist = gst.TagList() + + # normal ASCII text + taglist[gst.TAG_ARTIST] = 'Artist' + self.failUnless(isinstance(taglist[gst.TAG_ARTIST], unicode)) + self.assertEquals(taglist[gst.TAG_ARTIST], u'Artist') + self.assertEquals(taglist[gst.TAG_ARTIST], 'Artist') + + # normal ASCII text as unicode + taglist[gst.TAG_ARTIST] = u'Artist' + self.failUnless(isinstance(taglist[gst.TAG_ARTIST], unicode)) + self.assertEquals(taglist[gst.TAG_ARTIST], u'Artist') + self.assertEquals(taglist[gst.TAG_ARTIST], 'Artist') + + # real unicode + taglist[gst.TAG_ARTIST] = u'S\xc3\xadgur R\xc3\xb3s' + self.failUnless(isinstance(taglist[gst.TAG_ARTIST], unicode)) + self.assertEquals(taglist[gst.TAG_ARTIST], u'S\xc3\xadgur R\xc3\xb3s') + + |