[tor-commits] [nyx/master] Fix menu tests for python3

atagar at torproject.org atagar at torproject.org
Sat Aug 27 18:23:50 UTC 2016


commit f3f8e99c91b336256a81a01d34faaa6aabfae372
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Aug 24 08:30:04 2016 -0700

    Fix menu tests for python3
    
    LOTS of other test failures but might as well correct this one while we're
    here. Python 2.x and 3.x have different methods for converting objects to a
    boolean value so including both.
---
 test/menu.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/menu.py b/test/menu.py
index 2aa0e4b..a0772b2 100644
--- a/test/menu.py
+++ b/test/menu.py
@@ -11,7 +11,10 @@ class Container(object):
   value = False
 
   def __nonzero__(self):
-    return bool(self.value)
+    return bool(self.value)  # for python 2.x
+
+  def __bool__(self):
+    return bool(self.value)  # for python 3.x
 
 
 def action(*args):





More information about the tor-commits mailing list