jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/691589 )
Change subject: [bugfix] OutputOption.out must be a property not a method ......................................................................
[bugfix] OutputOption.out must be a property not a method
- Remove deprecation warning for SequenceOutputter.output(). This may be still usable as well as OutputOption.output() but must always call the "out" property. - Remove early parsing link introduced with f4ddd1f0 which leads script to fail. - Add a more informative string for InvalidTitleError - Update tests accordingly
Bug: T282936 Change-Id: I7cfd0b4ddeebba83ca1e72e7dd74e98c18fd2315 --- M pywikibot/bot_choice.py M pywikibot/page/__init__.py M pywikibot/tools/formatter.py M tests/link_tests.py 4 files changed, 5 insertions(+), 12 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/bot_choice.py b/pywikibot/bot_choice.py index 5672e1f..ba8518c 100755 --- a/pywikibot/bot_choice.py +++ b/pywikibot/bot_choice.py @@ -549,6 +549,7 @@
color = 'lightred'
+ @property def out(self): """Highlighted output section of the text.""" start = max(0, self.start - self.context) diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py index 53ff080..6ddfc9d 100644 --- a/pywikibot/page/__init__.py +++ b/pywikibot/page/__init__.py @@ -181,13 +181,6 @@ self._link = Link(title, source=source.site, default_namespace=ns) elif isinstance(source, BaseLink): - if not source.title: - raise InvalidTitleError( - '{} title of {} {} cannot be empty.' - .format(self.__class__.__name__, - source.__class__.__name__, - source.astext())) - self._link = source self._revisions = {} else: @@ -5374,7 +5367,8 @@ # with a fragment identifier. if not t.strip(' ') and not self._is_interwiki: # T197642 raise InvalidTitleError( - 'The link does not contain a page title') + 'The link [[{}]] does not contain a page title' + .format(self._text))
if self._site.namespaces[self._namespace].case == 'first-letter': t = first_upper(t) diff --git a/pywikibot/tools/formatter.py b/pywikibot/tools/formatter.py index d67d5ec..f629651 100644 --- a/pywikibot/tools/formatter.py +++ b/pywikibot/tools/formatter.py @@ -59,8 +59,6 @@ content = '' return self.prefix + content + self.suffix
- @deprecated('pywikibot.output(SequenceOutputter.out)', since='6.2.0', - future_warning=True) def output(self): """Output the text of the current sequence.""" output(self.out) diff --git a/tests/link_tests.py b/tests/link_tests.py index 14c586b..d94a6ed 100644 --- a/tests/link_tests.py +++ b/tests/link_tests.py @@ -139,7 +139,7 @@ title_tests = [ # Empty title (['', ':', '__ __', ' __ '], - r'^The link does not contain a page title$'), + r'^The link [[.*]] does not contain a page title$'),
(['A [ B', 'A ] B', 'A { B', 'A } B', 'A < B', 'A > B'], generate_contains_illegal_chars_exc_regex), @@ -893,7 +893,7 @@ link = Link('', self.get_site()) with self.assertRaisesRegex( InvalidTitleError, - 'The link does not contain a page title'): + r'The link [[.*]] does not contain a page title'): link.parse()
def test_namespace_lookalike(self):