diff options
author | Vlastimil Zíma <ziima@users.noreply.github.com> | 2020-03-02 18:33:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-02 18:33:35 +0100 |
commit | ffe009db773defd7b2b8832778f488a23c8f7ca7 (patch) | |
tree | 3cd0a5144c03602a128aed39b7a8b425f27992d5 /openid/test/test_cryptutil.py | |
parent | 557dc2eac99b29feda2c7f207f7ad6cbe90dde09 (diff) | |
parent | 3f71c33a4b907a8120468e2f22da1d4a15824d90 (diff) | |
download | openid-ffe009db773defd7b2b8832778f488a23c8f7ca7.tar.gz |
Merge pull request #39 from cjwatson/fix-tests
Fix failing tests
Diffstat (limited to 'openid/test/test_cryptutil.py')
-rw-r--r-- | openid/test/test_cryptutil.py | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/openid/test/test_cryptutil.py b/openid/test/test_cryptutil.py index 106be42..f0caed5 100644 --- a/openid/test/test_cryptutil.py +++ b/openid/test/test_cryptutil.py @@ -5,6 +5,7 @@ import os.path import random import sys import unittest +import warnings import six @@ -18,15 +19,17 @@ class TestLongBinary(unittest.TestCase): def test_binaryLongConvert(self): MAX = sys.maxsize - for iteration in range(500): - n = 0 - for i in range(10): - n += random.randrange(MAX) - - s = cryptutil.longToBinary(n) - assert isinstance(s, six.binary_type) - n_prime = cryptutil.binaryToLong(s) - assert n == n_prime, (n, n_prime) + with warnings.catch_warnings(): + warnings.simplefilter('ignore', category=DeprecationWarning) + for iteration in range(500): + n = 0 + for i in range(10): + n += random.randrange(MAX) + + s = cryptutil.longToBinary(n) + assert isinstance(s, six.binary_type) + n_prime = cryptutil.binaryToLong(s) + assert n == n_prime, (n, n_prime) cases = [ (b'\x00', 0), @@ -39,11 +42,13 @@ class TestLongBinary(unittest.TestCase): (b'OpenID is cool', 1611215304203901150134421257416556) ] - for s, n in cases: - n_prime = cryptutil.binaryToLong(s) - s_prime = cryptutil.longToBinary(n) - assert n == n_prime, (s, n, n_prime) - assert s == s_prime, (n, s, s_prime) + with warnings.catch_warnings(): + warnings.simplefilter('ignore', category=DeprecationWarning) + for s, n in cases: + n_prime = cryptutil.binaryToLong(s) + s_prime = cryptutil.longToBinary(n) + assert n == n_prime, (s, n, n_prime) + assert s == s_prime, (n, s, s_prime) class TestFixBtwoc(unittest.TestCase): |