diff options
-rw-r--r-- | src/cryptography/x509/extensions.py | 6 | ||||
-rw-r--r-- | tests/x509/test_x509_ext.py | 14 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py index 7884afbd..e64e09c5 100644 --- a/src/cryptography/x509/extensions.py +++ b/src/cryptography/x509/extensions.py @@ -862,6 +862,9 @@ class OCSPNoCheck(object): return True + def __ne__(self, other): + return not self == other + def __hash__(self): return hash(OCSPNoCheck) @@ -879,6 +882,9 @@ class PrecertPoison(object): return True + def __ne__(self, other): + return not self == other + def __hash__(self): return hash(PrecertPoison) diff --git a/tests/x509/test_x509_ext.py b/tests/x509/test_x509_ext.py index fabf4106..ec618d9a 100644 --- a/tests/x509/test_x509_ext.py +++ b/tests/x509/test_x509_ext.py @@ -4404,9 +4404,12 @@ class TestOCSPNoCheckExtension(object): assert hash(onc1) == hash(onc2) def test_ne(self): - onc = x509.OCSPNoCheck() + onc1 = x509.OCSPNoCheck() + onc2 = x509.OCSPNoCheck() - assert onc != object() + assert onc1 == onc2 + assert (onc1 != onc2) is False + assert onc1 != object() def test_repr(self): onc = x509.OCSPNoCheck() @@ -4929,9 +4932,12 @@ class TestPrecertPoisonExtension(object): assert hash(pcp1) == hash(pcp2) def test_ne(self): - pcp = x509.PrecertPoison() + pcp1 = x509.PrecertPoison() + pcp2 = x509.PrecertPoison() - assert pcp != object() + assert pcp1 == pcp2 + assert (pcp1 != pcp2) is False + assert pcp1 != object() def test_repr(self): pcp = x509.PrecertPoison() |