mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix the db formatter functions test
This commit is contained in:
parent
f0677655f8
commit
d86c664e69
@ -754,18 +754,9 @@ class ReadingTest(BaseTest):
|
||||
db = self.init_cache(self.library_path)
|
||||
db.create_custom_column('mult', 'CC1', 'composite', True, display={'composite_template': 'b,a,c'})
|
||||
|
||||
db = self.init_legacy(self.library_path)
|
||||
|
||||
class GetGuiAns():
|
||||
current_db = None
|
||||
get_gui_ans = GetGuiAns()
|
||||
get_gui_ans.current_db = db
|
||||
from calibre.gui2.ui import get_gui
|
||||
get_gui.ans = get_gui_ans
|
||||
|
||||
try:
|
||||
# need an empty metadata object to pass to the formatter
|
||||
mi = Metadata('A', 'B')
|
||||
db = self.init_legacy(self.library_path)
|
||||
mi = db.get_metadata(1)
|
||||
|
||||
# test counting books matching the search
|
||||
v = formatter.safe_format('program: book_count("series:true", 0)', {}, 'TEMPLATE ERROR', mi)
|
||||
@ -814,6 +805,4 @@ class ReadingTest(BaseTest):
|
||||
# test getting value of an int (rating)
|
||||
v = formatter.safe_format('program: book_values("rating", "title:true", ",", 0)', {}, 'TEMPLATE ERROR', mi)
|
||||
self.assertEqual(set(v.split(',')), {'4', '6'})
|
||||
finally:
|
||||
get_gui.ans = None
|
||||
# }}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user