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):
|
def read_maps(self, db):
|
||||||
for row in db.conn.execute(
|
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)):
|
self.metadata['link_column'], self.link_table)):
|
||||||
if row[1] not in self.col_book_map:
|
if row[1] not in self.col_book_map:
|
||||||
self.col_book_map[row[1]] = []
|
self.col_book_map[row[1]] = []
|
||||||
|
@ -10,7 +10,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
import shutil, unittest, tempfile, datetime
|
import shutil, unittest, tempfile, datetime
|
||||||
from cStringIO import StringIO
|
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
|
from calibre.db.tests.base import BaseTest
|
||||||
|
|
||||||
class ReadingTest(BaseTest):
|
class ReadingTest(BaseTest):
|
||||||
@ -37,12 +37,12 @@ class ReadingTest(BaseTest):
|
|||||||
'tags': (),
|
'tags': (),
|
||||||
'formats':(),
|
'formats':(),
|
||||||
'identifiers': {},
|
'identifiers': {},
|
||||||
'timestamp': datetime.datetime(2011, 9, 7, 13, 54, 41,
|
'timestamp': datetime.datetime(2011, 9, 7, 19, 54, 41,
|
||||||
tzinfo=local_tz),
|
tzinfo=utc_tz),
|
||||||
'pubdate': datetime.datetime(2011, 9, 7, 13, 54, 41,
|
'pubdate': datetime.datetime(2011, 9, 7, 19, 54, 41,
|
||||||
tzinfo=local_tz),
|
tzinfo=utc_tz),
|
||||||
'last_modified': datetime.datetime(2011, 9, 7, 13, 54, 41,
|
'last_modified': datetime.datetime(2011, 9, 7, 19, 54, 41,
|
||||||
tzinfo=local_tz),
|
tzinfo=utc_tz),
|
||||||
'publisher': None,
|
'publisher': None,
|
||||||
'languages': (),
|
'languages': (),
|
||||||
'comments': None,
|
'comments': None,
|
||||||
@ -69,17 +69,17 @@ class ReadingTest(BaseTest):
|
|||||||
'formats': (),
|
'formats': (),
|
||||||
'rating': 4.0,
|
'rating': 4.0,
|
||||||
'identifiers': {'test':'one'},
|
'identifiers': {'test':'one'},
|
||||||
'timestamp': datetime.datetime(2011, 9, 5, 15, 6,
|
'timestamp': datetime.datetime(2011, 9, 5, 21, 6,
|
||||||
tzinfo=local_tz),
|
tzinfo=utc_tz),
|
||||||
'pubdate': datetime.datetime(2011, 9, 5, 15, 6,
|
'pubdate': datetime.datetime(2011, 9, 5, 21, 6,
|
||||||
tzinfo=local_tz),
|
tzinfo=utc_tz),
|
||||||
'publisher': 'Publisher One',
|
'publisher': 'Publisher One',
|
||||||
'languages': ('eng',),
|
'languages': ('eng',),
|
||||||
'comments': '<p>Comments One</p>',
|
'comments': '<p>Comments One</p>',
|
||||||
'#enum':'One',
|
'#enum':'One',
|
||||||
'#authors':('Custom One', 'Custom Two'),
|
'#authors':('Custom One', 'Custom Two'),
|
||||||
'#date':datetime.datetime(2011, 9, 5, 0, 0,
|
'#date':datetime.datetime(2011, 9, 5, 6, 0,
|
||||||
tzinfo=local_tz),
|
tzinfo=utc_tz),
|
||||||
'#rating':2.0,
|
'#rating':2.0,
|
||||||
'#series':'My Series One',
|
'#series':'My Series One',
|
||||||
'#series_index': 1.0,
|
'#series_index': 1.0,
|
||||||
@ -98,17 +98,17 @@ class ReadingTest(BaseTest):
|
|||||||
'tags': ('Tag One',),
|
'tags': ('Tag One',),
|
||||||
'formats':(),
|
'formats':(),
|
||||||
'identifiers': {'test':'two'},
|
'identifiers': {'test':'two'},
|
||||||
'timestamp': datetime.datetime(2011, 9, 6, 0, 0,
|
'timestamp': datetime.datetime(2011, 9, 6, 6, 0,
|
||||||
tzinfo=local_tz),
|
tzinfo=utc_tz),
|
||||||
'pubdate': datetime.datetime(2011, 8, 5, 0, 0,
|
'pubdate': datetime.datetime(2011, 8, 5, 6, 0,
|
||||||
tzinfo=local_tz),
|
tzinfo=utc_tz),
|
||||||
'publisher': 'Publisher Two',
|
'publisher': 'Publisher Two',
|
||||||
'languages': ('deu',),
|
'languages': ('deu',),
|
||||||
'comments': '<p>Comments Two</p>',
|
'comments': '<p>Comments Two</p>',
|
||||||
'#enum':'Two',
|
'#enum':'Two',
|
||||||
'#authors':('My Author Two',),
|
'#authors':('My Author Two',),
|
||||||
'#date':datetime.datetime(2011, 9, 1, 0, 0,
|
'#date':datetime.datetime(2011, 9, 1, 6, 0,
|
||||||
tzinfo=local_tz),
|
tzinfo=utc_tz),
|
||||||
'#rating':4.0,
|
'#rating':4.0,
|
||||||
'#series':'My Series Two',
|
'#series':'My Series Two',
|
||||||
'#series_index': 3.0,
|
'#series_index': 3.0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user