[tor-commits] [bridgedb/develop] Fix 'pos' argument type

phw at torproject.org phw at torproject.org
Wed Feb 19 18:27:18 UTC 2020


commit 6df6f3670549efb06fd212838de561924dde4f15
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Jan 19 14:53:42 2020 -0800

    Fix 'pos' argument type
    
    This took me quite a while to puzzle out. Problem was the pos argument, not a
    unicode entry within sortedKeys...
    
      Traceback (most recent call last):
        File "/home/atagar/Desktop/tor/bridgedb/bridgedb/test/test_Bridges.py", line 95, in test_getBridges_filterBySubnet
          bridges = self.ring.getBridges('a' * Bridges.DIGEST_LEN, N=3, filterBySubnet=True)
        File "/home/atagar/Desktop/tor/bridgedb/bridgedb/Bridges.py", line 327, in getBridges
          for k in forced + self._getBridgeKeysAt(pos, N + N):
        File "/home/atagar/Desktop/tor/bridgedb/bridgedb/Bridges.py", line 259, in _getBridgeKeysAt
          idx = bisect.bisect_left(self.sortedKeys, pos)
      builtins.TypeError: unorderable types: bytes() < str()
    
    Test results changed as follows...
    
      before: FAILED (skips=115, failures=27, errors=1, successes=841)
      after:  FAILED (skips=115, failures=27, successes=842)
---
 bridgedb/test/test_Bridges.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bridgedb/test/test_Bridges.py b/bridgedb/test/test_Bridges.py
index 8f629f5..77eff1c 100644
--- a/bridgedb/test/test_Bridges.py
+++ b/bridgedb/test/test_Bridges.py
@@ -92,7 +92,7 @@ class BridgeRingTests(unittest.TestCase):
         filtering by distinct subnets.
         """
         self.addRandomBridges()
-        bridges = self.ring.getBridges('a' * Bridges.DIGEST_LEN, N=3, filterBySubnet=True)
+        bridges = self.ring.getBridges(b'a' * Bridges.DIGEST_LEN, N=3, filterBySubnet=True)
         self.assertEqual(len(bridges), 3)
 
     def test_dumpAssignments(self):





More information about the tor-commits mailing list