From cfadc5fc4d267db9e9455ce0e9fdec40ea894aa8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 22 Aug 2023 12:53:46 +0530 Subject: [PATCH] ... --- src/calibre/db/tests/legacy.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/calibre/db/tests/legacy.py b/src/calibre/db/tests/legacy.py index 8526003079..82ba8b76ac 100644 --- a/src/calibre/db/tests/legacy.py +++ b/src/calibre/db/tests/legacy.py @@ -4,15 +4,18 @@ __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal ' -import inspect, time, numbers -from io import BytesIO +import inspect +import numbers +import time from functools import partial +from io import BytesIO from operator import itemgetter -from calibre.library.field_metadata import fm_as_dict +from calibre.db.constants import NOTES_DIR_NAME from calibre.db.tests.base import BaseTest -from polyglot.builtins import iteritems +from calibre.library.field_metadata import fm_as_dict from polyglot import reprlib +from polyglot.builtins import iteritems # Utils {{{ @@ -184,8 +187,9 @@ class LegacyTest(BaseTest): def test_legacy_direct(self): # {{{ 'Test read-only methods that are directly equivalent in the old and new interface' - from calibre.ebooks.metadata.book.base import Metadata from datetime import timedelta + + from calibre.ebooks.metadata.book.base import Metadata ndb = self.init_legacy(self.cloned_library) db = self.init_old() newstag = ndb.new_api.get_item_id('tags', 'news') @@ -274,8 +278,8 @@ class LegacyTest(BaseTest): def f(x, y): # get_top_level_move_items is broken in the old db on case-insensitive file systems x.discard('metadata_db_prefs_backup.json') y.pop('full-text-search.db', None) - x.discard('.notes') - y.pop('.notes', None) + x.discard(NOTES_DIR_NAME) + y.pop(NOTES_DIR_NAME, None) return x, y self.assertEqual(f(*db.get_top_level_move_items()), f(*ndb.get_top_level_move_items())) d1, d2 = BytesIO(), BytesIO()