Write a few more tests for coverage (#501)

diff --git a/tests/test_crypto.py b/tests/test_crypto.py
index 5b2c48a..10d2427 100644
--- a/tests/test_crypto.py
+++ b/tests/test_crypto.py
@@ -971,6 +971,9 @@
         self.assertEqual(name.commonName, "quux")
         self.assertEqual(name.CN, "quux")
 
+        with pytest.raises(AttributeError):
+            name.foobar
+
     def test_copy(self):
         """
         :py:class:`X509Name` creates a new :py:class:`X509NameType` instance
@@ -1048,6 +1051,8 @@
         assertNotEqual(self._x509name(CN="foo"),
                        self._x509name(OU="foo"))
 
+        assertNotEqual(self._x509name(), object())
+
         def _inequality(a, b, assertTrue, assertFalse):
             assertTrue(a < b)
             assertTrue(a <= b)
@@ -1848,6 +1853,15 @@
         cert = X509()
         self.assertRaises(Error, cert.get_pubkey)
 
+    def test_set_pubkey_wrong_type(self):
+        """
+        :obj:`X509.set_pubkey` raises :obj:`TypeError` when given an object of
+        the wrong type.
+        """
+        cert = X509()
+        with pytest.raises(TypeError):
+            cert.set_pubkey(object())
+
     def test_subject_name_hash_wrong_args(self):
         """
         :py:obj:`X509.subject_name_hash` raises :py:obj:`TypeError` if called
@@ -2850,7 +2864,10 @@
         neither :py:obj:`FILETYPE_PEM` nor :py:obj:`FILETYPE_ASN1` then
         :py:class:`ValueError` is raised.
         """
-        self.assertRaises(ValueError, load_certificate_request, object(), b"")
+        with pytest.raises(ValueError):
+            load_certificate_request(object(), b"")
+        with pytest.raises(ValueError):
+            load_certificate(object(), b"")
 
 
 class PKCS7Tests(TestCase):