From f57f0b7be3f082d8b351236c018020f5f8d70b31 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Sat, 23 Aug 2008 18:02:42 +0000 Subject: Python: Be more consistent with other container objects and classes This enables testing whether a key exists in an object (e.g. "'title' in track") as well as iterating over a Track or Photo object's keys, values, or items. The items() and pairs() methods were renamed to values() and items(), respectively, in the Track and Photo classes. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@2110 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- bindings/python/tests/tests.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'bindings/python/tests') diff --git a/bindings/python/tests/tests.py b/bindings/python/tests/tests.py index 657e7f5..6ebb8ff 100644 --- a/bindings/python/tests/tests.py +++ b/bindings/python/tests/tests.py @@ -79,7 +79,12 @@ class TestiPodFunctions(unittest.TestCase): t['time_added'] = time.mktime(date.timetuple()) self.assertEqual(date.year, t['time_added'].year) self.assertEqual(date.second, t['time_added'].second) - + + def testTrackContainerMethods(self): + self.testAddTrack() + track = self.db[0] + self.failUnless('title' in track) + def testVersion(self): self.assertEqual(type(gpod.version_info), types.TupleType) @@ -182,5 +187,10 @@ class TestPhotoDatabase(unittest.TestCase): for album in self.db.PhotoAlbums: [photo for photo in album] + def testPhotoContainerMethods(self): + self.testAddPhoto() + photo = self.db[0] + self.failUnless('id' in photo) + if __name__ == '__main__': unittest.main() -- cgit