mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix datetime tests and read many-many fields in id order
This commit is contained in:
parent
f0518e3336
commit
8402205d11
@ -151,7 +151,7 @@ class ManyToManyTable(ManyToOneTable):
|
||||
|
||||
def read_maps(self, db):
|
||||
for row in db.conn.execute(
|
||||
'SELECT book, {0} FROM {1}'.format(
|
||||
'SELECT book, {0} FROM {1} ORDER BY id'.format(
|
||||
self.metadata['link_column'], self.link_table)):
|
||||
if row[1] not in self.col_book_map:
|
||||
self.col_book_map[row[1]] = []
|
||||
|
@ -10,7 +10,7 @@ __docformat__ = 'restructuredtext en'
|
||||
import shutil, unittest, tempfile, datetime
|
||||
from cStringIO import StringIO
|
||||
|
||||
from calibre.utils.date import local_tz
|
||||
from calibre.utils.date import utc_tz
|
||||
from calibre.db.tests.base import BaseTest
|
||||
|
||||
class ReadingTest(BaseTest):
|
||||
@ -37,12 +37,12 @@ class ReadingTest(BaseTest):
|
||||
'tags': (),
|
||||
'formats':(),
|
||||
'identifiers': {},
|
||||
'timestamp': datetime.datetime(2011, 9, 7, 13, 54, 41,
|
||||
tzinfo=local_tz),
|
||||
'pubdate': datetime.datetime(2011, 9, 7, 13, 54, 41,
|
||||
tzinfo=local_tz),
|
||||
'last_modified': datetime.datetime(2011, 9, 7, 13, 54, 41,
|
||||
tzinfo=local_tz),
|
||||
'timestamp': datetime.datetime(2011, 9, 7, 19, 54, 41,
|
||||
tzinfo=utc_tz),
|
||||
'pubdate': datetime.datetime(2011, 9, 7, 19, 54, 41,
|
||||
tzinfo=utc_tz),
|
||||
'last_modified': datetime.datetime(2011, 9, 7, 19, 54, 41,
|
||||
tzinfo=utc_tz),
|
||||
'publisher': None,
|
||||
'languages': (),
|
||||
'comments': None,
|
||||
@ -69,17 +69,17 @@ class ReadingTest(BaseTest):
|
||||
'formats': (),
|
||||
'rating': 4.0,
|
||||
'identifiers': {'test':'one'},
|
||||
'timestamp': datetime.datetime(2011, 9, 5, 15, 6,
|
||||
tzinfo=local_tz),
|
||||
'pubdate': datetime.datetime(2011, 9, 5, 15, 6,
|
||||
tzinfo=local_tz),
|
||||
'timestamp': datetime.datetime(2011, 9, 5, 21, 6,
|
||||
tzinfo=utc_tz),
|
||||
'pubdate': datetime.datetime(2011, 9, 5, 21, 6,
|
||||
tzinfo=utc_tz),
|
||||
'publisher': 'Publisher One',
|
||||
'languages': ('eng',),
|
||||
'comments': '<p>Comments One</p>',
|
||||
'#enum':'One',
|
||||
'#authors':('Custom One', 'Custom Two'),
|
||||
'#date':datetime.datetime(2011, 9, 5, 0, 0,
|
||||
tzinfo=local_tz),
|
||||
'#date':datetime.datetime(2011, 9, 5, 6, 0,
|
||||
tzinfo=utc_tz),
|
||||
'#rating':2.0,
|
||||
'#series':'My Series One',
|
||||
'#series_index': 1.0,
|
||||
@ -98,17 +98,17 @@ class ReadingTest(BaseTest):
|
||||
'tags': ('Tag One',),
|
||||
'formats':(),
|
||||
'identifiers': {'test':'two'},
|
||||
'timestamp': datetime.datetime(2011, 9, 6, 0, 0,
|
||||
tzinfo=local_tz),
|
||||
'pubdate': datetime.datetime(2011, 8, 5, 0, 0,
|
||||
tzinfo=local_tz),
|
||||
'timestamp': datetime.datetime(2011, 9, 6, 6, 0,
|
||||
tzinfo=utc_tz),
|
||||
'pubdate': datetime.datetime(2011, 8, 5, 6, 0,
|
||||
tzinfo=utc_tz),
|
||||
'publisher': 'Publisher Two',
|
||||
'languages': ('deu',),
|
||||
'comments': '<p>Comments Two</p>',
|
||||
'#enum':'Two',
|
||||
'#authors':('My Author Two',),
|
||||
'#date':datetime.datetime(2011, 9, 1, 0, 0,
|
||||
tzinfo=local_tz),
|
||||
'#date':datetime.datetime(2011, 9, 1, 6, 0,
|
||||
tzinfo=utc_tz),
|
||||
'#rating':4.0,
|
||||
'#series':'My Series Two',
|
||||
'#series_index': 3.0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user