From 0c2b5e5b3284f01b2485e856abe3832f87b1e4c4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 30 Sep 2020 13:38:31 +0530 Subject: [PATCH] Add tests for ResourceReader implementation --- src/calibre/test_build.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py index fd794713b8..34412c54c3 100644 --- a/src/calibre/test_build.py +++ b/src/calibre/test_build.py @@ -43,6 +43,16 @@ class BuildTest(unittest.TestCase): 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')])