mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-22 13:23:53 +02:00
Add tests for ResourceReader implementation
This commit is contained in:
parent
ccdfbe96d5
commit
0c2b5e5b32
1 changed files with 10 additions and 0 deletions
|
|
@ -43,6 +43,16 @@ def test_dbus(self):
|
|||
self.assertTrue(bus.list_names(), 'Failed to list names on the session bus')
|
||||
del bus
|
||||
|
||||
def test_loaders(self):
|
||||
import importlib
|
||||
ldr = importlib.import_module('calibre').__spec__.loader
|
||||
self.assertIn('ebooks', ldr.contents())
|
||||
try:
|
||||
raw = ldr.open_resource('__init__.py').read()
|
||||
except FileNotFoundError:
|
||||
raw = ldr.open_resource('__init__.pyc').read()
|
||||
self.assertGreater(len(raw), 1024)
|
||||
|
||||
def test_regex(self):
|
||||
import regex
|
||||
self.assertEqual(regex.findall(r'(?i)(a)(b)', 'ab cd AB 1a1b'), [('a', 'b'), ('A', 'B')])
|
||||
|
|
|
|||
Loading…
Reference in a new issue