[pygobject] Quote argument names in initializer deprecation warning
- From: Simon Feltman <sfeltman src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Quote argument names in initializer deprecation warning
- Date: Sun, 16 Mar 2014 02:54:40 +0000 (UTC)
commit 2d268ef661badabcb63e696dab01857d57cb3371
Author: Simon Feltman <sfeltman src gnome org>
Date: Sat Mar 15 00:49:00 2014 -0700
Quote argument names in initializer deprecation warning
Add quotation marks around names of deprecated positional arguments.
This makes the message clearer in stating what has been deprecated
in cases when only a single argument is displayed.
gi/overrides/__init__.py | 2 +-
tests/test_gi.py | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gi/overrides/__init__.py b/gi/overrides/__init__.py
index 2cd1345..85c4970 100644
--- a/gi/overrides/__init__.py
+++ b/gi/overrides/__init__.py
@@ -134,7 +134,7 @@ def deprecated_init(super_init_func, arg_names, ignore=tuple(),
# Print warnings for calls with positional arguments.
if args:
warnings.warn('Using positional arguments with the GObject constructor has been deprecated. '
- 'Please specify keywords for %s or use a class specific constructor. '
+ 'Please specify keyword(s) for "%s" or use a class specific constructor. '
'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations' %
', '.join(arg_names[:len(args)]),
category, stacklevel=stacklevel)
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 2a6cc3d..5f6e481 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -3037,7 +3037,7 @@ class TestDeprecation(unittest.TestCase):
self.assertEqual(len(warn), 1)
self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning))
self.assertRegexpMatches(str(warn[0].message),
- '.*keywords.*a, b, c.*')
+ '.*keyword.*a, b, c.*')
def test_deprecated_init_no_keywords_out_of_order(self):
def init(self, **kwargs):
@@ -3050,7 +3050,7 @@ class TestDeprecation(unittest.TestCase):
self.assertEqual(len(warn), 1)
self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning))
self.assertRegexpMatches(str(warn[0].message),
- '.*keywords.*b, a, c.*')
+ '.*keyword.*b, a, c.*')
def test_deprecated_init_ignored_keyword(self):
def init(self, **kwargs):
@@ -3065,7 +3065,7 @@ class TestDeprecation(unittest.TestCase):
self.assertEqual(len(warn), 1)
self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning))
self.assertRegexpMatches(str(warn[0].message),
- '.*keywords.*a, b, c.*')
+ '.*keyword.*a, b, c.*')
def test_deprecated_init_with_aliases(self):
def init(self, **kwargs):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]