From f6d8f9aa816daff09a08a04ccf308bb60dceec06 Mon Sep 17 00:00:00 2001 From: Wolfgang Fahl Date: Thu, 24 Oct 2024 09:27:39 +0200 Subject: [PATCH] fixes regression --- tests/test_non_smw.py | 4 ++-- wikibot3rd/wikipush.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_non_smw.py b/tests/test_non_smw.py index f21025e..0c2edf8 100644 --- a/tests/test_non_smw.py +++ b/tests/test_non_smw.py @@ -38,7 +38,7 @@ def test_category_query(self): Example: https://wiki.genealogy.net/Kategorie:Adressbuch_in_der_Online-Erfassung/fertig """ debug=self.debug - debug=True + #debug=True wikipush = WikiPush(self.wiki_id, None, debug=self.debug) wikipush.fromWiki = self.wiki_client @@ -62,7 +62,7 @@ def test_category_query(self): for i,page_title in enumerate(pages,start=1): if i<=debug_pages: print(f"{i:3}:{page_title}") - self.assertTrue(len(pages) >= expected_pages) + self.assertGreaterEqual(len(pages),expected_pages) if __name__ == "__main__": diff --git a/wikibot3rd/wikipush.py b/wikibot3rd/wikipush.py index 12c1300..91dfaad 100644 --- a/wikibot3rd/wikipush.py +++ b/wikibot3rd/wikipush.py @@ -184,6 +184,9 @@ def queryPages( """ if wiki is None: wiki = self.fromWiki + # no wiki no pages e.g. if wikirestore is used without a -s option + if wiki is None: + pageRecords=[] if wiki.is_smw_enabled: smwClient = SMWClient( @@ -268,9 +271,6 @@ def query( Returns: list: a list of pageTitles matching the given askQuery """ - # no wiki no pages e.g. if wikirestore is used without a -s option - if wiki is None: - return [] pageRecords = self.queryPages( askQuery, wiki, limit, showProgress, queryDivision )