[tor-commits] [stem/master] Doctests failed with python3

atagar at torproject.org atagar at torproject.org
Thu Nov 22 18:59:41 UTC 2018


commit f6ea37a47d71dfd7e4b07a1a846fd0d94e527150
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu Nov 22 10:58:04 2018 -0800

    Doctests failed with python3
    
    Oops, my bad. Caught by teor on...
    
      https://trac.torproject.org/projects/tor/ticket/28571
    
    Our tests passed with python 2.7 (which is what I usually run), but python
    3.x's filter() was changed to provide an iterable rather than a list so we
    need to normalize.
---
 stem/descriptor/remote.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stem/descriptor/remote.py b/stem/descriptor/remote.py
index b27bb39d..3430d3f8 100644
--- a/stem/descriptor/remote.py
+++ b/stem/descriptor/remote.py
@@ -687,7 +687,7 @@ class DescriptorDownloader(object):
 
       >>> import stem.descriptor.remote
       >>> consensus = stem.descriptor.remote.get_consensus(microdescriptor = True).run()
-      >>> my_router_status_entry = filter(lambda desc: desc.nickname == 'caersidi', consensus)[0]
+      >>> my_router_status_entry = list(filter(lambda desc: desc.nickname == 'caersidi', consensus))[0]
       >>> print(my_router_status_entry.microdescriptor_digest)
       IQI5X2A5p0WVN/MgwncqOaHF2f0HEGFEaxSON+uKRhU
 



More information about the tor-commits mailing list