Use simple asserts as assertEqual only works under unittest. Ref
@@ -40,16 +40,14 @@ class TestDBusKWallet(BackendBasicTests):
keyring = self.keyring
# for the non-existent password
- self.assertEqual(keyring.get_password(service, username), None)
+ assert keyring.get_password(service, username) is None
# common usage
self.set_password(service, username, password, True)
# re-init keyring to force migration
self.keyring = keyring = self.init_keyring()
ret_password = keyring.get_password(service, username)
- self.assertEqual(
- ret_password,
- password,
+ assert ret_password == password, (
"Incorrect password for username: '%s' "
"on service: '%s'. '%s' != '%s'"
% (service, username, ret_password, password),
@@ -60,16 +58,12 @@ class TestDBusKWallet(BackendBasicTests):
# re-init keyring to force migration
self.keyring = keyring = self.init_keyring()
ret_password = keyring.get_password(service, username)
- self.assertEqual(
- ret_password,
- "",
+ assert ret_password == "", (
"Incorrect password for username: '%s' "
"on service: '%s'. '%s' != '%s'" % (service, username, ret_password, ""),
)
ret_password = keyring.get_password('Python', username + '@' + service)
- self.assertEqual(
- ret_password,
- None,
+ assert ret_password is None, (
"Not 'None' password returned for username: '%s' "
"on service: '%s'. '%s' != '%s'. Passwords from old "
"folder should be deleted during migration."
