Simplify conditions and delete an unused function (#512)
diff --git a/src/OpenSSL/crypto.py b/src/OpenSSL/crypto.py
index c31a9d2..116cc51 100644
--- a/src/OpenSSL/crypto.py
+++ b/src/OpenSSL/crypto.py
@@ -2130,9 +2130,7 @@
:return: True if the PKCS7 is of type signed
"""
- if _lib.PKCS7_type_is_signed(self._pkcs7):
- return True
- return False
+ return bool(_lib.PKCS7_type_is_signed(self._pkcs7))
def type_is_enveloped(self):
"""
@@ -2140,9 +2138,7 @@
:returns: True if the PKCS7 is of type enveloped
"""
- if _lib.PKCS7_type_is_enveloped(self._pkcs7):
- return True
- return False
+ return bool(_lib.PKCS7_type_is_enveloped(self._pkcs7))
def type_is_signedAndEnveloped(self):
"""
@@ -2150,9 +2146,7 @@
:returns: True if the PKCS7 is of type signedAndEnveloped
"""
- if _lib.PKCS7_type_is_signedAndEnveloped(self._pkcs7):
- return True
- return False
+ return bool(_lib.PKCS7_type_is_signedAndEnveloped(self._pkcs7))
def type_is_data(self):
"""
@@ -2160,9 +2154,7 @@
:return: True if the PKCS7 is of type data
"""
- if _lib.PKCS7_type_is_data(self._pkcs7):
- return True
- return False
+ return bool(_lib.PKCS7_type_is_data(self._pkcs7))
def get_type_name(self):
"""
diff --git a/tests/test_ssl.py b/tests/test_ssl.py
index 9f22873..eb000aa 100644
--- a/tests/test_ssl.py
+++ b/tests/test_ssl.py
@@ -3020,22 +3020,6 @@
"""
self._doesnt_overfill_test(bytearray)
- def _really_doesnt_overfill_test(self, factory):
- """
- Assert that if the value given by ``nbytes`` is greater than the actual
- size of the output buffer passed to :py:obj:`Connection.recv_into`, the
- behavior is as if no value was given for ``nbytes`` at all.
- """
- output_buffer = factory(5)
-
- server, client = self._loopback()
- server.send(b('abcdefghij'))
-
- self.assertEqual(client.recv_into(output_buffer, 50), 5)
- self.assertEqual(output_buffer, bytearray(b('abcde')))
- rest = client.recv(5)
- self.assertEqual(b('fghij'), rest)
-
def test_bytearray_really_doesnt_overfill(self):
"""
When called with a ``bytearray`` instance and an ``nbytes`` value that