mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
0f76bf19f8
commit
33072bf70e
@ -6,6 +6,7 @@ import os
|
|||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
|
from operator import itemgetter
|
||||||
|
|
||||||
from calibre.db.tests.base import BaseTest
|
from calibre.db.tests.base import BaseTest
|
||||||
from calibre.utils.resources import get_image_path
|
from calibre.utils.resources import get_image_path
|
||||||
@ -135,6 +136,7 @@ def test_cache_api(self: 'NotesTest'):
|
|||||||
note_id = cache.import_note('authors', author_id, f.name)
|
note_id = cache.import_note('authors', author_id, f.name)
|
||||||
self.assertGreater(note_id, 0)
|
self.assertGreater(note_id, 0)
|
||||||
self.assertIn('<p>test simple exim <img', cache.notes_for('authors', author_id))
|
self.assertIn('<p>test simple exim <img', cache.notes_for('authors', author_id))
|
||||||
|
res = tuple(cache.get_notes_resource(x) for x in cache.notes_resources_used_by('authors', author_id))
|
||||||
exported = cache.export_note('authors', author_id)
|
exported = cache.export_note('authors', author_id)
|
||||||
self.assertIn('<p>test simple exim <img src="', exported)
|
self.assertIn('<p>test simple exim <img src="', exported)
|
||||||
from html5_parser import parse
|
from html5_parser import parse
|
||||||
@ -147,10 +149,8 @@ def test_cache_api(self: 'NotesTest'):
|
|||||||
note_id = cache.import_note('authors', author_id, f.name)
|
note_id = cache.import_note('authors', author_id, f.name)
|
||||||
self.assertGreater(note_id, 0)
|
self.assertGreater(note_id, 0)
|
||||||
self.assertIn('<p>test simple exim <img', cache.notes_for('authors', author_id))
|
self.assertIn('<p>test simple exim <img', cache.notes_for('authors', author_id))
|
||||||
res = set()
|
res2 = tuple(cache.get_notes_resource(x) for x in cache.notes_resources_used_by('authors', author_id))
|
||||||
for x in cache.notes_resources_used_by('authors', author_id):
|
self.ae(sorted(res, key=itemgetter('name')), sorted(res2, key=itemgetter('name')))
|
||||||
res.add(cache.get_notes_resource(x)['name'])
|
|
||||||
self.ae(res, {'r 1.png', 'r 2.png'})
|
|
||||||
|
|
||||||
|
|
||||||
def test_fts(self: 'NotesTest'):
|
def test_fts(self: 'NotesTest'):
|
||||||
|
@ -16,8 +16,7 @@ from qt.core import (
|
|||||||
|
|
||||||
from calibre import fit_image, sanitize_file_name
|
from calibre import fit_image, sanitize_file_name
|
||||||
from calibre.constants import config_dir, iswindows
|
from calibre.constants import config_dir, iswindows
|
||||||
from calibre.db.constants import DATA_DIR_NAME, DATA_FILE_PATTERN
|
from calibre.db.constants import DATA_DIR_NAME, DATA_FILE_PATTERN, RESOURCE_URL_SCHEME
|
||||||
from calibre.db.notes.connect import RESOURCE_URL_SCHEME
|
|
||||||
from calibre.ebooks import BOOK_EXTENSIONS
|
from calibre.ebooks import BOOK_EXTENSIONS
|
||||||
from calibre.ebooks.metadata.book.base import Metadata, field_metadata
|
from calibre.ebooks.metadata.book.base import Metadata, field_metadata
|
||||||
from calibre.ebooks.metadata.book.render import mi_to_html
|
from calibre.ebooks.metadata.book.render import mi_to_html
|
||||||
|
@ -12,7 +12,7 @@ from qt.core import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from calibre import fit_image
|
from calibre import fit_image
|
||||||
from calibre.db.notes.connect import RESOURCE_URL_SCHEME
|
from calibre.db.constants import RESOURCE_URL_SCHEME
|
||||||
from calibre.gui2 import NO_URL_FORMATTING, gprefs
|
from calibre.gui2 import NO_URL_FORMATTING, gprefs
|
||||||
from calibre.gui2.book_details import (
|
from calibre.gui2.book_details import (
|
||||||
create_open_cover_with_menu, resolved_css, details_context_menu_event, render_html, set_html,
|
create_open_cover_with_menu, resolved_css, details_context_menu_event, render_html, set_html,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user