commit e71c76a87ff509ea2d19ffaec06ae6e7d8a7a7c7 Author: Damian Johnson atagar@torproject.org Date: Fri Jan 17 13:40:11 2020 -0800
None type cannot be compared to integers
Python changed its behavior with regard to how integers are compared with None...
Python 2:
>>> bool(not None > 0) True
Python3:
>>> bool(not None > 0) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unorderable types: NoneType() > int()
This fixes...
Traceback (most recent call last): File "/home/atagar/Desktop/tor/bridgedb/bridgedb/test/test_schedule.py", line 110, in test_ScheduledInterval_init_noargs sched = self.sched() File "/home/atagar/Desktop/tor/bridgedb/bridgedb/schedule.py", line 187, in __init__ self._setIntervalCount(count) File "/home/atagar/Desktop/tor/bridgedb/bridgedb/schedule.py", line 208, in _setIntervalCount % (self.__class__.__name__, count)) bridgedb.schedule.UnknownInterval: ScheduledInterval.intervalCount: None ist not an integer.
Test results changed as follows...
before: FAILED (skips=114, failures=15, errors=117, successes=739) after: FAILED (skips=114, failures=15, errors=116, successes=740) --- bridgedb/schedule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bridgedb/schedule.py b/bridgedb/schedule.py index e962c39..8a7ca0f 100644 --- a/bridgedb/schedule.py +++ b/bridgedb/schedule.py @@ -200,7 +200,7 @@ class ScheduledInterval(Unscheduled): :raises UnknownInterval: if the specified **count** was invalid. """ try: - if not count > 0: + if count is None or not count > 0: count = 1 count = int(count) except (TypeError, ValueError):
tor-commits@lists.torproject.org