[pygobject] docs: Fix error when using may_return_null()



commit c1ea60be30ebf11c2e5415180305e4ac3c573f57
Author: Simon Feltman <sfeltman src gnome org>
Date:   Mon Sep 1 15:21:04 2014 -0700

    docs: Fix error when using may_return_null()
    
    Fix error with an untested code path opened up by commit 1f78dc0ace.

 gi/docstring.py         |    3 ++-
 tests/test_docstring.py |    4 ++++
 2 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gi/docstring.py b/gi/docstring.py
index 2cfd55a..517cbd2 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 8e83724..ec1c506 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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]