[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit 6df6f3670549efb06fd212838de561924dde4f15
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
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):



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits