diff options
author | Vlastimil Zíma <vlastimil.zima@nic.cz> | 2018-05-09 16:14:58 +0200 |
---|---|---|
committer | Vlastimil Zíma <vlastimil.zima@nic.cz> | 2018-05-11 13:40:03 +0200 |
commit | db406bd9f6f5c01d965e3abdc0e47b77b7166828 (patch) | |
tree | 3d03f2c5d654e00ae9b49e4095eedcac94a66565 /openid | |
parent | 13735aa26af343ca96e9a94c1bc7786bd7da35b7 (diff) | |
download | openid-db406bd9f6f5c01d965e3abdc0e47b77b7166828.tar.gz |
Fix print statement
Diffstat (limited to 'openid')
-rw-r--r-- | openid/test/test_accept.py | 4 | ||||
-rw-r--r-- | openid/test/test_fetchers.py | 2 | ||||
-rw-r--r-- | openid/test/test_oidutil.py | 15 | ||||
-rw-r--r-- | openid/test/test_storetest.py | 6 | ||||
-rw-r--r-- | openid/yadis/xrires.py | 2 |
5 files changed, 17 insertions, 12 deletions
diff --git a/openid/test/test_accept.py b/openid/test/test_accept.py index 7f645d8..8acea20 100644 --- a/openid/test/test_accept.py +++ b/openid/test/test_accept.py @@ -101,7 +101,7 @@ class MatchAcceptTest(unittest.TestCase): try: available = parseAvailable(avail_data) except Exception: - print 'On line', lno + print('On line', lno) raise lno, exp_data = data['expected'] @@ -109,7 +109,7 @@ class MatchAcceptTest(unittest.TestCase): try: expected = parseExpected(exp_data) except Exception: - print 'On line', lno + print('On line', lno) raise accepted = accept.parseAcceptHeader(accept_header) diff --git a/openid/test/test_fetchers.py b/openid/test/test_fetchers.py index 8699e8f..4be8b26 100644 --- a/openid/test/test_fetchers.py +++ b/openid/test/test_fetchers.py @@ -101,7 +101,7 @@ def test_fetcher(fetcher, exc, server): try: actual = fetcher.fetch(fetch_url) except Exception: - print fetcher, fetch_url + print(fetcher, fetch_url) raise else: assertResponse(expected, actual) diff --git a/openid/test/test_oidutil.py b/openid/test/test_oidutil.py index daf830c..8aacb58 100644 --- a/openid/test/test_oidutil.py +++ b/openid/test/test_oidutil.py @@ -23,11 +23,10 @@ class TestBase64(unittest.TestCase): allowed_d = {} for c in allowed_s: allowed_d[c] = None - isAllowed = allowed_d.has_key def checkEncoded(s): for c in s: - assert isAllowed(c), s + self.assertIn(c, allowed_d, msg=s) cases = [ b'', @@ -35,8 +34,12 @@ class TestBase64(unittest.TestCase): b'\x00', b'\x01', b'\x00' * 100, - b''.join(chr(i) for i in range(256)), ] + if six.PY2: + cases.append(b''.join(chr(i) for i in range(256))) + else: + assert six.PY3 + cases.append(bytes(i for i in range(256))) for s in cases: b64 = oidutil.toBase64(s) @@ -47,7 +50,11 @@ class TestBase64(unittest.TestCase): # Randomized test for _ in range(50): n = random.randrange(2048) - s = b''.join(chr(random.randrange(256)) for i in range(n)) + if six.PY2: + s = b''.join(chr(random.randrange(256)) for i in range(n)) + else: + assert six.PY3 + s = bytes(random.randrange(256) for i in range(n)) b64 = oidutil.toBase64(s) checkEncoded(b64) s_prime = oidutil.fromBase64(b64) diff --git a/openid/test/test_storetest.py b/openid/test/test_storetest.py index ef377d1..f315a3c 100644 --- a/openid/test/test_storetest.py +++ b/openid/test/test_storetest.py @@ -58,8 +58,7 @@ def testStore(store): assert retrieved_assoc == expected, (retrieved_assoc, expected) if expected is not None: if retrieved_assoc is expected: - print ('Unexpected: retrieved a reference to the expected ' - 'value instead of a new object') + print('Unexpected: retrieved a reference to the expected value instead of a new object') assert retrieved_assoc.handle == expected.handle assert retrieved_assoc.secret == expected.secret @@ -284,8 +283,7 @@ class TestMySQLStore(unittest.TestCase): conn = MySQLdb.connect(user=db_user, passwd=db_passwd, host=db_host) except MySQLdb.OperationalError as why: if why[0] == 2005: - print ('Skipping MySQL store test (cannot connect ' - 'to test server on host %r)' % (db_host,)) + print('Skipping MySQL store test (cannot connect to test server on host %r)' % db_host) return else: raise diff --git a/openid/yadis/xrires.py b/openid/yadis/xrires.py index 2bc671f..0eb04d7 100644 --- a/openid/yadis/xrires.py +++ b/openid/yadis/xrires.py @@ -87,7 +87,7 @@ class ProxyResolver(object): response = fetchers.fetch(url) if response.status not in (200, 206): # XXX: sucks to fail silently. - # print "response not OK:", response + # print("response not OK:", response) continue et = etxrd.parseXRDS(response.body) canonicalID = etxrd.getCanonicalID(xri, et) |