aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-05-03 09:56:31 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-05-11 22:19:46 -0500
commitc56ab62c5bce544948825051cdcbf039093d1da4 (patch)
treefec5a629729f72d8373b2a3aa14618c84a62d608 /src
parentc6f6a247bf281d4307bcb76be873a743660d0438 (diff)
downloadcryptography-c56ab62c5bce544948825051cdcbf039093d1da4.tar.gz
cryptography-c56ab62c5bce544948825051cdcbf039093d1da4.tar.bz2
cryptography-c56ab62c5bce544948825051cdcbf039093d1da4.zip
add eq/ne methods for all certificate policies classes
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/x509.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py
index 50fae716..cdddfb57 100644
--- a/src/cryptography/x509.py
+++ b/src/cryptography/x509.py
@@ -481,6 +481,15 @@ class CertificatePolicies(object):
def __repr__(self):
return "<CertificatePolicies({0})>".format(self._policies)
+ def __eq__(self, other):
+ if not isinstance(other, CertificatePolicies):
+ return NotImplemented
+
+ return self._policies == other._policies
+
+ def __ne__(self, other):
+ return not self == other
+
class PolicyInformation(object):
def __init__(self, policy_identifier, policy_qualifiers):
@@ -506,6 +515,18 @@ class PolicyInformation(object):
"y_qualifiers={0.policy_qualifiers})>".format(self)
)
+ def __eq__(self, other):
+ if not isinstance(other, PolicyInformation):
+ return NotImplemented
+
+ return (
+ self.policy_identifier == other.policy_identifier and
+ self.policy_qualifiers == other.policy_qualifiers
+ )
+
+ def __ne__(self, other):
+ return not self == other
+
policy_identifier = utils.read_only_property("_policy_identifier")
policy_qualifiers = utils.read_only_property("_policy_qualifiers")
@@ -528,6 +549,18 @@ class UserNotice(object):
"{0.explicit_text!r})>".format(self)
)
+ def __eq__(self, other):
+ if not isinstance(other, UserNotice):
+ return NotImplemented
+
+ return (
+ self.notice_reference == other.notice_reference and
+ self.explicit_text == other.explicit_text
+ )
+
+ def __ne__(self, other):
+ return not self == other
+
notice_reference = utils.read_only_property("_notice_reference")
explicit_text = utils.read_only_property("_explicit_text")
@@ -550,6 +583,18 @@ class NoticeReference(object):
"{0.notice_numbers})>".format(self)
)
+ def __eq__(self, other):
+ if not isinstance(other, NoticeReference):
+ return NotImplemented
+
+ return (
+ self.organization == other.organization and
+ self.notice_numbers == other.notice_numbers
+ )
+
+ def __ne__(self, other):
+ return not self == other
+
organization = utils.read_only_property("_organization")
notice_numbers = utils.read_only_property("_notice_numbers")