Unverified Commit 6df6f367 authored by Damian Johnson's avatar Damian Johnson Committed by Philipp Winter
Browse files

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)
parent 59877413
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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):