Преглед на файлове

Python3 compatibility improvements

oz123 преди 10 години
родител
ревизия
97f19ccc87
променени са 3 файла, в които са добавени 8 реда и са изтрити 8 реда
  1. 4 4
      pwman/tests/db_tests.py
  2. 3 3
      pwman/tests/test_crypto_engine.py
  3. 1 1
      pwman/ui/base.py

+ 4 - 4
pwman/tests/db_tests.py

@@ -73,8 +73,8 @@ _saveconfig = False
 PwmanCliNew, OSX = get_ui_platform(sys.platform)
 
 
-from .test_tools import (SetupTester, DummyCallback2,
-                         DummyCallback3, DummyCallback4)
+from test_tools import (SetupTester, DummyCallback2,
+                        DummyCallback3, DummyCallback4)
 
 
 class DBTests(unittest.TestCase):
@@ -255,8 +255,8 @@ class CLITests(unittest.TestCase):
         for t in tags:
             self.assertIsInstance(t, TagNew)
 
-        for t, n in zip(tags, 'looking glass'.split()):
-            self.assertEqual(t.name.strip(), n)
+        for t, n in zip(tags, u'looking glass'.split()):
+            self.assertEqual(t.name.strip().decode(), n)
 
     # creating all the components of the node does
     # the node is still not added !

+ 3 - 3
pwman/tests/test_crypto_engine.py

@@ -54,11 +54,11 @@ class CryptoEngineTest(unittest.TestCase):
         ce._reader = give_key
         secret = ce.encrypt("topsecret")
         decrypt = ce.decrypt(secret)
-        self.assertEqual(decrypt, "topsecret")
+        self.assertEqual(decrypt.decode(), "topsecret")
         ce._cipher = None
         secret = ce.encrypt("topsecret")
         decrypt = ce.decrypt(secret)
-        self.assertEqual(decrypt, "topsecret")
+        self.assertEqual(decrypt.decode(), "topsecret")
 
     def test_g_encrypt_decrypt_wrong_pass(self):
         ce = CryptoEngine.get()
@@ -68,4 +68,4 @@ class CryptoEngineTest(unittest.TestCase):
         ce._getsecret = lambda x: '12345'
         secret = ce.encrypt("topsecret")
         decrypt = ce.decrypt(secret)
-        self.assertEqual(decrypt, "topsecret")
+        self.assertEqual(decrypt.decode(), "topsecret")

+ 1 - 1
pwman/ui/base.py

@@ -524,7 +524,7 @@ class BaseCommands(BaseUI, HelpUI):
             if len(tags) == 0:
                 print ("None",)
             for t in tags:
-                print ("%s " % t.name)
+                print ("%s " % t.name.decode())
             print
         except Exception as e:
             self.error(e)