summaryrefslogtreecommitdiffstats
path: root/bindings/python/tests/tests.py
diff options
context:
space:
mode:
authornicholas <nicholas@f01d2545-417e-4e96-918e-98f8d0dbbcb6>2007-08-07 22:48:06 +0000
committernicholas <nicholas@f01d2545-417e-4e96-918e-98f8d0dbbcb6>2007-08-07 22:48:06 +0000
commit637a1347ad540ca74c627620fdabf6dad0369d9c (patch)
treeb5514079171346a5314ed80eb95e944b2f8f48c2 /bindings/python/tests/tests.py
parent59eb462ad886609680547e61ea0771e056758d53 (diff)
downloadlibgpod-637a1347ad540ca74c627620fdabf6dad0369d9c.tar.gz
libgpod-637a1347ad540ca74c627620fdabf6dad0369d9c.tar.xz
libgpod-637a1347ad540ca74c627620fdabf6dad0369d9c.zip
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
Diffstat (limited to 'bindings/python/tests/tests.py')
-rw-r--r--bindings/python/tests/tests.py17
1 files changed, 17 insertions, 0 deletions
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)