[tor-commits] [stem/master] Using an OrderedDict with tutorial example
atagar at torproject.org
atagar at torproject.org
Wed Dec 24 17:13:39 UTC 2014
commit d47b39fef9b31277be5706491d66011fe006e611
Author: Damian Johnson <atagar at torproject.org>
Date: Wed Dec 24 09:12:07 2014 -0800
Using an OrderedDict with tutorial example
Oops, our tutorial example should be using an OrderedDict rather than dict so
we can be assured that the end result will match the expected string. Spotted
by Foxboron...
https://trac.torproject.org/projects/tor/ticket/14016#comment:2
---
test/unit/tutorial_examples.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/test/unit/tutorial_examples.py b/test/unit/tutorial_examples.py
index 75a480d..0a64bff 100644
--- a/test/unit/tutorial_examples.py
+++ b/test/unit/tutorial_examples.py
@@ -2,6 +2,7 @@
Tests for the examples given in stem's tutorial.
"""
+import collections
import itertools
import StringIO
import unittest
@@ -279,7 +280,7 @@ class TestTutorialExamples(unittest.TestCase):
# Query all authority votes asynchronously.
downloader = remote.DescriptorDownloader(document_handler = DocumentHandler.DOCUMENT)
- queries = {}
+ queries = collections.OrderedDict() # needed so output's order matches what's expected
for name, authority in remote.get_authorities().items():
if authority.v3ident is None:
More information about the tor-commits
mailing list