mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add a test for FTS indexing of archives
This commit is contained in:
parent
9bbff10bfc
commit
ad707ad4af
@ -193,7 +193,7 @@ class FTSTest(BaseTest):
|
||||
|
||||
# }}}
|
||||
|
||||
def test_pdftotext(self):
|
||||
def test_fts_indexing(self):
|
||||
pdf_data = '''\
|
||||
%PDF-1.1
|
||||
%¥±ë
|
||||
@ -257,8 +257,13 @@ startxref
|
||||
pdf = os.path.join(tdir, 'test.pdf')
|
||||
with open(pdf, 'w') as f:
|
||||
f.write(pdf_data)
|
||||
from calibre.db.fts.text import pdftotext
|
||||
self.assertEqual(pdftotext(pdf).strip(), 'Hello World')
|
||||
from calibre.db.fts.text import extract_text
|
||||
self.assertEqual(extract_text(pdf).strip(), 'Hello World')
|
||||
from zipfile import ZipFile
|
||||
zip = os.path.join(tdir, 'test.zip')
|
||||
with ZipFile(zip, 'w') as zf:
|
||||
zf.writestr('text.pdf', pdf_data)
|
||||
self.assertEqual(extract_text(zip).strip(), 'Hello World')
|
||||
|
||||
|
||||
def find_tests():
|
||||
|
Loading…
x
Reference in New Issue
Block a user