diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2018-10-10 05:48:54 -0700 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-10-23 23:13:20 +0200 |
commit | 7424c69bde598a145b7d3807e6c367ac4b922bff (patch) | |
tree | 21aed466def95e01b26625ba39dd5502196a83be /tests/test_strings.py | |
parent | 0eaeeadc0411cab8c9f6b1155c13729ce9c7714a (diff) | |
download | rsa-git-7424c69bde598a145b7d3807e6c367ac4b922bff.tar.gz |
Fix BytesWarning in tests
Shouldn't try to coerce bytes to a string. Instead, print the repr
value (e.g. b'mybytestring').
When running tests with the Python `-b` option, fixes warnings of the
form:
.../python-rsa/tests/test_strings.py:34: BytesWarning: str() on a bytes instance
print("\tMessage: %s" % message)
.../python-rsa/tests/test_strings.py:37: BytesWarning: str() on a bytes instance
print("\tEncrypted: %s" % encrypted)
.../python-rsa/tests/test_strings.py:40: BytesWarning: str() on a bytes instance
print("\tDecrypted: %s" % decrypted)
Diffstat (limited to 'tests/test_strings.py')
-rw-r--r-- | tests/test_strings.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/test_strings.py b/tests/test_strings.py index 28fa091..26404ae 100644 --- a/tests/test_strings.py +++ b/tests/test_strings.py @@ -31,12 +31,12 @@ class StringTest(unittest.TestCase): def test_enc_dec(self): message = unicode_string.encode('utf-8') - print("\tMessage: %s" % message) + print("\tMessage: %r" % message) encrypted = rsa.encrypt(message, self.pub) - print("\tEncrypted: %s" % encrypted) + print("\tEncrypted: %r" % encrypted) decrypted = rsa.decrypt(encrypted, self.priv) - print("\tDecrypted: %s" % decrypted) + print("\tDecrypted: %r" % decrypted) self.assertEqual(message, decrypted) |