diff options
author | Eeshan Garg <jerryguitarist@gmail.com> | 2016-02-01 12:56:40 -0330 |
---|---|---|
committer | Eeshan Garg <jerryguitarist@gmail.com> | 2016-02-01 12:56:40 -0330 |
commit | 0a0293e535c8bfd1cf329f77b51d31400aadd5d1 (patch) | |
tree | 485ef437cc393e4c1e824844395a6938a9d19141 | |
parent | 874e865af094ad667cacb3df5e6d72f31e08c615 (diff) | |
download | cryptography-0a0293e535c8bfd1cf329f77b51d31400aadd5d1.tar.gz cryptography-0a0293e535c8bfd1cf329f77b51d31400aadd5d1.tar.bz2 cryptography-0a0293e535c8bfd1cf329f77b51d31400aadd5d1.zip |
Refs #2578 -- implement __hash__ on InhibitAnyPolicy
-rw-r--r-- | src/cryptography/x509/extensions.py | 3 | ||||
-rw-r--r-- | tests/test_x509_ext.py | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py index fe9bcf9b..db55789e 100644 --- a/src/cryptography/x509/extensions.py +++ b/src/cryptography/x509/extensions.py @@ -693,6 +693,9 @@ class InhibitAnyPolicy(object): def __ne__(self, other): return not self == other + def __hash__(self): + return hash(self.skip_certs) + skip_certs = utils.read_only_property("_skip_certs") diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py index b13405de..d8a5f9de 100644 --- a/tests/test_x509_ext.py +++ b/tests/test_x509_ext.py @@ -3398,6 +3398,13 @@ class TestInhibitAnyPolicy(object): assert iap != iap2 assert iap != object() + def test_hash(self): + iap = x509.InhibitAnyPolicy(1) + iap2 = x509.InhibitAnyPolicy(1) + iap3 = x509.InhibitAnyPolicy(4) + assert hash(iap) == hash(iap2) + assert hash(iap) != hash(iap3) + @pytest.mark.requires_backend_interface(interface=RSABackend) @pytest.mark.requires_backend_interface(interface=X509Backend) |