mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Legacy implementations of a few direct methods
This commit is contained in:
parent
3b438889a4
commit
e64ff83e07
@ -58,6 +58,9 @@ class LibraryDatabase(object):
|
|||||||
setattr(self, prop, partial(self.get_property,
|
setattr(self, prop, partial(self.get_property,
|
||||||
loc=self.FIELD_MAP[fm]))
|
loc=self.FIELD_MAP[fm]))
|
||||||
|
|
||||||
|
for meth in ('get_next_series_num_for', 'has_book', 'author_sort_from_authors'):
|
||||||
|
setattr(self, meth, getattr(self.new_api, meth))
|
||||||
|
|
||||||
self.last_update_check = self.last_modified()
|
self.last_update_check = self.last_modified()
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
|
@ -103,6 +103,22 @@ class LegacyTest(BaseTest):
|
|||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
def test_legacy_direct(self): # {{{
|
||||||
|
'Test methods that are directly equivalent in the old and new interface'
|
||||||
|
from calibre.ebooks.metadata.book.base import Metadata
|
||||||
|
ndb = self.init_legacy()
|
||||||
|
db = self.init_old()
|
||||||
|
for meth, args in {
|
||||||
|
'get_next_series_num_for': [('A Series One',)],
|
||||||
|
'author_sort_from_authors': [(['Author One', 'Author Two', 'Unknown'],)],
|
||||||
|
'has_book':[(Metadata('title one'),), (Metadata('xxxx1111'),)],
|
||||||
|
}.iteritems():
|
||||||
|
for a in args:
|
||||||
|
self.assertEqual(getattr(db, meth)(*a), getattr(ndb, meth)(*a),
|
||||||
|
'The method: %s() returned different results for argument %s' % (meth, a))
|
||||||
|
db.close()
|
||||||
|
# }}}
|
||||||
|
|
||||||
def test_legacy_coverage(self): # {{{
|
def test_legacy_coverage(self): # {{{
|
||||||
' Check that the emulation of the legacy interface is (almost) total '
|
' Check that the emulation of the legacy interface is (almost) total '
|
||||||
cl = self.cloned_library
|
cl = self.cloned_library
|
||||||
|
Loading…
x
Reference in New Issue
Block a user