diff options
author | Eric Brown <ericwb@users.noreply.github.com> | 2018-05-14 20:47:57 -0700 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2018-05-14 23:47:57 -0400 |
commit | 50bad375f5dd3fbb7c7ea62896e2538dc5734be6 (patch) | |
tree | 2ae4a8d5b9576012069ce28ae08ebc575129fdd6 /tests/x509/test_x509.py | |
parent | b2165c2ef0fdf8d63c3b4780648266e37d39df2d (diff) | |
download | cryptography-50bad375f5dd3fbb7c7ea62896e2538dc5734be6.tar.gz cryptography-50bad375f5dd3fbb7c7ea62896e2538dc5734be6.tar.bz2 cryptography-50bad375f5dd3fbb7c7ea62896e2538dc5734be6.zip |
Future proofing use of the six python version constants (#4238)
* Future proofing use of the six python version constants
After reading [1], noticed that cryptography uses a lot of if six.PY3
blocks. The issue with this is that whenever Python 4 is released,
this code in the else block will be executed even though it was
only intended for Python 2.
[1] http://astrofrog.github.io/blog/2016/01/12/stop-writing-python-4-incompatible-code/
Signed-off-by: Eric Brown <browne@vmware.com>
* Use not PY2 instead
Diffstat (limited to 'tests/x509/test_x509.py')
-rw-r--r-- | tests/x509/test_x509.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/x509/test_x509.py b/tests/x509/test_x509.py index 720db78e..335a0fbf 100644 --- a/tests/x509/test_x509.py +++ b/tests/x509/test_x509.py @@ -1097,7 +1097,7 @@ class TestRSACertificate(object): x509.load_pem_x509_certificate, backend ) - if six.PY3: + if not six.PY2: assert repr(cert) == ( "<Certificate(subject=<Name([<NameAttribute(oid=<ObjectIdentif" "ier(oid=2.5.4.11, name=organizationalUnitName)>, value='GT487" @@ -3864,7 +3864,7 @@ class TestNameAttribute(object): def test_repr(self): na = x509.NameAttribute(x509.ObjectIdentifier('2.5.4.3'), u'value') - if six.PY3: + if not six.PY2: assert repr(na) == ( "<NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.3, name=commo" "nName)>, value='value')>" @@ -4059,7 +4059,7 @@ class TestName(object): x509.NameAttribute(NameOID.ORGANIZATION_NAME, u'PyCA'), ]) - if six.PY3: + if not six.PY2: assert repr(name) == ( "<Name([<NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.3, name" "=commonName)>, value='cryptography.io')>, <NameAttribute(oid=" |