~ubuntu-branches/ubuntu/precise/gst0.10-python/precise

« back to all changes in this revision

Viewing changes to testsuite/test_taglist.py

Tags: upstream-0.10.8
Import upstream version 0.10.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- Mode: Python -*-
 
2
# vi:si:et:sw=4:sts=4:ts=4
 
3
#
 
4
# gst-python - Python bindings for GStreamer
 
5
# Copyright (C) 2007 Johan Dahlin
 
6
#
 
7
# This library is free software; you can redistribute it and/or
 
8
# modify it under the terms of the GNU Lesser General Public
 
9
# License as published by the Free Software Foundation; either
 
10
# version 2.1 of the License, or (at your option) any later version.
 
11
#
 
12
# This library is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
# Lesser General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU Lesser General Public
 
18
# License along with this library; if not, write to the Free Software
 
19
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
20
 
 
21
from common import gst, TestCase
 
22
 
 
23
 
 
24
class TestTagList(TestCase):
 
25
    def testContains(self):
 
26
        taglist = gst.TagList()
 
27
        self.failIf('key' in taglist)
 
28
        taglist['key'] = 'value'
 
29
        self.failUnless('key' in taglist)
 
30
 
 
31
    def testLength(self):
 
32
        taglist = gst.TagList()
 
33
        self.assertEqual(len(taglist), 0)
 
34
        taglist['key1'] = 'value'
 
35
        taglist['key2'] = 'value'
 
36
        self.assertEqual(len(taglist), 2)
 
37
 
 
38
    def testKeys(self):
 
39
        taglist = gst.TagList()
 
40
        self.assertEqual(taglist.keys(), [])
 
41
        taglist['key1'] = 'value'
 
42
        taglist['key2'] = 'value'
 
43
        keys = taglist.keys()
 
44
        keys.sort()
 
45
        self.assertEqual(keys, ['key1', 'key2'])