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

[tor-commits] [bridgedb/master] Fix minor type issues



commit 621f35b9cb02f1106a963ddb1f0b0fd23b4826bd
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun Jan 19 12:52:56 2020 -0800

    Fix minor type issues
    
    Just some instances of low hanging fruit...
    
      Traceback (most recent call last):
        File "/home/atagar/Desktop/tor/bridgedb/bridgedb/test/test_Bridges.py", line 110, in test_dumpAssignments
          first = self.ring.bridges.values()[0].fingerprint
      builtins.TypeError: 'dict_values' object does not support indexing
    
      Traceback (most recent call last):
        File "/home/atagar/Desktop/tor/bridgedb/bridgedb/test/test_parse_headers.py", line 37, in test_defaultTBBHeader
          self.assertIsInstance(langs, list)
        File "/usr/local/lib/python3.5/dist-packages/twisted/trial/_synctest.py", line 649, in assertIsInstance
          instance, classOrTuple, suffix))
      twisted.trial.unittest.FailTest: <map object at 0x7f986ca07ba8> is not an instance of <class 'list'>
    
    Test results changed as follows...
    
      before: FAILED (skips=115, failures=29, errors=3, successes=837)
      after:  FAILED (skips=115, failures=27, errors=2, successes=840)
---
 bridgedb/parse/headers.py     | 3 +--
 bridgedb/test/test_Bridges.py | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/bridgedb/parse/headers.py b/bridgedb/parse/headers.py
index fa8cbf2..29dd091 100644
--- a/bridgedb/parse/headers.py
+++ b/bridgedb/parse/headers.py
@@ -75,5 +75,4 @@ def parseAcceptLanguage(header):
 
     # Gettext wants underderscores, because that is how it creates the
     # directories under i18n/, not hyphens:
-    langs = map(lambda x: x.replace('-', '_'), [x for x in langs])
-    return langs
+    return list(map(lambda x: x.replace('-', '_'), [x for x in langs]))
diff --git a/bridgedb/test/test_Bridges.py b/bridgedb/test/test_Bridges.py
index 1f4720f..8f629f5 100644
--- a/bridgedb/test/test_Bridges.py
+++ b/bridgedb/test/test_Bridges.py
@@ -107,7 +107,7 @@ class BridgeRingTests(unittest.TestCase):
         f.seek(0)
 
         data = f.read()
-        first = self.ring.bridges.values()[0].fingerprint
+        first = list(self.ring.bridges.values())[0].fingerprint
 
         # The first bridge's fingerprint should be within the data somewhere
         self.assertIn(first, data)



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