From 637a1347ad540ca74c627620fdabf6dad0369d9c Mon Sep 17 00:00:00 2001 From: nicholas Date: Tue, 7 Aug 2007 22:48:06 +0000 Subject: Try to deal with typestamps in a sane way in the Python bindings git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1672 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- bindings/python/tests/tests.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'bindings/python/tests/tests.py') diff --git a/bindings/python/tests/tests.py b/bindings/python/tests/tests.py index 09c89bf..f52015e 100644 --- a/bindings/python/tests/tests.py +++ b/bindings/python/tests/tests.py @@ -2,6 +2,8 @@ import unittest import shutil import tempfile import os +import datetime +import time import types gpod = __import__('__init__') @@ -63,6 +65,21 @@ class TestiPodFunctions(unittest.TestCase): self.db.remove(track, ipod=True) self.failIf(os.path.exists(track_file)) + def testDatestampSetting(self): + trackname = os.path.join(self.mp, + 'iPod_Control', + 'tiny.mp3') + t = self.db.new_Track(filename=trackname) + date = datetime.datetime.now() + t['time_added'] = date + self.assertEqual(date.year, t['time_added'].year) + self.assertEqual(date.second, t['time_added'].second) + # microsecond won't match, that's lost in the itdb + date = datetime.datetime.now() + t['time_added'] = time.mktime(date.timetuple()) + self.assertEqual(date.year, t['time_added'].year) + self.assertEqual(date.second, t['time_added'].second) + def testVersion(self): self.assertEqual(type(gpod.version_info), types.TupleType) -- cgit