[pygobject] gtk overrides: Fix return type Gtk.TreePath with depth == 0. Fixes #143
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] gtk overrides: Fix return type Gtk.TreePath with depth == 0. Fixes #143
- Date: Sun, 18 Mar 2018 06:47:12 +0000 (UTC)
commit e4d7675b0e80826db2c1b890ff11fa6ded8394d2
Author: Christoph Reiter <reiter christoph gmail com>
Date: Sun Mar 18 07:33:19 2018 +0100
gtk overrides: Fix return type Gtk.TreePath with depth == 0. Fixes #143
compare() also errors out with depth == 0, but str() shouldn't fail
as it's important for debugging.
gi/overrides/Gtk.py | 2 +-
tests/test_overrides_gtk.py | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index e15a0bb7..71001832 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -1193,7 +1193,7 @@ class TreePath(Gtk.TreePath):
super(TreePath, self).__init__()
def __str__(self):
- return self.to_string()
+ return self.to_string() or ""
def __lt__(self, other):
return other is not None and self.compare(other) < 0
diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py
index fbfe9cfb..e7d15942 100644
--- a/tests/test_overrides_gtk.py
+++ b/tests/test_overrides_gtk.py
@@ -1401,6 +1401,10 @@ class TestTreeModel(unittest.TestCase):
self.assertEqual(p1[2], 3)
self.assertRaises(IndexError, p1.__getitem__, 3)
+ def test_tree_path_empty(self):
+ p1 = Gtk.TreePath.new()
+ assert str(p1) == ""
+
def test_tree_model(self):
tree_store = Gtk.TreeStore(int, str)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]