diff options
author | Simon Feltman <sfeltman@src.gnome.org> | 2014-09-01 15:21:04 -0700 |
---|---|---|
committer | Simon Feltman <sfeltman@src.gnome.org> | 2014-09-01 17:05:09 -0700 |
commit | c1ea60be30ebf11c2e5415180305e4ac3c573f57 (patch) | |
tree | 227eb6b42788d2b4ba879cf118004b0ca2cd776e | |
parent | 1f78dc0ace5282def9f1f700bfe4523de07e7549 (diff) | |
download | pygobject-c1ea60be30ebf11c2e5415180305e4ac3c573f57.tar.gz |
docs: Fix error when using may_return_null()
Fix error with an untested code path opened up by commit 1f78dc0ace.
-rw-r--r-- | gi/docstring.py | 3 | ||||
-rw-r--r-- | tests/test_docstring.py | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/gi/docstring.py b/gi/docstring.py index 2cfd55aa..517cbd24 100644 --- a/gi/docstring.py +++ b/gi/docstring.py @@ -149,9 +149,10 @@ def _generate_callable_info_doc(info): out_args_strs = [] return_hint = _get_pytype_hint(info.get_return_type()) if not info.skip_return() and return_hint and return_hint not in hint_blacklist: + argstr = return_hint if info.may_return_null(): argstr += ' or None' - out_args_strs.append(return_hint) + out_args_strs.append(argstr) for i, arg in enumerate(args): if arg.get_direction() == Direction.IN: diff --git a/tests/test_docstring.py b/tests/test_docstring.py index 8e83724d..ec1c5068 100644 --- a/tests/test_docstring.py +++ b/tests/test_docstring.py @@ -63,6 +63,10 @@ class Test(unittest.TestCase): self.assertEqual(GIMarshallingTests.boolean_return_true.__doc__, 'boolean_return_true() -> bool') + def test_may_return_none(self): + self.assertEqual(Gio.File.get_basename.__doc__, + 'get_basename(self) -> str or None') + def test_class_doc_constructors(self): doc = GIMarshallingTests.Object.__doc__ self.assertTrue('new(int_:int)' in doc) |