Use `unittest` assert methods

Changed assertion in unit tests from Python built-in to `unittest`
provided. The motivation is to have better reporting on test failures.
diff --git a/CHANGES.txt b/CHANGES.txt
index 9bf61fc..551e10a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -8,6 +8,8 @@
 - Removed support for EOL Pythons 2.4, 2.5, 2.6, 3.2, 3.3 and 3.4.
 - Improve test routines for RFC5126
 - Add RFC4387 providing Certificate Store Access via HTTP
+- Changed assertion in unit tests from Python built-in to `unittest`
+  provided
 
 Revision 0.2.8, released 16-11-2019
 -----------------------------------
diff --git a/tests/test_pem.py b/tests/test_pem.py
index ac28efb..092ce1a 100644
--- a/tests/test_pem.py
+++ b/tests/test_pem.py
@@ -36,7 +36,7 @@
 
         binary = pem.readBase64fromText(self.pem_text)
 
-        assert binary
+        self.assertTrue(binary)
 
         expected = [
             48, 130, 3, 1, 48, 130, 1, 233, 2, 1, 0, 48, 129, 153, 49, 11, 48,
@@ -93,7 +93,7 @@
             24, 102, 241, 236, 50
         ]
 
-        assert ints2octs(expected) == binary
+        self.assertEqual(ints2octs(expected), binary)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc2314.py b/tests/test_rfc2314.py
index 2324732..273dc4c 100644
--- a/tests/test_rfc2314.py
+++ b/tests/test_rfc2314.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der import decoder as der_decoder
-from pyasn1.codec.der import encoder as der_encoder
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc2314
@@ -42,11 +42,11 @@
 
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc2315.py b/tests/test_rfc2315.py
index 034f5ef..d03cec1 100644
--- a/tests/test_rfc2315.py
+++ b/tests/test_rfc2315.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der import decoder as der_decoder
-from pyasn1.codec.der import encoder as der_encoder
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc2315
@@ -141,21 +141,21 @@
 
         substrate = pem.readBase64fromText(self.pem_text_unordered)
 
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
     def testDerCodecDecodeOpenTypes(self):
 
         substrate = pem.readBase64fromText(self.pem_text_reordered)
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(
-            asn1Object, omitEmptyOptionals=False) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(
+            substrate, der_encoder(asn1Object, omitEmptyOptionals=False))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc2437.py b/tests/test_rfc2437.py
index 23e8283..cc34cd4 100644
--- a/tests/test_rfc2437.py
+++ b/tests/test_rfc2437.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der import decoder as der_decoder
-from pyasn1.codec.der import encoder as der_encoder
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc2437
@@ -32,11 +32,11 @@
 
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc2459.py b/tests/test_rfc2459.py
index a0588a1..7dac4d5 100644
--- a/tests/test_rfc2459.py
+++ b/tests/test_rfc2459.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der import decoder as der_decoder
-from pyasn1.codec.der import encoder as der_encoder
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc2459
@@ -41,21 +41,22 @@
 
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(der_encoder(asn1Object), substrate)
 
     def testDerCodecDecodeOpenTypes(self):
 
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(der_encoder(asn1Object), substrate)
 
 
 class CertificateListTestCase(unittest.TestCase):
@@ -77,21 +78,22 @@
 
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(der_encoder(asn1Object), substrate)
 
     def testDerCodecDecodeOpenTypes(self):
 
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(der_encoder(asn1Object), substrate)
 
 
 class DSAPrivateKeyTestCase(unittest.TestCase):
@@ -115,21 +117,22 @@
 
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
     def testDerCodecDecodeOpenTypes(self):
 
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc2511.py b/tests/test_rfc2511.py
index 2414158..ae25add 100644
--- a/tests/test_rfc2511.py
+++ b/tests/test_rfc2511.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der import decoder as der_decoder
-from pyasn1.codec.der import encoder as der_encoder
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc2511
@@ -34,11 +34,11 @@
 
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc2560.py b/tests/test_rfc2560.py
index 1091652..75ebf9e 100644
--- a/tests/test_rfc2560.py
+++ b/tests/test_rfc2560.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der import decoder as der_decoder
-from pyasn1.codec.der import encoder as der_encoder
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc2560
@@ -27,11 +27,11 @@
 
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(der_encoder(asn1Object), substrate)
 
 
 class OCSPResponseTestCase(unittest.TestCase):
@@ -66,11 +66,11 @@
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc2631.py b/tests/test_rfc2631.py
index 0341944..ca9e547 100644
--- a/tests/test_rfc2631.py
+++ b/tests/test_rfc2631.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import univ
 
 from pyasn1_modules import pem
@@ -24,13 +24,14 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         hex1 = univ.OctetString(hexValue='00000001')
-        assert asn1Object['keyInfo']['counter'] == hex1
+        self.assertEqual(hex1, asn1Object['keyInfo']['counter'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc2634.py b/tests/test_rfc2634.py
index 22dce85..225b987 100644
--- a/tests/test_rfc2634.py
+++ b/tests/test_rfc2634.py
@@ -9,8 +9,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5652
@@ -54,26 +54,30 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.signed_message_pem_text)
-        asn1Object, rest = der_decode (substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['contentType'] == rfc5652.id_signedData
-        sd, rest = der_decode(asn1Object['content'], asn1Spec=rfc5652.SignedData())
-        assert not rest
-        assert sd.prettyPrint()
-        assert der_encode(sd) == asn1Object['content'] 
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(rfc5652.id_signedData,  asn1Object['contentType'])
+
+        sd, rest = der_decoder(
+            asn1Object['content'], asn1Spec=rfc5652.SignedData())
+
+        self.assertFalse(rest)
+        self.assertTrue(sd.prettyPrint())
+        self.assertEqual(asn1Object['content'], der_encoder(sd))
        
         for sa in sd['signerInfos'][0]['signedAttrs']:
             sat = sa['attrType']
             sav0 = sa['attrValues'][0]
 
             if sat in rfc5652.cmsAttributesMap.keys():
-                sav, rest = der_decode(sav0, asn1Spec=rfc5652.cmsAttributesMap[sat])
-                assert not rest
-                assert sav.prettyPrint()
-                assert der_encode(sav) == sav0
+                sav, rest = der_decoder(
+                    sav0, asn1Spec=rfc5652.cmsAttributesMap[sat])
+                self.assertFalse(rest)
+                self.assertTrue(sav.prettyPrint())
+                self.assertEqual(sav0, der_encoder(sav))
 
 
 class SignedReceiptTestCase(unittest.TestCase):
@@ -112,62 +116,72 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.signed_receipt_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['contentType'] == rfc5652.id_signedData
-        sd, rest = der_decode (asn1Object['content'], asn1Spec=rfc5652.SignedData())
-        assert not rest
-        assert sd.prettyPrint()
-        assert der_encode(sd) == asn1Object['content']
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(asn1Object['contentType'], rfc5652.id_signedData)
 
-        assert sd['encapContentInfo']['eContentType'] == rfc2634.id_ct_receipt
-        receipt, rest = der_decode(sd['encapContentInfo']['eContent'],
+        sd, rest = der_decoder(asn1Object['content'], asn1Spec=rfc5652.SignedData())
+
+        self.assertFalse(rest)
+
+        self.assertTrue(sd.prettyPrint())
+        self.assertEqual(asn1Object['content'], der_encoder(sd))
+        self.assertEqual(sd['encapContentInfo']['eContentType'],
+                         rfc2634.id_ct_receipt)
+
+        receipt, rest = der_decoder(sd['encapContentInfo']['eContent'],
                                    asn1Spec=rfc2634.Receipt())
-        assert not rest
-        assert receipt.prettyPrint()
-        assert der_encode(receipt) == sd['encapContentInfo']['eContent']
-        assert receipt['version'] == rfc2634.ESSVersion().subtype(value='v1')
+
+        self.assertFalse(rest)
+        self.assertTrue(receipt.prettyPrint())
+        self.assertEqual(sd['encapContentInfo']['eContent'], der_encoder(receipt))
+        self.assertEqual(receipt['version'], rfc2634.ESSVersion().subtype(value='v1'))
 
         for sa in sd['signerInfos'][0]['signedAttrs']:
             sat = sa['attrType']
             sav0 = sa['attrValues'][0]
 
             if sat in rfc5652.cmsAttributesMap.keys():
-                sav, rest = der_decode(sav0, asn1Spec=rfc5652.cmsAttributesMap[sat])
-                assert not rest
-                assert sav.prettyPrint()
-                assert der_encode(sav) == sav0
+                sav, rest = der_decoder(sav0, asn1Spec=rfc5652.cmsAttributesMap[sat])
+
+                self.assertFalse(rest)
+                self.assertTrue(sav.prettyPrint())
+                self.assertEqual(sav0, der_encoder(sav))
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.signed_receipt_pem_text)
-        asn1Object, rest = der_decode(substrate,
+        asn1Object, rest = der_decoder(substrate,
             asn1Spec=self.asn1Spec,
             decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
 
-        assert asn1Object['contentType'] in rfc5652.cmsContentTypesMap.keys()
-        assert asn1Object['contentType'] == rfc5652.id_signedData
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertIn(asn1Object['contentType'], rfc5652.cmsContentTypesMap.keys())
+        self.assertEqual(asn1Object['contentType'], rfc5652.id_signedData)
 
         sd = asn1Object['content']
-        assert sd['version'] == rfc5652.CMSVersion().subtype(value='v3')
-        assert sd['encapContentInfo']['eContentType'] in rfc5652.cmsContentTypesMap.keys()
-        assert sd['encapContentInfo']['eContentType'] == rfc2634.id_ct_receipt
+
+        self.assertEqual(sd['version'], rfc5652.CMSVersion().subtype(value='v3'))
+        self.assertIn(sd['encapContentInfo']['eContentType'], rfc5652.cmsContentTypesMap)
+        self.assertEqual(sd['encapContentInfo']['eContentType'], rfc2634.id_ct_receipt)
 
         for sa in sd['signerInfos'][0]['signedAttrs']:
-            assert sa['attrType'] in rfc5652.cmsAttributesMap.keys()
+
+            self.assertIn(sa['attrType'], rfc5652.cmsAttributesMap)
+
             if sa['attrType'] == rfc2634.id_aa_msgSigDigest:
                 sa['attrValues'][0].prettyPrint()[:10] == '0x167378'
 
         # Since receipt is inside an OCTET STRING, decodeOpenTypes=True cannot
         # automatically decode it 
-        receipt, rest = der_decode(sd['encapContentInfo']['eContent'],
+        receipt, rest = der_decoder(sd['encapContentInfo']['eContent'],
             asn1Spec=rfc5652.cmsContentTypesMap[sd['encapContentInfo']['eContentType']])
-        assert receipt['version'] == rfc2634.ESSVersion().subtype(value='v1')
+
+        self.assertEqual(receipt['version'], rfc2634.ESSVersion().subtype(value='v1'))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc2985.py b/tests/test_rfc2985.py
index 12cf1f1..376475e 100644
--- a/tests/test_rfc2985.py
+++ b/tests/test_rfc2985.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import univ
 
 from pyasn1_modules import pem
@@ -117,10 +117,11 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(der_encoder(asn1Object), substrate)
 
         openTypesMap = {
             rfc2985.pkcs_9_at_smimeCapabilities: rfc2985.SMIMECapabilities(),
@@ -129,88 +130,104 @@
         openTypesMap.update(rfc5652.cmsAttributesMap)
 
         for attr in asn1Object:
-            assert attr['type'] in openTypesMap.keys()
-            av, rest = der_decode(attr['values'][0],
-                asn1Spec=openTypesMap[attr['type']])
-            assert not rest
-            assert av.prettyPrint()
-            assert der_encode(av) == attr['values'][0]
+            self.assertIn(attr['type'], openTypesMap)
+
+            av, rest = der_decoder(
+                attr['values'][0], asn1Spec=openTypesMap[attr['type']])
+
+            self.assertFalse(rest)
+            self.assertTrue(av.prettyPrint())
+            self.assertEqual(attr['values'][0], der_encoder(av))
 
             if attr['type'] == rfc2985.pkcs_9_at_userPKCS12:
-                assert av['version'] == univ.Integer(3)
-                assert av['authSafe']['contentType'] == rfc5652.id_data
-                outdata, rest = der_decode(av['authSafe']['content'],
-                    asn1Spec=univ.OctetString())
-                assert not rest
-                authsafe, rest = der_decode(outdata,
-                    asn1Spec=rfc7292.AuthenticatedSafe())
-                assert not rest
+
+                self.assertEqual(univ.Integer(3), av['version'])
+                self.assertEqual(rfc5652.id_data, av['authSafe']['contentType'])
+
+                outdata, rest = der_decoder(
+                    av['authSafe']['content'], asn1Spec=univ.OctetString())
+
+                self.assertFalse(rest)
+
+                authsafe, rest = der_decoder(
+                    outdata, asn1Spec=rfc7292.AuthenticatedSafe())
+
+                self.assertFalse(rest)
 
                 for ci in authsafe:
-                    assert ci['contentType'] == rfc5652.id_data
-                    indata, rest = der_decode(ci['content'],
-                        asn1Spec=univ.OctetString())
-                    assert not rest
-                    sc, rest = der_decode(indata,
-                        asn1Spec=rfc7292.SafeContents())
-                    assert not rest
+                    self.assertEqual(rfc5652.id_data, ci['contentType'])
+
+                    indata, rest = der_decoder(
+                        ci['content'], asn1Spec=univ.OctetString())
+
+                    self.assertFalse(rest)
+
+                    sc, rest = der_decoder(
+                        indata, asn1Spec=rfc7292.SafeContents())
+
+                    self.assertFalse(rest)
 
                     for sb in sc:
                         if sb['bagId'] in rfc7292.pkcs12BagTypeMap:
-                            bv, rest = der_decode(sb['bagValue'],
-                                asn1Spec=rfc7292.pkcs12BagTypeMap[sb['bagId']])
-                            assert not rest
+                            bv, rest = der_decoder(
+                                sb['bagValue'], asn1Spec=rfc7292.pkcs12BagTypeMap[sb['bagId']])
+
+                            self.assertFalse(rest)
 
                             for bagattr in sb['bagAttributes']:
                                 if bagattr['attrType'] in openTypesMap:
-                                    inav, rest = der_decode(bagattr['attrValues'][0],
-                                        asn1Spec=openTypesMap[bagattr['attrType']])
-                                    assert not rest
+                                    inav, rest = der_decoder(
+                                        bagattr['attrValues'][0], asn1Spec=openTypesMap[bagattr['attrType']])
+
+                                    self.assertFalse(rest)
 
                                     if bagattr['attrType'] == rfc2985.pkcs_9_at_friendlyName:
-                                        assert inav == "3f71af65-1687-444a-9f46-c8be194c3e8e"
+                                        self.assertEqual( "3f71af65-1687-444a-9f46-c8be194c3e8e", inav)
 
                                     if bagattr['attrType'] == rfc2985.pkcs_9_at_localKeyId:
-                                        assert inav == univ.OctetString(hexValue='01000000')
+                                        self.assertEqual(univ.OctetString(hexValue='01000000'), inav)
 
             if attr['type'] == rfc2985.pkcs_9_at_pkcs7PDU:
-                ci, rest = der_decode(attr['values'][0],
-                    asn1Spec=rfc5652.ContentInfo())
-                assert not rest
-                assert ci['contentType'] == rfc5652.id_signedData
+                ci, rest = der_decoder(
+                    attr['values'][0], asn1Spec=rfc5652.ContentInfo())
 
-                sd, rest = der_decode(ci['content'],
-                    asn1Spec=rfc5652.SignedData())
-                assert not rest
-                assert sd['version'] == 1
+                self.assertFalse(rest)
+                self.assertEqual(rfc5652.id_signedData, ci['contentType'])
+
+                sd, rest = der_decoder(
+                    ci['content'], asn1Spec=rfc5652.SignedData())
+
+                self.assertFalse(rest)
+                self.assertEqual(1, sd['version'])
         
                 for si in sd['signerInfos']:
-                    assert si['version'] == 1
+                    self.assertEqual(1, si['version'])
 
                     for siattr in si['signedAttrs']:
                         if siattr['attrType'] in openTypesMap:
-                            siav, rest = der_decode(siattr['attrValues'][0],
-                                asn1Spec=openTypesMap[siattr['attrType']])
-                            assert not rest
+                            siav, rest = der_decoder(
+                                siattr['attrValues'][0], asn1Spec=openTypesMap[siattr['attrType']])
+
+                            self.assertFalse(rest)
 
                             if siattr['attrType'] == rfc2985.pkcs_9_at_contentType:
-                                assert siav == rfc5652.id_data
+                                self.assertEqual(rfc5652.id_data, siav)
 
                             if siattr['attrType'] == rfc2985.pkcs_9_at_messageDigest:
-                                assert siav.prettyPrint()[2:10] == 'b6e422a4'
+                                self.assertEqual('b6e422a4', siav.prettyPrint()[2:10])
 
                             if siattr['attrType'] == rfc2985.pkcs_9_at_signingTime:
-                                assert siav['utcTime'] == '190529182319Z'
+                                self.assertEqual('190529182319Z', siav['utcTime'])
 
                 for choices in sd['certificates']:
                     for rdn in choices[0]['tbsCertificate']['subject']['rdnSequence']:
                         if rdn[0]['type'] in openTypesMap:
-                            nv, rest = der_decode(rdn[0]['value'],
-                                 asn1Spec=openTypesMap[rdn[0]['type']])
-                            assert not rest
+                            nv, rest = der_decoder(
+                                rdn[0]['value'], asn1Spec=openTypesMap[rdn[0]['type']])
+                            self.assertFalse(rest)
 
                             if rdn[0]['type'] == rfc2985.pkcs_9_at_emailAddress:
-                                assert nv == 'alice@example.com'
+                                self.assertEqual('alice@example.com', nv)
 
     def testOpenTypes(self):
         openTypesMap = {
@@ -220,34 +237,40 @@
         openTypesMap.update(rfc5652.cmsAttributesMap)
 
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            openTypes=openTypesMap,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec,
+            openTypes=openTypesMap, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         for attr in asn1Object:
-            assert attr['type'] in openTypesMap.keys()
+            self.assertTrue(attr['type'], openTypesMap)
 
             if attr['type'] == rfc2985.pkcs_9_at_userPKCS12:
-                assert attr['values'][0]['version'] == univ.Integer(3)
-                assert attr['values'][0]['authSafe']['contentType'] == rfc5652.id_data
-                authsafe, rest = der_decode(attr['values'][0]['authSafe']['content'],
+
+                self.assertEqual(univ.Integer(3), attr['values'][0]['version'])
+                self.assertEqual(rfc5652.id_data, attr['values'][0]['authSafe']['contentType'])
+
+                authsafe, rest = der_decoder(
+                    attr['values'][0]['authSafe']['content'],
                     asn1Spec=rfc7292.AuthenticatedSafe())
-                assert not rest
+
+                self.assertFalse(rest)
 
                 for ci in authsafe:
-                    assert ci['contentType'] == rfc5652.id_data
-                    indata, rest = der_decode(ci['content'],
-                       asn1Spec=univ.OctetString())
-                    assert not rest
+                    self.assertEqual(rfc5652.id_data, ci['contentType'])
 
-                    sc, rest = der_decode(indata,
-                        asn1Spec=rfc7292.SafeContents(),
-                        decodeOpenTypes=True)
-                    assert not rest
+                    indata, rest = der_decoder(
+                        ci['content'], asn1Spec=univ.OctetString())
+
+                    self.assertFalse(rest)
+
+                    sc, rest = der_decoder(
+                        indata, asn1Spec=rfc7292.SafeContents(), decodeOpenTypes=True)
+
+                    self.assertFalse(rest)
 
                     for sb in sc:
                         if sb['bagId'] in rfc7292.pkcs12BagTypeMap:
@@ -255,35 +278,39 @@
                                 if bagattr['attrType'] in openTypesMap:
 
                                     if bagattr['attrType'] == rfc2985.pkcs_9_at_friendlyName:
-                                        assert bagattr['attrValues'][0] == "3f71af65-1687-444a-9f46-c8be194c3e8e"
+                                        self.assertEqual(
+                                            "3f71af65-1687-444a-9f46-c8be194c3e8e",
+                                            bagattr['attrValues'][0])
 
                                     if bagattr['attrType'] == rfc2985.pkcs_9_at_localKeyId:
-                                        assert bagattr['attrValues'][0] == univ.OctetString(hexValue='01000000')
+                                        self.assertEqual(
+                                            univ.OctetString(hexValue='01000000'),
+                                            bagattr['attrValues'][0])
 
             if attr['type'] == rfc2985.pkcs_9_at_pkcs7PDU:
-                assert attr['values'][0]['contentType'] == rfc5652.id_signedData
-                assert attr['values'][0]['content']['version'] == 1
+                self.assertEqual(rfc5652.id_signedData, attr['values'][0]['contentType'])
+                self.assertEqual(1, attr['values'][0]['content']['version'])
         
                 for si in attr['values'][0]['content']['signerInfos']:
-                    assert si['version'] == 1
+                    self.assertEqual(1, si['version'])
 
                     for siattr in si['signedAttrs']:
                         if siattr['attrType'] in openTypesMap:
  
                             if siattr['attrType'] == rfc2985.pkcs_9_at_contentType:
-                                assert siattr['attrValues'][0] == rfc5652.id_data
+                                self.assertEqual(rfc5652.id_data, siattr['attrValues'][0])
 
                             if siattr['attrType'] == rfc2985.pkcs_9_at_messageDigest:
-                                assert siattr['attrValues'][0].prettyPrint()[2:10] == 'b6e422a4'
+                                self.assertEqual('b6e422a4', siattr['attrValues'][0].prettyPrint()[2:10])
 
                             if siattr['attrType'] == rfc2985.pkcs_9_at_signingTime:
-                                assert siattr['attrValues'][0]['utcTime'] == '190529182319Z'
+                                self.assertEqual('190529182319Z', siattr['attrValues'][0]['utcTime'])
 
                 for choices in attr['values'][0]['content']['certificates']:
                     for rdn in choices[0]['tbsCertificate']['subject']['rdnSequence']:
                         if rdn[0]['type'] in openTypesMap:
                             if rdn[0]['type'] == rfc2985.pkcs_9_at_emailAddress:
-                                assert rdn[0]['value'] == 'alice@example.com'
+                                self.assertEqual('alice@example.com', rdn[0]['value'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc2986.py b/tests/test_rfc2986.py
index 2d14f75..d1e66b1 100644
--- a/tests/test_rfc2986.py
+++ b/tests/test_rfc2986.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import char
 from pyasn1.type import univ
 
@@ -43,11 +43,11 @@
 
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
     def testOpenTypes(self):
         openTypesMap = {
@@ -57,27 +57,30 @@
         }
 
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=rfc2986.CertificationRequest(),
-            openTypes=openTypesMap,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
+        asn1Object, rest = der_decoder(substrate,
+                                       asn1Spec=rfc2986.CertificationRequest(),
+                                       openTypes=openTypesMap,
+                                       decodeOpenTypes=True)
 
-        assert der_encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         for rdn in asn1Object['certificationRequestInfo']['subject']['rdnSequence']:
             for atv in rdn:
                 if atv['type'] == rfc5280.id_at_countryName:
-                    assert atv['value'] == char.PrintableString('US')
+                    self.assertEqual(char.PrintableString('US'), atv['value'])
+
                 else:
-                    assert len(atv['value']['utf8String']) > 2
+                    self.assertGreater(len(atv['value']['utf8String']), 2)
 
         spki_alg = asn1Object['certificationRequestInfo']['subjectPKInfo']['algorithm']
-        assert spki_alg['parameters'] == univ.Null("")
+
+        self.assertEqual(univ.Null(""), spki_alg['parameters'])
 
         sig_alg = asn1Object['signatureAlgorithm']
-        assert sig_alg['parameters'] == univ.Null("")
+
+        self.assertEqual(univ.Null(""), sig_alg['parameters'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc3114.py b/tests/test_rfc3114.py
index 13c5d6e..d0492a6 100644
--- a/tests/test_rfc3114.py
+++ b/tests/test_rfc3114.py
@@ -9,8 +9,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc3114
@@ -147,10 +147,11 @@
 
         next_layer = rfc5652.id_ct_contentInfo
         while next_layer:
-            asn1Object, rest = der_decode(substrate, asn1Spec=layers[next_layer])
-            assert not rest
-            assert asn1Object.prettyPrint()
-            assert der_encode(asn1Object) == substrate
+            asn1Object, rest = der_decoder(substrate, asn1Spec=layers[next_layer])
+
+            self.assertFalse(rest)
+            self.assertTrue(asn1Object.prettyPrint())
+            self.assertEqual(substrate, der_encoder(asn1Object))
 
             if next_layer == rfc5652.id_signedData:
                 attrs = asn1Object['signerInfos'][0]['signedAttrs']
@@ -163,62 +164,77 @@
         catid = rfc3114.id_tsp_TEST_Whirlpool_Categories
         conf = rfc3114.Whirlpool_SecurityClassification(value='whirlpool-confidential')
 
-        assert catid in rfc5755.securityCategoryMap.keys()
-        assert rfc5755.id_at_clearance in rfc5280.certificateAttributesMap.keys()
-        assert rfc5280.id_ce_subjectDirectoryAttributes in rfc5280.certificateExtensionsMap.keys()
+        self.assertIn(catid, rfc5755.securityCategoryMap)
+        self.assertIn(rfc5755.id_at_clearance, rfc5280.certificateAttributesMap)
+        self.assertIn(rfc5280.id_ce_subjectDirectoryAttributes, rfc5280.certificateExtensionsMap)
 
         security_label_okay = False
+
         for attr in attrs:
             if attr['attrType'] == rfc5035.id_aa_securityLabel:
-                esssl, rest = der_decode(attr['attrValues'][0],
-                    asn1Spec=rfc5035.ESSSecurityLabel())
-                assert not rest
-                assert esssl.prettyPrint()
-                assert der_encode(esssl) == attr['attrValues'][0]
+                esssl, rest = der_decoder(
+                    attr['attrValues'][0], asn1Spec=rfc5035.ESSSecurityLabel())
 
-                assert esssl['security-policy-identifier'] == spid
-                assert esssl['security-classification'] == conf
+                self.assertFalse(rest)
+                self.assertTrue(esssl.prettyPrint())
+                self.assertEqual(attr['attrValues'][0], der_encoder(esssl))
+
+                self.assertEqual(spid, esssl['security-policy-identifier'])
+                self.assertEqual(conf, esssl['security-classification'])
 
                 for cat in esssl['security-categories']:
                     if cat['type'] == catid:
-                        scv, rest = der_decode(cat['value'],
-                            asn1Spec=rfc3114.SecurityCategoryValues())
-                        assert not rest
-                        assert scv.prettyPrint()
-                        assert der_encode(scv) == cat['value']
+                        scv, rest = der_decoder(
+                            cat['value'], asn1Spec=rfc3114.SecurityCategoryValues())
+
+                        self.assertFalse(rest)
+                        self.assertTrue(scv.prettyPrint())
+                        self.assertEqual(cat['value'], der_encoder(scv))
+
                         for scv_str in scv:
-                            assert 'USE ONLY' in scv_str
+                            self.assertIn('USE ONLY', scv_str)
                             security_label_okay = True
 
-        assert security_label_okay
+        self.assertTrue(security_label_okay)
 
         clearance_okay = False
         for cert_choice in certs:
             for extn in cert_choice['certificate']['tbsCertificate']['extensions']:
                 if extn['extnID'] == rfc5280.id_ce_subjectDirectoryAttributes:
-                    ev, rest = der_decode(extn['extnValue'],
+                    ev, rest = der_decoder(
+                        extn['extnValue'],
                         asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                    assert not rest
-                    assert ev.prettyPrint()
-                    assert der_encode(ev) == extn['extnValue']
+
+                    self.assertFalse(rest)
+                    self.assertTrue(ev.prettyPrint())
+                    self.assertEqual(extn['extnValue'], der_encoder(ev))
 
                     for attr in ev:
+
                         if attr['type'] == rfc5755.id_at_clearance:
-                            av, rest = der_decode(attr['values'][0],
+                            av, rest = der_decoder(
+                                attr['values'][0],
                                 asn1Spec=rfc5280.certificateAttributesMap[attr['type']])
-                            assert av['policyId'] == spid
+
+                            self.assertEqual(spid, av['policyId'])
+
                             for cat in av['securityCategories']:
-                                assert cat['type'] == catid
-                                scv, rest = der_decode(cat['value'],
+
+                                self.assertEqual(catid, cat['type'])
+
+                                scv, rest = der_decoder(
+                                    cat['value'],
                                     asn1Spec=rfc5755.securityCategoryMap[cat['type']])
-                                assert not rest
-                                assert scv.prettyPrint()
-                                assert der_encode(scv) == cat['value']
+
+                                self.assertFalse(rest)
+                                self.assertTrue(scv.prettyPrint())
+                                self.assertEqual(cat['value'], der_encoder(scv))
+
                                 for scv_str in scv:
-                                    assert 'USE ONLY' in scv_str
+                                    self.assertIn('USE ONLY', scv_str)
                                     clearance_okay = True
 
-        assert clearance_okay
+        self.assertTrue(clearance_okay)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc3125.py b/tests/test_rfc3125.py
index 9c132e3..d7072b9 100644
--- a/tests/test_rfc3125.py
+++ b/tests/test_rfc3125.py
@@ -7,22 +7,16 @@
 #
 
 import sys
+import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc2985
 from pyasn1_modules import rfc3125
 
 
-try:
-    import unittest2 as unittest
-
-except ImportError:
-    import unittest
-
-
 class SignaturePolicyTestCase(unittest.TestCase):
     pem_text = """\
 MIIMYzALBglghkgBZQMEAgEwggwwBgorgR6RmYQFAQICGA8yMDE2MTAwMjAwMDAwMFowgaSk
@@ -91,17 +85,19 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         svp = asn1Object['signPolicyInfo']['signatureValidationPolicy']
         sr = svp['commonRules']['signerAndVeriferRules']['signerRules']
         msa = sr['mandatedSignedAttr']
-        assert rfc2985.pkcs_9_at_contentType in msa
-        assert rfc2985.pkcs_9_at_messageDigest in msa
-        assert rfc2985.pkcs_9_at_signingTime in msa
+
+        self.assertIn(rfc2985.pkcs_9_at_contentType, msa)
+        self.assertIn(rfc2985.pkcs_9_at_messageDigest, msa)
+        self.assertIn(rfc2985.pkcs_9_at_signingTime, msa)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc3161.py b/tests/test_rfc3161.py
index 3b1b7b3..47db88a 100644
--- a/tests/test_rfc3161.py
+++ b/tests/test_rfc3161.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc3161
@@ -26,10 +26,11 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.tsp_query_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 class TSPResponseTestCase(unittest.TestCase):
@@ -66,10 +67,11 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.tsp_response_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc3274.py b/tests/test_rfc3274.py
index bb82b98..cb24d37 100644
--- a/tests/test_rfc3274.py
+++ b/tests/test_rfc3274.py
@@ -9,8 +9,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc3274
@@ -37,33 +37,41 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.compressed_data_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['contentType'] == rfc3274.id_ct_compressedData
-        cd, rest = der_decode(asn1Object['content'], asn1Spec=rfc3274.CompressedData())
-        assert not rest
-        assert cd.prettyPrint()
-        assert der_encode(cd) == asn1Object['content']
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(rfc3274.id_ct_compressedData, asn1Object['contentType'])
 
-        assert cd['compressionAlgorithm']['algorithm'] == rfc3274.id_alg_zlibCompress
-        assert cd['encapContentInfo']['eContentType'] == rfc5652.id_data
+        cd, rest = der_decoder(
+            asn1Object['content'], asn1Spec=rfc3274.CompressedData())
+
+        self.assertFalse(rest)
+        self.assertTrue(cd.prettyPrint())
+        self.assertEqual(asn1Object['content'], der_encoder(cd))
+
+        self.assertEqual(rfc3274.id_alg_zlibCompress,
+                         cd['compressionAlgorithm']['algorithm'])
+        self.assertEqual(rfc5652.id_data, cd['encapContentInfo']['eContentType'])
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.compressed_data_pem_text)
-        asn1Object, rest = der_decode(substrate, 
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate,
+                                       asn1Spec=self.asn1Spec,
+                                       decodeOpenTypes=True)
 
-        assert asn1Object['contentType'] == rfc3274.id_ct_compressedData
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(
+            rfc3274.id_ct_compressedData, asn1Object['contentType'])
+
         cd = asn1Object['content']
-        assert cd['compressionAlgorithm']['algorithm'] == rfc3274.id_alg_zlibCompress
-        assert cd['encapContentInfo']['eContentType'] == rfc5652.id_data
+
+        self.assertEqual(rfc3274.id_alg_zlibCompress,
+                         cd['compressionAlgorithm']['algorithm'])
+        self.assertEqual(rfc5652.id_data, cd['encapContentInfo']['eContentType'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc3279.py b/tests/test_rfc3279.py
index 2a97f31..210a2e9 100644
--- a/tests/test_rfc3279.py
+++ b/tests/test_rfc3279.py
@@ -9,8 +9,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import univ
 
 from pyasn1_modules import pem
@@ -54,36 +54,41 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.rsa_cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         spki_a = asn1Object['tbsCertificate']['subjectPublicKeyInfo']['algorithm']
-        assert spki_a['algorithm'] == rfc3279.rsaEncryption
+
+        self.assertEqual(rfc3279.rsaEncryption, spki_a['algorithm'])
 
         spki_pk = asn1Object['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey'].asOctets()
-        pk, rest = der_decode(spki_pk, asn1Spec=rfc3279.RSAPublicKey())
-        assert not rest
-        assert pk.prettyPrint()
-        assert der_encode(pk) == spki_pk
-        assert pk['publicExponent'] == 65537
+        pk, rest = der_decoder(spki_pk, asn1Spec=rfc3279.RSAPublicKey())
 
-        assert asn1Object['tbsCertificate']['signature']['algorithm'] == rfc3279.sha1WithRSAEncryption
-        assert asn1Object['signatureAlgorithm']['algorithm'] == rfc3279.sha1WithRSAEncryption
+        self.assertFalse(rest)
+        self.assertTrue(pk.prettyPrint())
+        self.assertEqual(spki_pk, der_encoder(pk))
+        self.assertEqual(65537, pk['publicExponent'])
+        self.assertEqual(rfc3279.sha1WithRSAEncryption,
+                         asn1Object['tbsCertificate']['signature']['algorithm'])
+        self.assertEqual(rfc3279.sha1WithRSAEncryption,
+                         asn1Object['signatureAlgorithm']['algorithm'])
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.rsa_cert_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         spki_a = asn1Object['tbsCertificate']['subjectPublicKeyInfo']['algorithm']
-        assert spki_a['algorithm'] == rfc3279.rsaEncryption
-        assert spki_a['parameters'] == univ.Null("")
+
+        self.assertEqual(rfc3279.rsaEncryption, spki_a['algorithm'])
+        self.assertEqual(univ.Null(""), spki_a['parameters'])
 
 
 class ECCertificateTestCase(unittest.TestCase):
@@ -115,34 +120,38 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.ec_cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         spki_a = asn1Object['tbsCertificate']['subjectPublicKeyInfo']['algorithm']
-        assert spki_a['algorithm'] == rfc3279.id_ecPublicKey
 
-        spki_a_p, rest = der_decode(spki_a['parameters'],
-            asn1Spec=rfc3279.EcpkParameters())
-        assert not rest
-        assert spki_a_p.prettyPrint()
-        assert der_encode(spki_a_p) == spki_a['parameters']
-        assert spki_a_p['namedCurve'] == univ.ObjectIdentifier('1.3.132.0.34')
+        self.assertEqual(rfc3279.id_ecPublicKey, spki_a['algorithm'])
+
+        spki_a_p, rest = der_decoder(
+            spki_a['parameters'], asn1Spec=rfc3279.EcpkParameters())
+
+        self.assertFalse(rest)
+        self.assertTrue(spki_a_p.prettyPrint())
+        self.assertEqual(spki_a['parameters'], der_encoder(spki_a_p))
+        self.assertEqual(univ.ObjectIdentifier('1.3.132.0.34'), spki_a_p['namedCurve'])
 
     def testOpenTypes(self):
-        asn1Spec = rfc5280.Certificate()
         substrate = pem.readBase64fromText(self.ec_cert_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         spki_a = asn1Object['tbsCertificate']['subjectPublicKeyInfo']['algorithm']
-        assert spki_a['algorithm'] == rfc3279.id_ecPublicKey
-        assert spki_a['parameters']['namedCurve'] == univ.ObjectIdentifier('1.3.132.0.34')
+
+        self.assertEqual(rfc3279.id_ecPublicKey, spki_a['algorithm'])
+        self.assertEqual(
+            univ.ObjectIdentifier('1.3.132.0.34'), spki_a['parameters']['namedCurve'])
 
 
 class DSACertificateTestCase(unittest.TestCase):
@@ -174,43 +183,51 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.dsa_cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         spki_a = asn1Object['tbsCertificate']['subjectPublicKeyInfo']['algorithm']
-        assert spki_a['algorithm'] == rfc3279.id_dsa
 
-        spki_a_p, rest = der_decode(spki_a['parameters'],
-            asn1Spec=rfc3279.Dss_Parms())
-        assert not rest
-        assert spki_a_p.prettyPrint()
-        assert der_encode(spki_a_p) == spki_a['parameters']
+        self.assertEqual(rfc3279.id_dsa, spki_a['algorithm'])
+
+        spki_a_p, rest = der_decoder(spki_a['parameters'],
+                                     asn1Spec=rfc3279.Dss_Parms())
+        self.assertFalse(rest)
+        self.assertTrue(spki_a_p.prettyPrint())
+        self.assertEqual(spki_a['parameters'], der_encoder(spki_a_p))
+
         q_value = 1260916123897116834511257683105158021801897369967
-        assert spki_a_p['q'] == q_value
 
-        sig_value, rest = der_decode(asn1Object['signature'].asOctets(),
-            asn1Spec=rfc3279.Dss_Sig_Value())
-        assert not rest
-        assert sig_value.prettyPrint()
-        assert der_encode(sig_value) == asn1Object['signature'].asOctets()
-        assert sig_value['r'].hasValue()
-        assert sig_value['s'].hasValue()
+        self.assertEqual(q_value, spki_a_p['q'])
+
+        sig_value, rest = der_decoder(
+            asn1Object['signature'].asOctets(), asn1Spec=rfc3279.Dss_Sig_Value())
+
+        self.assertFalse(rest)
+        self.assertTrue(sig_value.prettyPrint())
+        self.assertEqual(asn1Object['signature'].asOctets(), der_encoder(sig_value))
+        self.assertTrue(sig_value['r'].hasValue())
+        self.assertTrue(sig_value['s'].hasValue())
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.dsa_cert_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         spki_a = asn1Object['tbsCertificate']['subjectPublicKeyInfo']['algorithm']
-        assert spki_a['algorithm'] == rfc3279.id_dsa
+
+        self.assertEqual(rfc3279.id_dsa, spki_a['algorithm'])
+
         q_value = 1260916123897116834511257683105158021801897369967
-        assert spki_a['parameters']['q'] == q_value
+
+        self.assertEqual(q_value, spki_a['parameters']['q'])
 
 
 class KEACertificateTestCase(unittest.TestCase):
@@ -235,49 +252,56 @@
         self.asn1Spec = rfc5280.Certificate()
 
     def testDerCodec(self):
-        asn1Spec = rfc5280.Certificate()
         substrate = pem.readBase64fromText(self.kea_cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         spki_a = asn1Object['tbsCertificate']['subjectPublicKeyInfo']['algorithm']
-        assert spki_a['algorithm'] == rfc3279.id_keyExchangeAlgorithm
 
-        spki_a_p, rest = der_decode(spki_a['parameters'],
-            asn1Spec=rfc3279.KEA_Parms_Id())
-        assert not rest
-        assert spki_a_p.prettyPrint()
-        assert der_encode(spki_a_p) == spki_a['parameters']
-        assert spki_a_p == univ.OctetString(hexValue='5cf8f127e6569d6d88b3')
+        self.assertEqual(rfc3279.id_keyExchangeAlgorithm, spki_a['algorithm'])
 
-        assert asn1Object['tbsCertificate']['signature']['algorithm'] == rfc3279.id_dsa_with_sha1
-        assert asn1Object['signatureAlgorithm']['algorithm'] == rfc3279.id_dsa_with_sha1
+        spki_a_p, rest = der_decoder(spki_a['parameters'],
+                                     asn1Spec=rfc3279.KEA_Parms_Id())
+        self.assertFalse(rest)
+        self.assertTrue(spki_a_p.prettyPrint())
 
-        sig_value, rest = der_decode(asn1Object['signature'].asOctets(),
-            asn1Spec=rfc3279.Dss_Sig_Value())
-        assert not rest
-        assert sig_value.prettyPrint()
-        assert der_encode(sig_value) == asn1Object['signature'].asOctets()
-        assert sig_value['r'].hasValue()
-        assert sig_value['s'].hasValue()
+        self.assertEqual(spki_a['parameters'], der_encoder(spki_a_p))
+        self.assertEqual(univ.OctetString(hexValue='5cf8f127e6569d6d88b3'), spki_a_p)
+        self.assertEqual(
+            rfc3279.id_dsa_with_sha1, asn1Object['tbsCertificate']['signature']['algorithm'])
+        self.assertEqual(
+            rfc3279.id_dsa_with_sha1, asn1Object['signatureAlgorithm']['algorithm'])
+
+        sig_value, rest = der_decoder(asn1Object['signature'].asOctets(),
+                                      asn1Spec=rfc3279.Dss_Sig_Value())
+        self.assertFalse(rest)
+        self.assertTrue(sig_value.prettyPrint())
+        self.assertEqual(asn1Object['signature'].asOctets(), der_encoder(sig_value))
+        self.assertTrue(sig_value['r'].hasValue())
+        self.assertTrue(sig_value['s'].hasValue())
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.kea_cert_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         spki_a = asn1Object['tbsCertificate']['subjectPublicKeyInfo']['algorithm']
-        assert spki_a['algorithm'] == rfc3279.id_keyExchangeAlgorithm
-        assert spki_a['parameters'] == univ.OctetString(hexValue='5cf8f127e6569d6d88b3')
 
-        assert asn1Object['tbsCertificate']['signature']['algorithm'] == rfc3279.id_dsa_with_sha1
-        assert asn1Object['signatureAlgorithm']['algorithm'] == rfc3279.id_dsa_with_sha1
+        self.assertEqual(rfc3279.id_keyExchangeAlgorithm, spki_a['algorithm'])
+        self.assertEqual(
+            univ.OctetString(hexValue='5cf8f127e6569d6d88b3'), spki_a['parameters'])
+
+        self.assertEqual(rfc3279.id_dsa_with_sha1,
+                         asn1Object['tbsCertificate']['signature']['algorithm'])
+        self.assertEqual(
+            rfc3279.id_dsa_with_sha1, asn1Object['signatureAlgorithm']['algorithm'])
 
 
 class DHCertificateTestCase(unittest.TestCase):
@@ -315,35 +339,44 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.dh_cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         spki_a = asn1Object['tbsCertificate']['subjectPublicKeyInfo']['algorithm']
-        assert spki_a['algorithm'] == rfc3279.dhpublicnumber
 
-        spki_a_p, rest = der_decode(spki_a['parameters'],
-            asn1Spec=rfc3279.DomainParameters())
-        assert not rest
-        assert spki_a_p.prettyPrint()
-        assert der_encode(spki_a_p) == spki_a['parameters']
+        self.assertEqual(rfc3279.dhpublicnumber, spki_a['algorithm'])
+
+        spki_a_p, rest = der_decoder(
+            spki_a['parameters'], asn1Spec=rfc3279.DomainParameters())
+
+        self.assertFalse(rest)
+        self.assertTrue(spki_a_p.prettyPrint())
+        self.assertEqual(spki_a['parameters'], der_encoder(spki_a_p))
+
         q_value = 65838278260281264030127352144753816831178774189428428256716126077244217603537
-        assert spki_a_p['q'] == q_value
+
+        self.assertEqual(q_value, spki_a_p['q'])
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.dh_cert_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate,
+                                       asn1Spec=self.asn1Spec,
+                                       decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         spki_a = asn1Object['tbsCertificate']['subjectPublicKeyInfo']['algorithm']
-        assert spki_a['algorithm'] == rfc3279.dhpublicnumber
+
+        self.assertEqual(rfc3279.dhpublicnumber, spki_a['algorithm'])
+
         q_value = 65838278260281264030127352144753816831178774189428428256716126077244217603537
-        assert spki_a['parameters']['q'] == q_value
+
+        self.assertEqual(q_value, spki_a['parameters']['q'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc3280.py b/tests/test_rfc3280.py
index f314bf7..3031335 100644
--- a/tests/test_rfc3280.py
+++ b/tests/test_rfc3280.py
@@ -9,8 +9,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc3280
@@ -41,10 +41,11 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 class CertificateListTestCase(unittest.TestCase):
@@ -64,10 +65,11 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc3281.py b/tests/test_rfc3281.py
index d32e2ef..f03316f 100644
--- a/tests/test_rfc3281.py
+++ b/tests/test_rfc3281.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc3281
@@ -41,12 +41,12 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['acinfo']['version'] == 1
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(1, asn1Object['acinfo']['version'])
 
         attributeMap = {
             rfc3281.id_at_role: rfc3281.RoleSyntax(),
@@ -57,16 +57,20 @@
         }
 
         count = 0
+
         for attr in asn1Object['acinfo']['attributes']:
-            assert attr['type'] in attributeMap
-            av, rest = der_decode(attr['values'][0],
-                asn1Spec=attributeMap[attr['type']])
-            assert not rest
-            assert av.prettyPrint()
-            assert der_encode(av) == attr['values'][0]
+            self.assertIn(attr['type'], attributeMap)
+
+            av, rest = der_decoder(
+                attr['values'][0], asn1Spec=attributeMap[attr['type']])
+
+            self.assertFalse(rest)
+            self.assertTrue(av.prettyPrint())
+            self.assertEqual(attr['values'][0], der_encoder(av))
+
             count += 1
 
-        assert count == 5
+        self.assertEqual(5, count)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc3447.py b/tests/test_rfc3447.py
index 4cc1120..8788691 100644
--- a/tests/test_rfc3447.py
+++ b/tests/test_rfc3447.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc3447
@@ -52,10 +52,11 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc3560.py b/tests/test_rfc3560.py
index 400e4de..3419cde 100644
--- a/tests/test_rfc3560.py
+++ b/tests/test_rfc3560.py
@@ -25,11 +25,10 @@
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.oaep_default_pem_text)
         asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object[0] == rfc3560.id_RSAES_OAEP
-        assert der_encoder.encode(asn1Object) == substrate
-        assert substrate == der_encoder.encode(asn1Object)
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(rfc3560.id_RSAES_OAEP, asn1Object[0])
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
 
 class OAEPSHA256TestCase(unittest.TestCase):
@@ -41,11 +40,10 @@
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.oaep_sha256_pem_text)
         asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object[0] == rfc3560.id_RSAES_OAEP
-        assert der_encoder.encode(asn1Object) == substrate
-        assert substrate == der_encoder.encode(asn1Object)
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(rfc3560.id_RSAES_OAEP, asn1Object[0])
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
 
 class OAEPFullTestCase(unittest.TestCase):
@@ -57,11 +55,10 @@
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.oaep_full_pem_text)
         asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object[0] == rfc3560.id_RSAES_OAEP
-        assert der_encoder.encode(asn1Object) == substrate
-        assert substrate == der_encoder.encode(asn1Object)
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(rfc3560.id_RSAES_OAEP, asn1Object[0])
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc3565.py b/tests/test_rfc3565.py
index 0cc053f..58574ec 100644
--- a/tests/test_rfc3565.py
+++ b/tests/test_rfc3565.py
@@ -25,10 +25,10 @@
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.kw_alg_id_pem_text)
         asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object[0] == rfc3565.id_aes256_wrap
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(rfc3565.id_aes256_wrap, asn1Object[0])
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
 
 class AESCBCTestCase(unittest.TestCase):
@@ -40,23 +40,26 @@
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.aes_alg_id_pem_text)
         asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object[0] == rfc3565.id_aes256_CBC
-        assert asn1Object[1].isValue
-        assert der_encoder.encode(asn1Object) == substrate
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(rfc3565.id_aes256_CBC, asn1Object[0])
+        self.assertTrue(asn1Object[1].isValue)
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.aes_alg_id_pem_text)
         asn1Object, rest = der_decoder.decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object[0] == rfc3565.id_aes256_CBC
+            asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(rfc3565.id_aes256_CBC, asn1Object[0])
+
         aes_iv = univ.OctetString(hexValue='108996ba850e3f0339993bb5878a0e37')
-        assert asn1Object[1] == aes_iv
-        assert der_encoder.encode(asn1Object) == substrate
+
+        self.assertEqual(aes_iv, asn1Object[1])
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc3709.py b/tests/test_rfc3709.py
index 274c941..dcab4b6 100644
--- a/tests/test_rfc3709.py
+++ b/tests/test_rfc3709.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -40,39 +40,49 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        extn_list = [ ]
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        extn_list = []
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             extn_list.append(extn['extnID'])
 
             if extn['extnID'] == rfc3709.id_pe_logotype:
                 s = extn['extnValue']
-                logotype, rest = der_decode(s, rfc3709.LogotypeExtn())
-                assert not rest
-                assert logotype.prettyPrint()
-                assert der_encode(logotype) == s
-                ids = logotype['subjectLogo']['direct']['image'][0]['imageDetails']
-                assert ids['mediaType'] == "image/png"
-                assert ids['logotypeURI'][0] == "http://www.vigilsec.com/vigilsec_logo.png"
+                logotype, rest = der_decoder(s, rfc3709.LogotypeExtn())
 
-        assert rfc3709.id_pe_logotype in extn_list
+                self.assertFalse(rest)
+                self.assertTrue(logotype.prettyPrint())
+                self.assertEqual(s, der_encoder(logotype))
+
+                ids = logotype['subjectLogo']['direct']['image'][0]['imageDetails']
+
+                self.assertEqual( "image/png", ids['mediaType'])
+
+                expected = "http://www.vigilsec.com/vigilsec_logo.png"
+                self.assertEqual(expected, ids['logotypeURI'][0])
+
+        self.assertIn(rfc3709.id_pe_logotype, extn_list)
 
     def testExtensionsMap(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] in rfc5280.certificateExtensionsMap.keys():
-                extnValue, rest = der_decode(extn['extnValue'],
+                extnValue, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert der_encode(extnValue) == extn['extnValue']
+
+                self.assertEqual(extn['extnValue'], der_encoder(extnValue))
 
 
 class CertificateExtnWithDataTestCase(unittest.TestCase):
@@ -133,39 +143,48 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        extn_list = [ ]
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        extn_list = []
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             extn_list.append(extn['extnID'])
 
             if extn['extnID'] == rfc3709.id_pe_logotype:
                 s = extn['extnValue']
-                logotype, rest = der_decode(s, rfc3709.LogotypeExtn())
-                assert not rest
-                assert logotype.prettyPrint()
-                assert der_encode(logotype) == s
-                ids = logotype['subjectLogo']['direct']['image'][0]['imageDetails']
-                assert ids['mediaType'] == "image/svg+xml"
-                assert ids['logotypeURI'][0][0:25] == "data:image/svg+xml;base64"
+                logotype, rest = der_decoder(s, rfc3709.LogotypeExtn())
+                self.assertFalse(rest)
 
-        assert rfc3709.id_pe_logotype in extn_list
+                self.assertTrue(logotype.prettyPrint())
+                self.assertEqual(s, der_encoder(logotype))
+
+                ids = logotype['subjectLogo']['direct']['image'][0]['imageDetails']
+
+                self.assertEqual("image/svg+xml", ids['mediaType'])
+                self.assertEqual(
+                    "data:image/svg+xml;base64", ids['logotypeURI'][0][0:25])
+
+        self.assertIn(rfc3709.id_pe_logotype, extn_list)
 
     def testExtensionsMap(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] in rfc5280.certificateExtensionsMap.keys():
-                extnValue, rest = der_decode(extn['extnValue'],
+                extnValue, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert der_encode(extnValue) == extn['extnValue']
+
+                self.assertEqual(extn['extnValue'], der_encoder(extnValue))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc3770.py b/tests/test_rfc3770.py
index 8790ffb..667ab24 100644
--- a/tests/test_rfc3770.py
+++ b/tests/test_rfc3770.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.compat.octets import str2octs
 
 from pyasn1_modules import pem
@@ -42,45 +42,51 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         sig_alg = asn1Object['tbsCertificate']['signature']
-        assert sig_alg['algorithm'] == rfc5480.ecdsa_with_SHA384
-        assert not sig_alg['parameters'].hasValue()
+
+        self.assertEqual(rfc5480.ecdsa_with_SHA384, sig_alg['algorithm'])
+        self.assertFalse(sig_alg['parameters'].hasValue())
     
         spki_alg = asn1Object['tbsCertificate']['subjectPublicKeyInfo']['algorithm']
-        assert spki_alg['algorithm'] == rfc5480.id_ecPublicKey
-        assert spki_alg['parameters']['namedCurve'] == rfc5480.secp384r1
 
-        extn_list = [ ]
+        self.assertEqual(rfc5480.id_ecPublicKey, spki_alg['algorithm'])
+        self.assertEqual(
+            rfc5480.secp384r1, spki_alg['parameters']['namedCurve'])
+
+        extn_list = []
         for extn in asn1Object['tbsCertificate']['extensions']:
             extn_list.append(extn['extnID'])
             if extn['extnID'] in rfc5280.certificateExtensionsMap.keys():
-                extnValue, rest = der_decode(extn['extnValue'],
+                extnValue, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert der_encode(extnValue) == extn['extnValue']
+
+                self.assertEqual(extn['extnValue'], der_encoder(extnValue))
 
                 if extn['extnID'] == rfc3770.id_pe_wlanSSID:
-                    assert str2octs('Example') in extnValue
-            
-                if extn['extnID'] == rfc5280.id_ce_extKeyUsage:
-                     assert rfc3770.id_kp_eapOverLAN in extnValue
-                     assert rfc3770.id_kp_eapOverPPP in extnValue
+                    self.assertIn(str2octs('Example'), extnValue)
 
-        assert rfc3770.id_pe_wlanSSID in extn_list
-        assert rfc5280.id_ce_extKeyUsage in extn_list
+                if extn['extnID'] == rfc5280.id_ce_extKeyUsage:
+                    self.assertIn(rfc3770.id_kp_eapOverLAN, extnValue)
+                    self.assertIn(rfc3770.id_kp_eapOverPPP, extnValue)
+
+        self.assertIn(rfc3770.id_pe_wlanSSID, extn_list)
+        self.assertIn(rfc5280.id_ce_extKeyUsage, extn_list)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc3779.py b/tests/test_rfc3779.py
index bc58b12..652826e 100644
--- a/tests/test_rfc3779.py
+++ b/tests/test_rfc3779.py
@@ -50,46 +50,45 @@
 
         asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
-        extn_list = [ ]
+        extn_list = []
         for extn in asn1Object['tbsCertificate']['extensions']:
             extn_list.append(extn['extnID'])
 
             if extn['extnID'] == rfc3779.id_pe_ipAddrBlocks:
                 s = extn['extnValue']
                 addr_blocks, rest = der_decoder.decode(s, rfc3779.IPAddrBlocks())
-                assert not rest
-                assert addr_blocks.prettyPrint()
-                assert der_encoder.encode(addr_blocks) == s
+                self.assertFalse(rest)
+                self.assertTrue(addr_blocks.prettyPrint())
+                self.assertEqual(s, der_encoder.encode(addr_blocks))
 
             if extn['extnID'] == rfc3779.id_pe_autonomousSysIds:
                 s = extn['extnValue']
                 as_ids, rest = der_decoder.decode(s, rfc3779.ASIdentifiers())
-                assert not rest
-                assert as_ids.prettyPrint()
-                assert der_encoder.encode(as_ids) == s
+                self.assertFalse(rest)
+                self.assertTrue(as_ids.prettyPrint())
+                self.assertEqual(s, der_encoder.encode(as_ids))
 
-        assert rfc3779.id_pe_ipAddrBlocks in extn_list
-        assert rfc3779.id_pe_autonomousSysIds in extn_list
-
+        self.assertIn(rfc3779.id_pe_ipAddrBlocks, extn_list)
+        self.assertIn(rfc3779.id_pe_autonomousSysIds, extn_list)
 
     def testExtensionsMap(self):
         substrate = pem.readBase64fromText(self.pem_text)
         asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
         for extn in asn1Object['tbsCertificate']['extensions']:
-            if extn['extnID'] == rfc3779.id_pe_ipAddrBlocks or \
-               extn['extnID'] == rfc3779.id_pe_autonomousSysIds:
-
-                extnValue, rest = der_decoder.decode(extn['extnValue'],
+            if (extn['extnID'] == rfc3779.id_pe_ipAddrBlocks or
+                    extn['extnID'] == rfc3779.id_pe_autonomousSysIds):
+                extnValue, rest = der_decoder.decode(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert der_encoder.encode(extnValue) == extn['extnValue']
+                self.assertEqual(extn['extnValue'], der_encoder.encode(extnValue))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc3852.py b/tests/test_rfc3852.py
index 78d71b2..56b25cc 100644
--- a/tests/test_rfc3852.py
+++ b/tests/test_rfc3852.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import univ
 
 from pyasn1_modules import pem
@@ -71,48 +71,54 @@
             univ.ObjectIdentifier('1.2.840.113549.1.1.11'),
         )
 
-        encoded_null = der_encode(univ.Null(""))
+        encoded_null = der_encoder(univ.Null(""))
 
         next_layer = rfc3852.id_ct_contentInfo
 
         count = 0
+
         while next_layer:
-            asn1Object, rest = der_decode(substrate, asn1Spec=layers[next_layer])
-            assert not rest
-            assert asn1Object.prettyPrint()
-            assert der_encode(asn1Object) == substrate
+            asn1Object, rest = der_decoder(substrate, asn1Spec=layers[next_layer])
+
+            self.assertFalse(rest)
+            self.assertTrue(asn1Object.prettyPrint())
+            self.assertEqual(substrate, der_encoder(asn1Object))
     
             if next_layer == rfc3852.id_signedData:
-               for d in asn1Object['digestAlgorithms']:
-                   assert d['algorithm'] in alg_oids
-                   assert d['parameters'] == encoded_null
-                   count += 1
+                for d in asn1Object['digestAlgorithms']:
+                    self.assertIn(d['algorithm'], alg_oids)
+                    self.assertEqual(encoded_null, d['parameters'])
+                    count += 1
 
-               for si in asn1Object['signerInfos']:
-                   assert si['digestAlgorithm']['algorithm'] in alg_oids
-                   assert si['digestAlgorithm']['parameters'] == encoded_null
-                   count += 1
+                for si in asn1Object['signerInfos']:
+                    self.assertIn(si['digestAlgorithm']['algorithm'], alg_oids)
+                    self.assertEqual(
+                        encoded_null, si['digestAlgorithm']['parameters'])
+                    count += 1
 
-                   assert si['signatureAlgorithm']['algorithm'] in alg_oids
-                   assert si['signatureAlgorithm']['parameters'] == encoded_null
-                   count += 1
+                    self.assertIn(si['signatureAlgorithm']['algorithm'], alg_oids)
+                    self.assertEqual(
+                        encoded_null, si['signatureAlgorithm']['parameters'])
+                    count += 1
 
             if next_layer == rfc6402.id_cct_PKIData:
                 for req in asn1Object['reqSequence']:
                     cr = req['tcr']['certificationRequest']
-                    assert cr['signatureAlgorithm']['algorithm'] in alg_oids
-                    assert cr['signatureAlgorithm']['parameters'] == encoded_null
+                    self.assertIn(cr['signatureAlgorithm']['algorithm'], alg_oids)
+                    self.assertEqual(
+                        encoded_null, cr['signatureAlgorithm']['parameters'])
                     count += 1
 
                     cri_spki = cr['certificationRequestInfo']['subjectPublicKeyInfo']
-                    assert cri_spki['algorithm']['algorithm'] in alg_oids
-                    assert cri_spki['algorithm']['parameters'] == encoded_null
+                    self.assertIn(cri_spki['algorithm']['algorithm'], alg_oids)
+                    self.assertEqual(
+                        encoded_null, cri_spki['algorithm']['parameters'])
                     count += 1
 
             substrate = getNextSubstrate[next_layer](asn1Object)
             next_layer = getNextLayer[next_layer](asn1Object)
 
-        assert count == 5
+        self.assertEqual(5, count)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc4043.py b/tests/test_rfc4043.py
index a4aeda7..0ab72dd 100644
--- a/tests/test_rfc4043.py
+++ b/tests/test_rfc4043.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import univ
 
 from pyasn1_modules import pem
@@ -43,10 +43,11 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         perm_id_oid = rfc4043.id_on_permanentIdentifier
         assigner_oid = univ.ObjectIdentifier('1.3.6.1.4.1.22112.48')
@@ -54,33 +55,37 @@
 
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_ce_subjectAltName:
-                extnValue, rest = der_decode(extn['extnValue'],
-                    asn1Spec=rfc5280.SubjectAltName())
-                assert not rest
-                assert extnValue.prettyPrint()
-                assert der_encode(extnValue) == extn['extnValue']
+                extnValue, rest = der_decoder(
+                    extn['extnValue'], asn1Spec=rfc5280.SubjectAltName())
+
+                self.assertFalse(rest)
+                self.assertTrue(extnValue.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(extnValue))
 
                 for gn in extnValue:
                     if gn['otherName'].hasValue():
-                        assert gn['otherName']['type-id'] == perm_id_oid
-                        onValue, rest = der_decode(gn['otherName']['value'],
+                        self.assertEqual(perm_id_oid, gn['otherName']['type-id'])
+
+                        onValue, rest = der_decoder(
+                            gn['otherName']['value'],
                             asn1Spec=rfc4043.PermanentIdentifier())
-                        assert not rest
-                        assert onValue.prettyPrint()
-                        assert der_encode(onValue) == gn['otherName']['value']
-                        assert onValue['assigner'] == assigner_oid
+
+                        self.assertFalse(rest)
+                        self.assertTrue(onValue.prettyPrint())
+                        self.assertEqual(gn['otherName']['value'], der_encoder(onValue))
+                        self.assertEqual(assigner_oid, onValue['assigner'])
                         permanent_identifier_found = True
 
-        assert permanent_identifier_found
+        self.assertTrue(permanent_identifier_found)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         perm_id_oid = rfc4043.id_on_permanentIdentifier
         assigner_oid = univ.ObjectIdentifier('1.3.6.1.4.1.22112.48')
@@ -88,21 +93,22 @@
 
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_ce_subjectAltName:
-                extnValue, rest = der_decode(extn['extnValue'],
-                    asn1Spec=rfc5280.SubjectAltName(),
+                extnValue, rest = der_decoder(
+                    extn['extnValue'], asn1Spec=rfc5280.SubjectAltName(),
                     decodeOpenTypes=True)
-                assert not rest
-                assert extnValue.prettyPrint()
-                assert der_encode(extnValue) == extn['extnValue']
+
+                self.assertFalse(rest)
+                self.assertTrue(extnValue.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(extnValue))
 
                 for gn in extnValue:
                     if gn['otherName'].hasValue():
                         on = gn['otherName']
-                        assert on['type-id'] == perm_id_oid
-                        assert on['value']['assigner'] == assigner_oid
+                        self.assertEqual(perm_id_oid, on['type-id'])
+                        self.assertEqual(assigner_oid, on['value']['assigner'])
                         permanent_identifier_found = True
 
-        assert permanent_identifier_found
+        self.assertTrue(permanent_identifier_found)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc4055.py b/tests/test_rfc4055.py
index f6099e4..cf0b376 100755
--- a/tests/test_rfc4055.py
+++ b/tests/test_rfc4055.py
@@ -26,48 +26,52 @@
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pss_default_pem_text)
         asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object[0] == rfc4055.id_RSASSA_PSS
-        assert der_encoder.encode(asn1Object) == substrate
-        assert substrate == der_encoder.encode(asn1Object)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertTrue(rfc4055.id_RSASSA_PSS, asn1Object[0])
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.pss_default_pem_text)
         asn1Object, rest = der_decoder.decode(substrate,
                                               asn1Spec=self.asn1Spec,
                                               decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
-        assert not asn1Object['parameters'].hasValue()
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
+        self.assertFalse(asn1Object['parameters'].hasValue())
 
 
 class PSSSHA512TestCase(unittest.TestCase):
-    pss_sha512_pem_text = "MDwGCSqGSIb3DQEBCjAvoA8wDQYJYIZIAWUDBAIDBQChHDAaBgkqhkiG9w0BAQgwDQYJYIZIAWUDBAIDBQA="
+    pss_sha512_pem_text = "MDwGCSqGSIb3DQEBCjAvoA8wDQYJYIZIAWUDBAIDBQChHDAaBg" \
+                          "kqhkiG9w0BAQgwDQYJYIZIAWUDBAIDBQA="
 
     def setUp(self):
         self.asn1Spec = rfc5280.AlgorithmIdentifier()
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pss_sha512_pem_text)
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object[0] == rfc4055.id_RSASSA_PSS
-        assert der_encoder.encode(asn1Object) == substrate
-        assert substrate == der_encoder.encode(asn1Object)
+        asn1Object, rest = der_decoder.decode(
+            substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertTrue(rfc4055.id_RSASSA_PSS, asn1Object[0])
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.pss_sha512_pem_text)
-        asn1Object, rest = der_decoder.decode(substrate,
-                                              asn1Spec=self.asn1Spec,
-                                              decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
-        assert asn1Object['parameters'].hasValue()
-        assert asn1Object['parameters']['saltLength'] == 20
+        asn1Object, rest = der_decoder.decode(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
+        self.assertTrue(asn1Object['parameters'].hasValue())
+        self.assertTrue(20, asn1Object['parameters']['saltLength'])
 
 
 class OAEPDefautTestCase(unittest.TestCase):
@@ -79,25 +83,26 @@
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.oaep_default_pem_text)
         asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object[0] == rfc4055.id_RSAES_OAEP
-        assert der_encoder.encode(asn1Object) == substrate
-        assert substrate == der_encoder.encode(asn1Object)
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertTrue(rfc4055.id_RSAES_OAEP, asn1Object[0])
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.oaep_default_pem_text)
-        asn1Object, rest = der_decoder.decode(substrate,
-                                              asn1Spec=self.asn1Spec,
-                                              decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
-        assert not asn1Object['parameters'].hasValue()
+        asn1Object, rest = der_decoder.decode(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
+        self.assertFalse(asn1Object['parameters'].hasValue())
 
 
 class OAEPSHA256TestCase(unittest.TestCase):
-    oaep_sha256_pem_text = "MDwGCSqGSIb3DQEBBzAvoA8wDQYJYIZIAWUDBAIBBQChHDAaBgkqhkiG9w0BAQgwDQYJYIZIAWUDBAIBBQA="
+    oaep_sha256_pem_text = "MDwGCSqGSIb3DQEBBzAvoA8wDQYJYIZIAWUDBAIBBQChHDAaB" \
+                           "gkqhkiG9w0BAQgwDQYJYIZIAWUDBAIBBQA="
 
     def setUp(self):
         self.asn1Spec = rfc5280.AlgorithmIdentifier()
@@ -105,28 +110,33 @@
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.oaep_sha256_pem_text)
         asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object[0] == rfc4055.id_RSAES_OAEP
-        assert der_encoder.encode(asn1Object) == substrate
-        assert substrate == der_encoder.encode(asn1Object)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertTrue(rfc4055.id_RSAES_OAEP, asn1Object[0])
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.oaep_sha256_pem_text)
-        asn1Object, rest = der_decoder.decode(substrate,
-                                              asn1Spec=self.asn1Spec,
-                                              decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
-        assert asn1Object['parameters'].hasValue()
+        asn1Object, rest = der_decoder.decode(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
+        self.assertTrue(asn1Object['parameters'].hasValue())
+
         oaep_p = asn1Object['parameters']
-        assert oaep_p['hashFunc']['parameters'] == univ.Null("")
-        assert oaep_p['maskGenFunc']['parameters']['parameters'] == univ.Null("")
+
+        self.assertEqual(univ.Null(""), oaep_p['hashFunc']['parameters'])
+        self.assertEqual(univ.Null(""), oaep_p['maskGenFunc']['parameters']['parameters'])
 
 
 class OAEPFullTestCase(unittest.TestCase):
-    oaep_full_pem_text = "MFMGCSqGSIb3DQEBBzBGoA8wDQYJYIZIAWUDBAICBQChHDAaBgkqhkiG9w0BAQgwDQYJYIZIAWUDBAICBQCiFTATBgkqhkiG9w0BAQkEBmZvb2Jhcg=="
+    oaep_full_pem_text = "MFMGCSqGSIb3DQEBBzBGoA8wDQYJYIZIAWUDBAICBQChHDAaBgk" \
+                         "qhkiG9w0BAQgwDQYJYIZIAWUDBAICBQCiFTATBgkqhkiG9w0BAQ" \
+                         "kEBmZvb2Jhcg=="
 
     def setUp(self):
         self.asn1Spec = rfc5280.AlgorithmIdentifier()
@@ -134,25 +144,34 @@
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.oaep_full_pem_text)
         asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object[0] == rfc4055.id_RSAES_OAEP
-        assert der_encoder.encode(asn1Object) == substrate
-        assert substrate == der_encoder.encode(asn1Object)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+
+        self.assertTrue(rfc4055.id_RSAES_OAEP, asn1Object[0])
+
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.oaep_full_pem_text)
         asn1Object, rest = der_decoder.decode(substrate,
                                               asn1Spec=self.asn1Spec,
                                               decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
-        assert asn1Object['parameters'].hasValue()
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
+
+        self.assertTrue(asn1Object['parameters'].hasValue())
+
         oaep_p = asn1Object['parameters']
-        assert oaep_p['hashFunc']['parameters'] == univ.Null("")
-        assert oaep_p['maskGenFunc']['parameters']['parameters'] == univ.Null("")
-        assert oaep_p['pSourceFunc']['parameters'] == univ.OctetString(value='foobar')
+
+        self.assertEqual(univ.Null(""), oaep_p['hashFunc']['parameters'])
+        self.assertEqual(
+            univ.Null(""), oaep_p['maskGenFunc']['parameters']['parameters'])
+        self.assertEqual(
+            univ.OctetString(value='foobar'),
+            oaep_p['pSourceFunc']['parameters'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc4073.py b/tests/test_rfc4073.py
index 1b17c5d..4bd5e5f 100644
--- a/tests/test_rfc4073.py
+++ b/tests/test_rfc4073.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.compat.octets import str2octs
 
 from pyasn1_modules import pem
@@ -66,14 +66,14 @@
     def testDerCodec(self):
 
         def test_layer(substrate, content_type):
-            asn1Object, rest = der_decode(substrate, asn1Spec=layers[content_type])
-            assert not rest
-            assert asn1Object.prettyPrint()
-            assert der_encode(asn1Object) == substrate
+            asn1Object, rest = der_decoder(substrate, asn1Spec=layers[content_type])
+            self.assertFalse(rest)
+            self.assertTrue(asn1Object.prettyPrint())
+            self.assertEqual(substrate, der_encoder(asn1Object))
 
             if content_type == rfc4073.id_ct_contentWithAttrs:
                 for attr in asn1Object['attrs']:
-                    assert attr['attrType'] in rfc5652.cmsAttributesMap.keys()
+                    self.assertIn(attr['attrType'], rfc5652.cmsAttributesMap)
     
             return asn1Object
 
@@ -96,6 +96,7 @@
         substrate = pem.readBase64fromText(self.pem_text)
 
         this_layer = rfc5652.id_ct_contentInfo
+
         while this_layer != rfc5652.id_data:
             if this_layer == rfc4073.id_ct_contentCollection:
                 asn1Object = test_layer(substrate, this_layer)
@@ -113,30 +114,33 @@
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=rfc5652.ContentInfo(),
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate,
+                                       asn1Spec=rfc5652.ContentInfo(),
+                                       decodeOpenTypes=True)
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
-        assert asn1Object['contentType'] == rfc4073.id_ct_contentCollection
+        self.assertEqual(rfc4073.id_ct_contentCollection, asn1Object['contentType'])
+
         for ci in asn1Object['content']:
-            assert ci['contentType'] in rfc5652.cmsContentTypesMap.keys()
-            assert ci['contentType'] == rfc4073.id_ct_contentWithAttrs
+            self.assertIn(ci['contentType'], rfc5652.cmsContentTypesMap)
+            self.assertEqual(rfc4073.id_ct_contentWithAttrs, ci['contentType'])
+
             next_ci = ci['content']['content']
-            assert next_ci['contentType'] in rfc5652.cmsContentTypesMap.keys()
-            assert next_ci['contentType'] == rfc5652.id_data
-            assert str2octs('Content-Type: text') in next_ci['content']
+
+            self.assertIn(next_ci['contentType'], rfc5652.cmsContentTypesMap)
+            self.assertEqual(rfc5652.id_data, next_ci['contentType'])
+            self.assertIn(str2octs('Content-Type: text'), next_ci['content'])
 
             for attr in ci['content']['attrs']:
-                assert attr['attrType'] in rfc5652.cmsAttributesMap.keys()
+                self.assertIn(attr['attrType'], rfc5652.cmsAttributesMap)
                 if attr['attrType'] == rfc2634.id_aa_contentHint:
-                    assert 'RFC 4073' in attr['attrValues'][0]['contentDescription']
+                    self.assertIn('RFC 4073', attr['attrValues'][0]['contentDescription'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
 
 if __name__ == '__main__':
     result = unittest.TextTestRunner(verbosity=2).run(suite)
-    sys.exit(not result.wasSuccessful())
\ No newline at end of file
+    sys.exit(not result.wasSuccessful())
diff --git a/tests/test_rfc4108.py b/tests/test_rfc4108.py
index e3d5f19..9d71601 100644
--- a/tests/test_rfc4108.py
+++ b/tests/test_rfc4108.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5652
@@ -51,52 +51,59 @@
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
-        assert asn1Object['contentType'] == rfc5652.id_signedData
-        inner, rest = der_decode(asn1Object['content'], asn1Spec=rfc5652.SignedData())
+        self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
 
-        assert inner['encapContentInfo']['eContentType'] == rfc4108.id_ct_firmwarePackage
-        assert inner['encapContentInfo']['eContent']
+        inner, rest = der_decoder(asn1Object['content'], asn1Spec=rfc5652.SignedData())
 
-        attribute_list = [ ]
+        self.assertEqual(
+            rfc4108.id_ct_firmwarePackage, inner['encapContentInfo']['eContentType'])
+
+        self.assertTrue(inner['encapContentInfo']['eContent'])
+
+        attribute_list = []
+
         for attr in inner['signerInfos'][0]['signedAttrs']:
             attribute_list.append(attr['attrType'])
             if attr['attrType'] == rfc4108.id_aa_targetHardwareIDs:
-                av, rest = der_decode(attr['attrValues'][0],
-                    asn1Spec=rfc4108.TargetHardwareIdentifiers())
-                assert len(av) == 2
-                for oid in av:
-                    assert '1.3.6.1.4.1.221121.1.1.' in oid.prettyPrint()
+                av, rest = der_decoder(attr['attrValues'][0],
+                                       asn1Spec=rfc4108.TargetHardwareIdentifiers())
+                self.assertEqual(2, len(av))
 
-        assert rfc5652.id_contentType in attribute_list
-        assert rfc5652.id_messageDigest in attribute_list
-        assert rfc4108.id_aa_targetHardwareIDs in attribute_list
-        assert rfc4108.id_aa_fwPkgMessageDigest in attribute_list
+                for oid in av:
+                    self.assertIn('1.3.6.1.4.1.221121.1.1.', oid.prettyPrint())
+
+        self.assertIn( rfc5652.id_contentType, attribute_list)
+        self.assertIn( rfc5652.id_messageDigest, attribute_list)
+        self.assertIn(rfc4108.id_aa_targetHardwareIDs, attribute_list)
+        self.assertIn(rfc4108.id_aa_fwPkgMessageDigest, attribute_list)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert asn1Object['contentType'] == rfc5652.id_signedData
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        self.assertEqual(asn1Object['contentType'], rfc5652.id_signedData)
+
         sd_eci = asn1Object['content']['encapContentInfo']
-        assert sd_eci['eContentType'] == rfc4108.id_ct_firmwarePackage
-        assert sd_eci['eContent'].hasValue()
+
+        self.assertEqual(sd_eci['eContentType'], rfc4108.id_ct_firmwarePackage)
+        self.assertTrue(sd_eci['eContent'].hasValue())
 
         for attr in asn1Object['content']['signerInfos'][0]['signedAttrs']:
-            assert attr['attrType'] in rfc5652.cmsAttributesMap.keys()
+            self.assertIn(attr['attrType'], rfc5652.cmsAttributesMap)
             if attr['attrType'] == rfc4108.id_aa_targetHardwareIDs:
                for oid in attr['attrValues'][0]:
-                   assert '1.3.6.1.4.1.221121.1.1.' in oid.prettyPrint()
+                   self.assertIn('1.3.6.1.4.1.221121.1.1.', oid.prettyPrint())
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc4210.py b/tests/test_rfc4210.py
index 57321d5..b7e20fb 100644
--- a/tests/test_rfc4210.py
+++ b/tests/test_rfc4210.py
@@ -116,9 +116,9 @@
 
         asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc4211.py b/tests/test_rfc4211.py
index 7d7a44f..e9be4cc 100644
--- a/tests/test_rfc4211.py
+++ b/tests/test_rfc4211.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc4211
@@ -33,17 +33,19 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         count = 0
+
         for crm in asn1Object:
-            assert crm['certReq']['certTemplate']['version'] == 2
+            self.assertEqual(2, crm['certReq']['certTemplate']['version'])
             count += 1
 
-        assert count == 1
+        self.assertEqual(1, count)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc4334.py b/tests/test_rfc4334.py
index 7a1d2b7..9ba5fdf 100644
--- a/tests/test_rfc4334.py
+++ b/tests/test_rfc4334.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.compat.octets import str2octs
 
 from pyasn1_modules import pem
@@ -41,37 +41,40 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        extn_list = [ ]
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        extn_list = []
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             extn_list.append(extn['extnID'])
             if extn['extnID'] in rfc5280.certificateExtensionsMap.keys():
-                extnValue, rest = der_decode(extn['extnValue'],
+                extnValue, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert der_encode(extnValue) == extn['extnValue']
+
+                self.assertEqual(extn['extnValue'], der_encoder(extnValue))
 
                 if extn['extnID'] == rfc4334.id_pe_wlanSSID:
-                    assert str2octs('Example') in extnValue
+                    self.assertIn( str2octs('Example'), extnValue)
             
                 if extn['extnID'] == rfc5280.id_ce_extKeyUsage:
-                     assert rfc4334.id_kp_eapOverLAN in extnValue
-                     assert rfc4334.id_kp_eapOverPPP in extnValue
+                    self.assertIn(rfc4334.id_kp_eapOverLAN, extnValue)
+                    self.assertIn(rfc4334.id_kp_eapOverPPP, extnValue)
 
-        assert rfc4334.id_pe_wlanSSID in extn_list
-        assert rfc5280.id_ce_extKeyUsage in extn_list
+        self.assertIn(rfc4334.id_pe_wlanSSID, extn_list)
+        self.assertIn(rfc5280.id_ce_extKeyUsage, extn_list)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc4387.py b/tests/test_rfc4387.py
index 0f77783..5c12225 100644
--- a/tests/test_rfc4387.py
+++ b/tests/test_rfc4387.py
@@ -7,19 +7,15 @@
 #
 
 import sys
+import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
 from pyasn1_modules import rfc4387
 
-try:
-    import unittest2 as unittest
-except ImportError:
-    import unittest
-
 
 class CertificateTestCase(unittest.TestCase):
     pem_text = """\
@@ -48,10 +44,11 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode (substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         oid_list = [
             rfc4387.id_ad_http_certs,
@@ -61,19 +58,21 @@
         count = 0
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_pe_authorityInfoAccess:
-                extnValue, rest = der_decode(extn['extnValue'],
+                extnValue, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.AuthorityInfoAccessSyntax())
-                assert not rest
-                assert extnValue.prettyPrint()
-                assert der_encode(extnValue) == extn['extnValue']
+
+                self.assertFalse(rest)
+                self.assertTrue(extnValue.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(extnValue))
 
                 for ad in extnValue:
                     if ad['accessMethod'] in oid_list:
                         uri = ad['accessLocation']['uniformResourceIdentifier']
-                        assert 'http://repo.example.com/c' in uri
+                        self.assertIn('http://repo.example.com/c', uri)
                         count += 1
 
-        assert count == len(oid_list)
+        self.assertEqual(len(oid_list), count)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc4985.py b/tests/test_rfc4985.py
index 70b1d63..b261ef9 100644
--- a/tests/test_rfc4985.py
+++ b/tests/test_rfc4985.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -41,58 +41,69 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.xmpp_server_cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         count = 0
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_ce_subjectAltName:
-                extnValue, rest = der_decode(extn['extnValue'],
-                    asn1Spec=rfc5280.SubjectAltName())
-                assert not rest
-                assert extnValue.prettyPrint()
-                assert der_encode(extnValue) == extn['extnValue']
+                extnValue, rest = der_decoder(
+                    extn['extnValue'], asn1Spec=rfc5280.SubjectAltName())
+
+                self.assertFalse(rest)
+                self.assertTrue(extnValue.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(extnValue))
+
                 for gn in extnValue:
                     if gn['otherName'].hasValue():
                         gn_on = gn['otherName']
                         if gn_on['type-id'] == rfc4985.id_on_dnsSRV:
-                            assert gn_on['type-id'] in rfc5280.anotherNameMap.keys()
+                            self.assertIn(gn_on['type-id'], rfc5280.anotherNameMap)
+
                             spec = rfc5280.anotherNameMap[gn['otherName']['type-id']]
-                            on, rest = der_decode(gn_on['value'], asn1Spec=spec)
-                            assert not rest
-                            assert on.prettyPrint()
-                            assert der_encode(on) == gn_on['value']
-                            assert 'im.example.com' in on
+                            on, rest = der_decoder(gn_on['value'], asn1Spec=spec)
+
+                            self.assertFalse(rest)
+                            self.assertTrue(on.prettyPrint())
+                            self.assertEqual(gn_on['value'], der_encoder(on))
+                            self.assertIn('im.example.com', on)
+
                             count += 1
 
-        assert count == 2
+        self.assertEqual(2, count)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.xmpp_server_cert_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         count = 0
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_ce_subjectAltName:
-                extnValue, rest = der_decode(extn['extnValue'],
-                    asn1Spec=rfc5280.SubjectAltName(), decodeOpenTypes=True)
-                assert not rest
-                assert extnValue.prettyPrint()
-                assert der_encode(extnValue) == extn['extnValue']
+                extnValue, rest = der_decoder(
+                    extn['extnValue'], asn1Spec=rfc5280.SubjectAltName(),
+                    decodeOpenTypes=True)
+
+                self.assertFalse(rest)
+                self.assertTrue(extnValue.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(extnValue))
+
                 for gn in extnValue:
                     if gn['otherName'].hasValue():
                         if gn['otherName']['type-id'] == rfc4985.id_on_dnsSRV:
-                            assert 'im.example.com' in gn['otherName']['value']
+                            self.assertIn('im.example.com', gn['otherName']['value'])
                             count += 1
 
-        assert count == 2
+        self.assertEqual(2, count)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5035.py b/tests/test_rfc5035.py
index e2eb5a6..196a6e4 100644
--- a/tests/test_rfc5035.py
+++ b/tests/test_rfc5035.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5652
@@ -56,26 +56,28 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.signed_message_pem_text)
-        asn1Object, rest = der_decode (substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder (substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['contentType'] == rfc5652.id_signedData
-        sd, rest = der_decode(asn1Object['content'], asn1Spec=rfc5652.SignedData())
-        assert not rest
-        assert sd.prettyPrint()
-        assert der_encode(sd) == asn1Object['content'] 
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
+
+        sd, rest = der_decoder(asn1Object['content'], asn1Spec=rfc5652.SignedData())
+
+        self.assertFalse(rest)
+        self.assertTrue(sd.prettyPrint())
+        self.assertEqual(asn1Object['content'], der_encoder(sd))
        
         for sa in sd['signerInfos'][0]['signedAttrs']:
             sat = sa['attrType']
             sav0 = sa['attrValues'][0]
 
             if sat in rfc5652.cmsAttributesMap.keys():
-                sav, rest = der_decode(sav0, asn1Spec=rfc5652.cmsAttributesMap[sat])
-                assert not rest
-                assert sav.prettyPrint()
-                assert der_encode(sav) == sav0
+                sav, rest = der_decoder(sav0, asn1Spec=rfc5652.cmsAttributesMap[sat])
+                self.assertFalse(rest)
+                self.assertTrue(sav.prettyPrint())
+                self.assertEqual(sav0, der_encoder(sav))
 
 
 class SignedReceiptTestCase(unittest.TestCase):
@@ -111,60 +113,76 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.signed_receipt_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['contentType'] == rfc5652.id_signedData
-        sd, rest = der_decode (asn1Object['content'], asn1Spec=rfc5652.SignedData())
-        assert not rest
-        assert sd.prettyPrint()
-        assert der_encode(sd) == asn1Object['content']
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
-        assert sd['encapContentInfo']['eContentType'] == rfc5035.id_ct_receipt
-        receipt, rest = der_decode(sd['encapContentInfo']['eContent'],
-                                   asn1Spec=rfc5035.Receipt())
-        assert not rest
-        assert receipt.prettyPrint()
-        assert der_encode(receipt) == sd['encapContentInfo']['eContent']
+        self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
+
+        sd, rest = der_decoder(
+            asn1Object['content'], asn1Spec=rfc5652.SignedData())
+
+        self.assertFalse(rest)
+        self.assertTrue(sd.prettyPrint())
+        self.assertEqual(asn1Object['content'], der_encoder(sd))
+        self.assertEqual(
+            rfc5035.id_ct_receipt, sd['encapContentInfo']['eContentType'])
+
+        receipt, rest = der_decoder(
+            sd['encapContentInfo']['eContent'], asn1Spec=rfc5035.Receipt())
+
+        self.assertFalse(rest)
+        self.assertTrue(receipt.prettyPrint())
+        self.assertEqual(
+            sd['encapContentInfo']['eContent'], der_encoder(receipt))
 
         for sa in sd['signerInfos'][0]['signedAttrs']:
             sat = sa['attrType']
             sav0 = sa['attrValues'][0]
 
             if sat in rfc5652.cmsAttributesMap.keys():
-                sav, rest = der_decode(sav0, asn1Spec=rfc5652.cmsAttributesMap[sat])
-                assert not rest
-                assert sav.prettyPrint()
-                assert der_encode(sav) == sav0
+                sav, rest = der_decoder(
+                    sav0, asn1Spec=rfc5652.cmsAttributesMap[sat])
+                self.assertFalse(rest)
+                self.assertTrue(sav.prettyPrint())
+                self.assertEqual(sav0, der_encoder(sav))
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.signed_receipt_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec, decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert asn1Object['contentType'] in rfc5652.cmsContentTypesMap.keys()
-        assert asn1Object['contentType'] == rfc5652.id_signedData
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        self.assertIn(asn1Object['contentType'], rfc5652.cmsContentTypesMap)
+        self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
 
         sd = asn1Object['content']
-        assert sd['version'] == rfc5652.CMSVersion().subtype(value='v3')
-        assert sd['encapContentInfo']['eContentType'] in rfc5652.cmsContentTypesMap.keys()
-        assert sd['encapContentInfo']['eContentType'] == rfc5035.id_ct_receipt
+
+        self.assertEqual(
+            rfc5652.CMSVersion().subtype(value='v3'), sd['version'])
+        self.assertIn(
+            sd['encapContentInfo']['eContentType'], rfc5652.cmsContentTypesMap)
+        self.assertEqual(
+            rfc5035.id_ct_receipt, sd['encapContentInfo']['eContentType'])
 
         for sa in sd['signerInfos'][0]['signedAttrs']:
-            assert sa['attrType'] in rfc5652.cmsAttributesMap.keys()
+            self.assertIn(sa['attrType'], rfc5652.cmsAttributesMap)
             if sa['attrType'] == rfc5035.id_aa_msgSigDigest:
-                sa['attrValues'][0].prettyPrint()[:10] == '0x167378'
+                self.assertIn(
+                    '0x167378', sa['attrValues'][0].prettyPrint()[:10])
 
         # Since receipt is inside an OCTET STRING, decodeOpenTypes=True cannot
         # automatically decode it 
-        receipt, rest = der_decode(sd['encapContentInfo']['eContent'],
+        receipt, rest = der_decoder(
+            sd['encapContentInfo']['eContent'],
             asn1Spec=rfc5652.cmsContentTypesMap[sd['encapContentInfo']['eContentType']])
-        assert receipt['version'] == 1
+
+        self.assertEqual(1, receipt['version'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5083.py b/tests/test_rfc5083.py
index 323f00d..e2eb172 100644
--- a/tests/test_rfc5083.py
+++ b/tests/test_rfc5083.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5652
@@ -38,10 +38,10 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 class AuthEnvelopedDataOpenTypesTestCase(unittest.TestCase):
@@ -68,22 +68,24 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert asn1Object['contentType'] in rfc5652.cmsContentTypesMap
-        assert asn1Object['contentType'] == rfc5083.id_ct_authEnvelopedData
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertIn(asn1Object['contentType'], rfc5652.cmsContentTypesMap)
+        self.assertEqual(rfc5083.id_ct_authEnvelopedData, asn1Object['contentType'])
+
         authenv = asn1Object['content']
-        assert authenv['version'] == 0
+
+        self.assertEqual(0, authenv['version'])
 
         for attr in authenv['unauthAttrs']:
-            assert attr['attrType'] in rfc5652.cmsAttributesMap
+            self.assertIn(attr['attrType'], rfc5652.cmsAttributesMap)
             if attr['attrType'] == rfc5035.id_aa_contentHint:
-                assert 'Watson' in attr['attrValues'][0]['contentDescription']
+                self.assertIn(
+                    'Watson', attr['attrValues'][0]['contentDescription'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5084.py b/tests/test_rfc5084.py
index 99898d7..c8ad0c2 100644
--- a/tests/test_rfc5084.py
+++ b/tests/test_rfc5084.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5083
@@ -25,10 +25,11 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.ccm_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 class GCMParametersTestCase(unittest.TestCase):
@@ -39,10 +40,11 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.gcm_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 class GCMOpenTypesTestCase(unittest.TestCase):
@@ -90,23 +92,27 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.rfc8591_pem_pext)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['contentType'] == rfc5083.id_ct_authEnvelopedData
-        aed, rest = der_decode(asn1Object['content'],
-            asn1Spec=rfc5083.AuthEnvelopedData(),
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(
+            rfc5083.id_ct_authEnvelopedData, asn1Object['contentType'])
+
+        aed, rest = der_decoder(
+            asn1Object['content'], asn1Spec=rfc5083.AuthEnvelopedData(),
             decodeOpenTypes=True)
-        assert not rest
-        assert aed.prettyPrint()
-        assert der_encode(aed) == asn1Object['content']
 
-        assert aed['version'] == 0
+        self.assertFalse(rest)
+        self.assertTrue(aed.prettyPrint())
+        self.assertEqual(asn1Object['content'], der_encoder(aed))
+        self.assertEqual(0, aed['version'])
+
         cea = aed['authEncryptedContentInfo']['contentEncryptionAlgorithm']
-        assert cea['algorithm'] == rfc5084.id_aes128_GCM
-        assert cea['parameters']['aes-ICVlen'] == 16
+
+        self.assertEqual(rfc5084.id_aes128_GCM, cea['algorithm'])
+        self.assertEqual(16, cea['parameters']['aes-ICVlen'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5126.py b/tests/test_rfc5126.py
index f4e806d..e43af9a 100644
--- a/tests/test_rfc5126.py
+++ b/tests/test_rfc5126.py
@@ -5,22 +5,16 @@
 # License: http://snmplabs.com/pyasn1/license.html
 #
 import sys
+import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
-
-from pyasn1.type import univ
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc4055
 from pyasn1_modules import rfc5652
 from pyasn1_modules import rfc5126
 
-try:
-    import unittest2 as unittest
-except ImportError:
-    import unittest
-
 
 class SignedAttributesTestCase(unittest.TestCase):
     pem_text = """\
@@ -39,58 +33,65 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         found_spid_oid = False
+
         for attr in asn1Object:
             if attr['attrType'] in rfc5652.cmsAttributesMap.keys():
-                av, rest = der_decode (attr['attrValues'][0],
+                av, rest = der_decoder(
+                    attr['attrValues'][0],
                     asn1Spec=rfc5652.cmsAttributesMap[attr['attrType']])
-                assert not rest
-                assert av.prettyPrint()
-                assert der_encode(av) == attr['attrValues'][0]
+
+                self.assertFalse(rest)
+                self.assertTrue(av.prettyPrint())
+                self.assertEqual(attr['attrValues'][0], der_encoder(av))
 
                 if attr['attrType'] == rfc5126.id_aa_ets_sigPolicyId:
                     spid_oid = rfc5126.SigPolicyId('1.3.6.1.4.1.22112.48.20')
-                    assert av['signaturePolicyId']['sigPolicyId'] == spid_oid
+
+                    self.assertEqual(
+                        spid_oid, av['signaturePolicyId']['sigPolicyId'])
+
                     found_spid_oid = True
 
-        assert found_spid_oid
+        self.assertTrue(found_spid_oid)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        attr_type_list = [ ]
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        attr_type_list = []
         spid_oid = rfc5126.SigPolicyId('1.3.6.1.4.1.22112.48.20')
 
         for attr in asn1Object:
             if attr['attrType'] == rfc5126.id_aa_ets_sigPolicyId:
                 spid = attr['attrValues'][0]['signaturePolicyId']
-                assert spid['sigPolicyId'] == spid_oid
+                self.assertEqual(spid_oid, spid['sigPolicyId'])
                 attr_type_list.append(rfc5126.id_aa_ets_sigPolicyId)
 
             if attr['attrType'] == rfc5126.id_aa_ets_signerLocation:
                 cn = attr['attrValues'][0]['countryName']
-                assert cn['printableString'] == 'US'
+                self.assertEqual('US', cn['printableString'])
                 attr_type_list.append(rfc5126.id_aa_ets_signerLocation)
 
             if attr['attrType'] == rfc5126.id_aa_signingCertificateV2:
                 ha = attr['attrValues'][0]['certs'][0]['hashAlgorithm']
-                assert ha['algorithm'] == rfc4055.id_sha256
+                self.assertEqual(rfc4055.id_sha256, ha['algorithm'])
                 attr_type_list.append(rfc5126.id_aa_signingCertificateV2)
 
-        assert rfc5126.id_aa_ets_sigPolicyId in attr_type_list
-        assert rfc5126.id_aa_ets_signerLocation in attr_type_list
-        assert rfc5126.id_aa_signingCertificateV2 in attr_type_list
+        self.assertIn(rfc5126.id_aa_ets_sigPolicyId, attr_type_list)
+        self.assertIn(rfc5126.id_aa_ets_signerLocation, attr_type_list)
+        self.assertIn(rfc5126.id_aa_signingCertificateV2, attr_type_list)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5208.py b/tests/test_rfc5208.py
index 2e40b5c..20dd28b 100644
--- a/tests/test_rfc5208.py
+++ b/tests/test_rfc5208.py
@@ -33,11 +33,12 @@
 
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder.decode(
+            substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
 
 class EncryptedPrivateKeyInfoInfoTestCase(unittest.TestCase):
@@ -59,11 +60,12 @@
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder.decode(
+            substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5280.py b/tests/test_rfc5280.py
index c738ad9..add78e5 100644
--- a/tests/test_rfc5280.py
+++ b/tests/test_rfc5280.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import univ
 
 from pyasn1_modules import pem
@@ -42,11 +42,12 @@
 
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 class CertificateListTestCase(unittest.TestCase):
@@ -67,12 +68,12 @@
     def testDerCodec(self):
 
         substrate = pem.readBase64fromText(self.pem_text)
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec)
 
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 class CertificateOpenTypeTestCase(unittest.TestCase):
@@ -108,27 +109,29 @@
             univ.ObjectIdentifier('1.2.840.113549.1.1.11'): univ.Null(""),
         }
 
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            openTypes=openTypesMap,
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, openTypes=openTypesMap,
             decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         sig_alg = asn1Object['tbsCertificate']['signature']
-        assert sig_alg['parameters'] == univ.Null("")
+
+        self.assertEqual(univ.Null(""), sig_alg['parameters'])
 
         spki_alg = asn1Object['tbsCertificate']['subjectPublicKeyInfo']['algorithm']
-        assert spki_alg['parameters'] == univ.Null("")
+
+        self.assertEqual(univ.Null(""), spki_alg['parameters'])
 
         for rdn in asn1Object['tbsCertificate']['subject']['rdnSequence']:
             for atv in rdn:
                 if atv['type'] == rfc5280.id_emailAddress:
-                    assert "valicert.com" in atv['value']
+                    self.assertIn("valicert.com", atv['value'])
                 else:
                     atv_ps = str(atv['value']['printableString'])
-                    assert "valicert" in atv_ps.lower()
+                    self.assertIn("valicert", atv_ps.lower())
 
 
 class CertificateListOpenTypeTestCase(unittest.TestCase):
@@ -156,52 +159,66 @@
             univ.ObjectIdentifier('1.2.840.113549.1.1.11'): univ.Null(""),
         }
 
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            openTypes=openTypesMap,
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, openTypes=openTypesMap,
             decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         sig_alg = asn1Object['tbsCertList']['signature']
-        assert sig_alg['parameters'] == univ.Null("")
+
+        self.assertEqual(univ.Null(""), sig_alg['parameters'])
 
         for rdn in asn1Object['tbsCertList']['issuer']['rdnSequence']:
             for atv in rdn:
                 if atv['type'] == rfc5280.id_emailAddress:
-                    assert "snmplabs.com" in atv['value']
+                    self.assertIn("snmplabs.com", atv['value'])
+
                 elif atv['type'] == rfc5280.id_at_countryName:
-                    assert atv['value'] == 'AU'
+                    self.assertEqual('AU', atv['value'])
+
                 else:
-                    assert len(atv['value']['printableString']) > 9
+                    self.assertLess(9, len(atv['value']['printableString']))
 
         crl_extn_count = 0
+
         for extn in asn1Object['tbsCertList']['crlExtensions']:
             if extn['extnID'] in rfc5280.certificateExtensionsMap.keys():
-                ev, rest = der_decode(extn['extnValue'],
+                ev, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert not rest
-                assert ev.prettyPrint()
-                assert der_encode(ev) == extn['extnValue']
+
+                self.assertFalse(rest)
+                self.assertTrue(ev.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(ev))
+
                 crl_extn_count += 1
-        assert crl_extn_count == 1
+
+        self.assertEqual(1, crl_extn_count)
 
     def testExtensionsMap(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         cert_extn_count = 0
+
         for extn in asn1Object['tbsCertList']['crlExtensions']:
             if extn['extnID'] in rfc5280.certificateExtensionsMap.keys():
-                extnValue, rest = der_decode(extn['extnValue'],
+                extnValue, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert der_encode(extnValue) == extn['extnValue']
+
+                self.assertEqual(extn['extnValue'], der_encoder(extnValue))
+
                 cert_extn_count += 1
-        assert cert_extn_count == 1
+
+        self.assertEqual(1, cert_extn_count)
 
 
 class ORAddressOpenTypeTestCase(unittest.TestCase):
@@ -216,16 +233,17 @@
     def testDecodeOpenTypes(self):
         substrate = pem.readBase64fromText(self.oraddress_pem_text)
 
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         ea0 = asn1Object['extension-attributes'][0]
-        assert ea0['extension-attribute-type'] == rfc5280.common_name
-        assert ea0['extension-attribute-value'] == "Steve Kille"
+
+        self.assertEqual(rfc5280.common_name, ea0['extension-attribute-type'])
+        self.assertEqual("Steve Kille", ea0['extension-attribute-value'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5480.py b/tests/test_rfc5480.py
index 68db48f..72ca51a 100755
--- a/tests/test_rfc5480.py
+++ b/tests/test_rfc5480.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -45,28 +45,33 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.digicert_ec_cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         algid = asn1Object['tbsCertificate']['subjectPublicKeyInfo']['algorithm']
-        assert algid['algorithm'] == rfc5480.id_ecPublicKey
-        param, rest = der_decode(algid['parameters'], asn1Spec=rfc5480.ECParameters())
-        assert param.prettyPrint()
-        assert param['namedCurve'] == rfc5480.secp384r1
+
+        self.assertEqual(rfc5480.id_ecPublicKey, algid['algorithm'])
+
+        param, rest = der_decoder(algid['parameters'], asn1Spec=rfc5480.ECParameters())
+
+        self.assertTrue(param.prettyPrint())
+        self.assertEqual(rfc5480.secp384r1, param['namedCurve'])
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.digicert_ec_cert_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec, decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate,
+                                       asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
     
         spki_alg = asn1Object['tbsCertificate']['subjectPublicKeyInfo']['algorithm']
-        assert spki_alg['algorithm'] == rfc5480.id_ecPublicKey
-        assert spki_alg['parameters']['namedCurve'] == rfc5480.secp384r1
+
+        self.assertEqual(rfc5480.id_ecPublicKey, spki_alg['algorithm'])
+        self.assertEqual(rfc5480.secp384r1, spki_alg['parameters']['namedCurve'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5649.py b/tests/test_rfc5649.py
index 52968b3..c2fa9d1 100644
--- a/tests/test_rfc5649.py
+++ b/tests/test_rfc5649.py
@@ -23,11 +23,13 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.kw_alg_id_pem_text)
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object[0] == rfc5649.id_aes256_wrap
-        assert der_encoder.encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder.decode(
+            substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(rfc5649.id_aes256_wrap, asn1Object[0])
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
 
 class AESKeyWrapWithPadTestCase(unittest.TestCase):
@@ -38,11 +40,13 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.kw_pad_alg_id_pem_text)
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object[0] == rfc5649.id_aes256_wrap_pad
-        assert der_encoder.encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder.decode(
+            substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(rfc5649.id_aes256_wrap_pad, asn1Object[0])
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5652.py b/tests/test_rfc5652.py
index 9c69304..b2c488a 100644
--- a/tests/test_rfc5652.py
+++ b/tests/test_rfc5652.py
@@ -74,9 +74,9 @@
                 substrate, asn1Spec=layers[next_layer]
             )
 
-            assert not rest
-            assert asn1Object.prettyPrint()
-            assert der_encoder.encode(asn1Object) == substrate
+            self.assertFalse(rest)
+            self.assertTrue(asn1Object.prettyPrint())
+            self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
             substrate = getNextSubstrate[next_layer](asn1Object)
             next_layer = getNextLayer[next_layer](asn1Object)
@@ -118,40 +118,48 @@
         substrate = pem.readBase64fromText(self.pem_text)
         asn1Object, rest = der_decoder.decode(substrate,
             asn1Spec=rfc5652.ContentInfo(), decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
         eci = asn1Object['content']['encapContentInfo']
-        assert eci['eContentType'] in rfc5652.cmsContentTypesMap.keys()
-        assert eci['eContentType'] == rfc6402.id_cct_PKIData
+
+        self.assertIn(eci['eContentType'], rfc5652.cmsContentTypesMap)
+        self.assertEqual(rfc6402.id_cct_PKIData, eci['eContentType'])
+
         pkid, rest = der_decoder.decode(eci['eContent'],
             asn1Spec=rfc5652.cmsContentTypesMap[eci['eContentType']],
             openTypes=openTypeMap,
             decodeOpenTypes=True)
-        assert not rest
-        assert pkid.prettyPrint()
-        assert der_encoder.encode(pkid) == eci['eContent']
+
+        self.assertFalse(rest)
+        self.assertTrue(pkid.prettyPrint())
+        self.assertEqual(eci['eContent'], der_encoder.encode(pkid))
 
         for req in pkid['reqSequence']:
             cr = req['tcr']['certificationRequest']
 
             sig_alg = cr['signatureAlgorithm']
-            assert sig_alg['algorithm'] in openTypeMap.keys()
-            assert sig_alg['parameters'] == univ.Null("")
+
+            self.assertIn(sig_alg['algorithm'], openTypeMap)
+            self.assertEqual(univ.Null(""), sig_alg['parameters'])
 
             cri = cr['certificationRequestInfo']
             spki_alg = cri['subjectPublicKeyInfo']['algorithm']
-            assert spki_alg['algorithm'] in openTypeMap.keys()
-            assert spki_alg['parameters'] == univ.Null("")
+
+            self.assertIn( spki_alg['algorithm'], openTypeMap)
+            self.assertEqual(univ.Null(""), spki_alg['parameters'])
 
             attrs = cr['certificationRequestInfo']['attributes']
+
             for attr in attrs:
-                assert attr['attrType'] in openTypeMap.keys()
+                self.assertIn(attr['attrType'], openTypeMap)
+
                 if attr['attrType'] == univ.ObjectIdentifier('1.3.6.1.4.1.311.13.2.3'):
-                    assert attr['attrValues'][0] == "6.2.9200.2"
+                    self.assertEqual("6.2.9200.2", attr['attrValues'][0])
+
                 else:
-                    assert attr['attrValues'][0].hasValue()
+                    self.assertTrue(attr['attrValues'][0].hasValue())
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5751.py b/tests/test_rfc5751.py
index d2a6813..7ce4373 100644
--- a/tests/test_rfc5751.py
+++ b/tests/test_rfc5751.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import univ
 
 from pyasn1_modules import pem
@@ -66,32 +66,34 @@
         smimeCapMap.update(rfc5751.smimeCapabilityMap)
 
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode (substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder (substrate,
+                                        asn1Spec=self.asn1Spec,
+                                        decodeOpenTypes=True)
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
-        assert asn1Object['contentType'] == rfc5652.id_signedData
-        assert asn1Object['content']['version'] == 1
+        self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
+        self.assertEqual(1, asn1Object['content']['version'])
 
         for si in asn1Object['content']['signerInfos']:
-            assert si['version'] == 1
+            self.assertEqual(1, si['version'])
+
             for attr in si['signedAttrs']:
 
                 if attr['attrType'] == rfc5751.smimeCapabilities:
                     for scap in attr['attrValues'][0]:
                         if scap['capabilityID'] in smimeCapMap.keys():
-                            scap_p, rest = der_decode(scap['parameters'],
-                                asn1Spec=smimeCapMap[scap['capabilityID']])
-                            assert not rest
-                            assert der_encode(scap_p) == scap['parameters']
-                            assert 'parameters' in scap_p.prettyPrint()
+                            scap_p, rest = der_decoder(scap['parameters'],
+                                                       asn1Spec=smimeCapMap[scap['capabilityID']])
+                            self.assertFalse(rest)
+                            self.assertEqual(scap['parameters'], der_encoder(scap_p))
+                            self.assertIn('parameters', scap_p.prettyPrint())
 
                 if attr['attrType'] == rfc5751.id_aa_encrypKeyPref:
                     ekp_issuer_serial = attr['attrValues'][0]['issuerAndSerialNumber']
-                    assert ekp_issuer_serial['serialNumber'] == 173360179
+
+                    self.assertEqual(173360179, ekp_issuer_serial['serialNumber'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5755.py b/tests/test_rfc5755.py
index c7339b3..cf4a05f 100644
--- a/tests/test_rfc5755.py
+++ b/tests/test_rfc5755.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.compat.octets import str2octs
 
 from pyasn1_modules import pem
@@ -44,42 +44,51 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
-        assert asn1Object['acinfo']['version'] == 1
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(1, asn1Object['acinfo']['version'])
 
         count = 0
+
         for attr in asn1Object['acinfo']['attributes']:
-            assert attr['type'] in rfc5280.certificateAttributesMap.keys()
-            av, rest = der_decode(attr['values'][0],
+            self.assertIn(attr['type'], rfc5280.certificateAttributesMap)
+
+            av, rest = der_decoder(
+                attr['values'][0],
                 asn1Spec=rfc5280.certificateAttributesMap[attr['type']])
-            assert not rest
-            assert av.prettyPrint()
-            assert der_encode(av) == attr['values'][0]
+
+            self.assertFalse(rest)
+            self.assertTrue(av.prettyPrint())
+            self.assertEqual(attr['values'][0], der_encoder(av))
+
             count += 1
 
-        assert count == 5
+        self.assertEqual(5, count)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
-        assert asn1Object['acinfo']['version'] == 1
+        asn1Object, rest = der_decoder(substrate,
+                                       asn1Spec=self.asn1Spec,
+                                       decodeOpenTypes=True)
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(1, asn1Object['acinfo']['version'])
 
         count = 0
+
         for attr in asn1Object['acinfo']['attributes']:
-            assert attr['type'] in rfc5280.certificateAttributesMap.keys()
+            self.assertIn(attr['type'], rfc5280.certificateAttributesMap)
             count += 1
             if attr['type'] == rfc5755.id_aca_authenticationInfo:
-                assert attr['values'][0]['authInfo'] == str2octs('password')
+                self.assertEqual(
+                    str2octs('password'), attr['values'][0]['authInfo'])
 
-        assert count == 5
+        self.assertEqual(5, count)
+
 
 class CertificateWithClearanceTestCase(unittest.TestCase):
     cert_pem_text = """\
@@ -111,68 +120,89 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         clearance_found = False
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_ce_subjectDirectoryAttributes:
-                assert extn['extnID'] in rfc5280.certificateExtensionsMap.keys()
-                ev, rest = der_decode(extn['extnValue'],
+                self.assertIn(extn['extnID'], rfc5280.certificateExtensionsMap)
+
+                ev, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert not rest
-                assert ev.prettyPrint()
-                assert der_encode(ev) == extn['extnValue']
+
+                self.assertFalse(rest)
+                self.assertTrue(ev.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(ev))
 
                 for attr in ev:
                     if attr['type'] == rfc5755.id_at_clearance:
-                        assert attr['type'] in rfc5280.certificateAttributesMap.keys()
-                        av, rest = der_decode(attr['values'][0],
+                        self.assertIn(attr['type'], rfc5280.certificateAttributesMap)
+
+                        av, rest = der_decoder(
+                            attr['values'][0],
                             asn1Spec=rfc5280.certificateAttributesMap[attr['type']])
-                        assert av['policyId'] == rfc3114.id_tsp_TEST_Whirlpool
+
+                        self.assertEqual(rfc3114.id_tsp_TEST_Whirlpool, av['policyId'])
+
                         for cat in av['securityCategories']:
-                            assert cat['type'] == rfc3114.id_tsp_TEST_Whirlpool_Categories
-                            assert cat['type'] in rfc5755.securityCategoryMap.keys()
-                            catv, rest = der_decode(cat['value'],
+                            self.assertEqual(
+                                rfc3114.id_tsp_TEST_Whirlpool_Categories, cat['type'])
+                            self.assertIn(
+                                cat['type'], rfc5755.securityCategoryMap)
+                            catv, rest = der_decoder(
+                                cat['value'],
                                 asn1Spec=rfc5755.securityCategoryMap[cat['type']])
-                            assert u'USE ONLY' in catv[0]
+
+                            self.assertIn('USE ONLY', catv[0])
+
                             clearance_found = True
 
-        assert clearance_found
+        self.assertTrue(clearance_found)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         clearance_found = False
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_ce_subjectDirectoryAttributes:
-                assert extn['extnID'] in rfc5280.certificateExtensionsMap.keys()
-                ev, rest = der_decode(extn['extnValue'],
+                self.assertIn(extn['extnID'], rfc5280.certificateExtensionsMap)
+
+                ev, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']],
                     decodeOpenTypes=True)
-                assert not rest
-                assert ev.prettyPrint()
-                assert der_encode(ev) == extn['extnValue']
+
+                self.assertFalse(rest)
+                self.assertTrue(ev.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(ev))
 
                 for attr in ev:
                     if attr['type'] == rfc5755.id_at_clearance:
                         spid = rfc3114.id_tsp_TEST_Whirlpool
                         catid = rfc3114.id_tsp_TEST_Whirlpool_Categories
-                        assert attr['values'][0]['policyId'] == spid
+
+                        self.assertEqual(spid, attr['values'][0]['policyId'])
+
                         for cat in attr['values'][0]['securityCategories']:
-                            assert cat['type'] == catid
-                            assert u'USE ONLY' in cat['value'][0]
+                            self.assertEqual(catid, cat['type'])
+                            self.assertIn( u'USE ONLY', cat['value'][0])
+
                             clearance_found = True
 
-        assert clearance_found
+        self.assertTrue(clearance_found)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5913.py b/tests/test_rfc5913.py
index aae4ac6..ef59086 100644
--- a/tests/test_rfc5913.py
+++ b/tests/test_rfc5913.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -46,62 +46,74 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         cat_value_found = False
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5913.id_pe_clearanceConstraints:
-                assert extn['extnID'] in rfc5280.certificateExtensionsMap.keys()
-                ev, rest = der_decode(extn['extnValue'],
+                self.assertIn(extn['extnID'], rfc5280.certificateExtensionsMap)
+
+                ev, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert not rest
-                assert ev.prettyPrint()
-                assert der_encode(ev) == extn['extnValue']
+
+                self.assertFalse(rest)
+                self.assertTrue(ev.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(ev))
 
                 for c in ev:
                     if c['policyId'] == rfc3114.id_tsp_TEST_Whirlpool:
                         for sc in c['securityCategories']:
-                            assert sc['type'] in rfc5755.securityCategoryMap.keys()
-                            scv, rest = der_decode(sc['value'],
+                            self.assertIn(sc['type'], rfc5755.securityCategoryMap)
+
+                            scv, rest = der_decoder(
+                                sc['value'],
                                 asn1Spec=rfc5755.securityCategoryMap[sc['type']])
+
                             for cat in scv:
-                                assert u'USE ONLY' in cat
+                                self.assertIn('USE ONLY', cat)
                                 cat_value_found = True
 
-        assert cat_value_found
+        self.assertTrue(cat_value_found)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         cat_value_found = False
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5913.id_pe_clearanceConstraints:
-                assert extn['extnID'] in rfc5280.certificateExtensionsMap.keys()
-                ev, rest = der_decode(extn['extnValue'],
+                self.assertIn(extn['extnID'], rfc5280.certificateExtensionsMap)
+
+                ev, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']],
                     decodeOpenTypes=True)
-                assert not rest
-                assert ev.prettyPrint()
-                assert der_encode(ev) == extn['extnValue']
+
+                self.assertFalse(rest)
+                self.assertTrue(ev.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(ev))
 
                 for c in ev:
                     if c['policyId'] == rfc3114.id_tsp_TEST_Whirlpool:
                         for sc in c['securityCategories']:
-                            assert sc['type'] in rfc5755.securityCategoryMap.keys()
+                            self.assertIn(sc['type'], rfc5755.securityCategoryMap)
                             for cat in sc['value']:
-                                assert u'USE ONLY' in cat
+                                self.assertIn('USE ONLY', cat)
                                 cat_value_found = True
 
-        assert cat_value_found
+        self.assertTrue(cat_value_found)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5914.py b/tests/test_rfc5914.py
index c250910..3a70ec8 100644
--- a/tests/test_rfc5914.py
+++ b/tests/test_rfc5914.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5914
@@ -58,18 +58,19 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.trust_anchor_list_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['contentType'] == rfc5914.id_ct_trustAnchorList
-        tal, rest = der_decode(asn1Object['content'], rfc5914.TrustAnchorList())
-        assert not rest
-        assert tal.prettyPrint()
-        assert der_encode(tal) == asn1Object['content']
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(rfc5914.id_ct_trustAnchorList, asn1Object['contentType'])
 
-        assert sum (1 for _ in tal) == 3
+        tal, rest = der_decoder(asn1Object['content'], rfc5914.TrustAnchorList())
+
+        self.assertFalse(rest)
+        self.assertTrue(tal.prettyPrint())
+        self.assertEqual(asn1Object['content'], der_encoder(tal))
+        self.assertEqual(3, sum(1 for _ in tal))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5915.py b/tests/test_rfc5915.py
index 70a5423..6e54e5a 100644
--- a/tests/test_rfc5915.py
+++ b/tests/test_rfc5915.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5915
@@ -29,12 +29,13 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.private_key_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['parameters']['namedCurve'] == rfc5480.secp384r1
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(
+            rfc5480.secp384r1, asn1Object['parameters']['namedCurve'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5916.py b/tests/test_rfc5916.py
index a512d8a..a653b8c 100644
--- a/tests/test_rfc5916.py
+++ b/tests/test_rfc5916.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import univ
 
 from pyasn1_modules import pem
@@ -41,58 +41,63 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         found_dev_owner = False
-        der_dev_own_oid = der_encode(univ.ObjectIdentifier('1.3.6.1.4.1.22112.48.24'))
+        der_dev_own_oid = der_encoder(univ.ObjectIdentifier('1.3.6.1.4.1.22112.48.24'))
 
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_ce_subjectDirectoryAttributes:
-                assert extn['extnID'] in rfc5280.certificateExtensionsMap.keys()
-                ev, rest = der_decode(extn['extnValue'],
+                self.assertIn(extn['extnID'], rfc5280.certificateExtensionsMap)
+                ev, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert not rest
-                assert ev.prettyPrint()
-                assert der_encode(ev) == extn['extnValue']
+
+                self.assertFalse(rest)
+                self.assertTrue(ev.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(ev))
 
                 for attr in ev:
                     if attr['type'] == rfc5916.id_deviceOwner:
-                        assert attr['values'][0] == der_dev_own_oid
+                        self.assertEqual(der_dev_own_oid, attr['values'][0])
                         found_dev_owner = True
 
-        assert found_dev_owner
+        self.assertTrue(found_dev_owner)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate,
+                                       asn1Spec=self.asn1Spec,
+                                       decodeOpenTypes=True)
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         found_dev_owner = False
         dev_own_oid = univ.ObjectIdentifier('1.3.6.1.4.1.22112.48.24')
 
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_ce_subjectDirectoryAttributes:
-                assert extn['extnID'] in rfc5280.certificateExtensionsMap.keys()
-                ev, rest = der_decode(extn['extnValue'],
-                    asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']],
-                    decodeOpenTypes=True)
-                assert not rest
-                assert ev.prettyPrint()
-                assert der_encode(ev) == extn['extnValue']
+                self.assertIn(extn['extnID'], rfc5280.certificateExtensionsMap)
+                ev, rest = der_decoder(
+                    extn['extnValue'],
+                   asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']],
+                   decodeOpenTypes=True)
+
+                self.assertFalse(rest)
+                self.assertTrue(ev.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(ev))
 
                 for attr in ev:
                     if attr['type'] == rfc5916.id_deviceOwner:
-                        assert attr['values'][0] == dev_own_oid
+                        self.assertEqual(dev_own_oid, attr['values'][0])
                         found_dev_owner = True
 
-        assert found_dev_owner
+        self.assertTrue(found_dev_owner)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5917.py b/tests/test_rfc5917.py
index d56822a..1023fb8 100644
--- a/tests/test_rfc5917.py
+++ b/tests/test_rfc5917.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -46,59 +46,71 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         cs = rfc5917.DirectoryString()
         cs['utf8String'] = u'Human Resources Department'
-        encoded_cs = der_encode(cs)
+        encoded_cs = der_encoder(cs)
 
         clearance_sponsor_found = False
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_ce_subjectDirectoryAttributes:
-                assert extn['extnID'] in rfc5280.certificateExtensionsMap.keys()
-                ev, rest = der_decode(extn['extnValue'],
+
+                self.assertIn(extn['extnID'], rfc5280.certificateExtensionsMap)
+
+                ev, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert not rest
-                assert ev.prettyPrint()
-                assert der_encode(ev) == extn['extnValue']
+
+                self.assertFalse(rest)
+                self.assertTrue(ev.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(ev))
 
                 for attr in ev:
                     if attr['type'] == rfc5917.id_clearanceSponsor:
-                        assert attr['values'][0] == encoded_cs
+                        self.assertEqual(encoded_cs, attr['values'][0])
                         clearance_sponsor_found = True
 
-        assert clearance_sponsor_found
+        self.assertTrue(clearance_sponsor_found)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         clearance_sponsor_found = False
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_ce_subjectDirectoryAttributes:
-                assert extn['extnID'] in rfc5280.certificateExtensionsMap.keys()
-                ev, rest = der_decode(extn['extnValue'],
+                self.assertIn(extn['extnID'], rfc5280.certificateExtensionsMap)
+
+                ev, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']],
                     decodeOpenTypes=True)
-                assert not rest
-                assert ev.prettyPrint()
-                assert der_encode(ev) == extn['extnValue']
+
+                self.assertFalse(rest)
+                self.assertTrue(ev.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(ev))
 
                 for attr in ev:
                     if attr['type'] == rfc5917.id_clearanceSponsor:
                         hrd = u'Human Resources Department'
-                        assert attr['values'][0]['utf8String'] == hrd
+
+                        self.assertEqual(hrd, attr['values'][0]['utf8String'])
+
                         clearance_sponsor_found = True
 
-        assert clearance_sponsor_found
+        self.assertTrue(clearance_sponsor_found)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5924.py b/tests/test_rfc5924.py
index d6678f1..f1ae64a 100644
--- a/tests/test_rfc5924.py
+++ b/tests/test_rfc5924.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -39,24 +39,32 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         found_kp_sipDomain = False
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_ce_extKeyUsage:
-                assert extn['extnID'] in rfc5280.certificateExtensionsMap.keys()
-                ev, rest = der_decode(extn['extnValue'],
+                self.assertIn(
+                    extn['extnID'], rfc5280.certificateExtensionsMap)
+
+                ev, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert not rest
-                assert ev.prettyPrint()
-                assert der_encode(ev) == extn['extnValue']
-                assert rfc5924.id_kp_sipDomain in ev
+
+                self.assertFalse(rest)
+                self.assertTrue(ev.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(ev))
+                self.assertIn(rfc5924.id_kp_sipDomain, ev)
+
                 found_kp_sipDomain = True
 
-        assert found_kp_sipDomain
+        self.assertTrue(found_kp_sipDomain)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5934.py b/tests/test_rfc5934.py
index ebf4f54..ba18b56 100644
--- a/tests/test_rfc5934.py
+++ b/tests/test_rfc5934.py
@@ -9,8 +9,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1.type import univ
 
@@ -150,44 +150,48 @@
         next_layer = rfc5652.id_ct_contentInfo
 
         while next_layer:
-            asn1Object, rest = der_decode(substrate, asn1Spec=layers[next_layer])
-            assert not rest
-            assert asn1Object.prettyPrint()
-            assert der_encode(asn1Object) == substrate
+            asn1Object, rest = der_decoder(substrate, asn1Spec=layers[next_layer])
+            self.assertFalse(rest)
+            self.assertTrue(asn1Object.prettyPrint())
+            self.assertEqual(substrate, der_encoder(asn1Object))
 
             substrate = getNextSubstrate[next_layer](asn1Object)
             next_layer = getNextLayer[next_layer](asn1Object)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.tsr_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=rfc5652.ContentInfo(),
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=rfc5652.ContentInfo(), decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         eci = asn1Object['content']['encapContentInfo']
-        assert eci['eContentType'] in rfc5652.cmsContentTypesMap.keys()
-        assert eci['eContentType'] == rfc5934.id_ct_TAMP_statusResponse
-        tsr, rest = der_decode(eci['eContent'],
+
+        self.assertIn(eci['eContentType'], rfc5652.cmsContentTypesMap)
+        self.assertEqual(rfc5934.id_ct_TAMP_statusResponse, eci['eContentType'])
+
+        tsr, rest = der_decoder(
+            eci['eContent'],
             asn1Spec=rfc5652.cmsContentTypesMap[eci['eContentType']],
             decodeOpenTypes=True)
-        assert not rest
-        assert tsr.prettyPrint()
-        assert der_encode(tsr) == eci['eContent']
 
-        assert tsr['version'] == 2
-        assert tsr['query']['target'] == univ.Null("")
-        assert tsr['query']['seqNum'] == 1568307071
-        assert tsr['usesApex'] == False
+        self.assertFalse(rest)
+        self.assertTrue(tsr.prettyPrint())
+        self.assertEqual(eci['eContent'], der_encoder(tsr))
+        self.assertEqual(2, tsr['version'])
+        self.assertEqual(univ.Null(""), tsr['query']['target'])
+        self.assertEqual(1568307071, tsr['query']['seqNum'])
+        self.assertFalse(tsr['usesApex'])
 
         count = 0
+
         for tai in tsr['response']['verboseResponse']['taInfo']:
             count += 1
-            assert tai['taInfo']['version'] == 1
+            self.assertEqual(1, tai['taInfo']['version'])
 
-        assert count == 3
+        self.assertEqual(3, count)
 
 
 class TrustAnchorUpdateTestCase(unittest.TestCase):
@@ -251,42 +255,41 @@
         next_layer = rfc5652.id_ct_contentInfo
 
         while next_layer:
-            asn1Object, rest = der_decode(substrate, asn1Spec=layers[next_layer])
-            assert not rest
-            assert asn1Object.prettyPrint()
-            assert der_encode(asn1Object) == substrate
+            asn1Object, rest = der_decoder(substrate, asn1Spec=layers[next_layer])
+
+            self.assertFalse(rest)
+            self.assertTrue(asn1Object.prettyPrint())
+            self.assertEqual(substrate, der_encoder(asn1Object))
 
             substrate = getNextSubstrate[next_layer](asn1Object)
             next_layer = getNextLayer[next_layer](asn1Object)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.tau_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=rfc5652.ContentInfo(),
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=rfc5652.ContentInfo(),
             decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         eci = asn1Object['content']['encapContentInfo']
-        assert eci['eContentType'] in rfc5652.cmsContentTypesMap.keys()
-        assert eci['eContentType'] == rfc5934.id_ct_TAMP_update
-        tau, rest = der_decode(eci['eContent'],
+        self.assertIn(eci['eContentType'], rfc5652.cmsContentTypesMap)
+        self.assertEqual(rfc5934.id_ct_TAMP_update, eci['eContentType'])
+
+        tau, rest = der_decoder(
+            eci['eContent'],
             asn1Spec=rfc5652.cmsContentTypesMap[eci['eContentType']],
             decodeOpenTypes=True)
-        assert not rest
-        assert tau.prettyPrint()
-        assert der_encode(tau) == eci['eContent']
 
-        assert tau['version'] == 2
-        assert tau['msgRef']['target'] == univ.Null("")
-        assert tau['msgRef']['seqNum'] == 1568307088
-
-        count = 0
-        for u in tau['updates']:
-            count += 1
-
-        assert count == 1
+        self.assertFalse(rest)
+        self.assertTrue(tau.prettyPrint())
+        self.assertEqual(eci['eContent'], der_encoder(tau))
+        self.assertEqual(2, tau['version'])
+        self.assertEqual(univ.Null(""), tau['msgRef']['target'])
+        self.assertEqual(1568307088, tau['msgRef']['seqNum'])
+        self.assertEqual(1, len(tau['updates']))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5940.py b/tests/test_rfc5940.py
index 9752b8e..d55ba6e 100644
--- a/tests/test_rfc5940.py
+++ b/tests/test_rfc5940.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc2560
@@ -67,55 +67,71 @@
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
 
-        assert asn1Object['contentType'] == rfc5652.id_signedData
-        sd, rest = der_decode(asn1Object['content'],
-            asn1Spec=rfc5652.SignedData())
-        assert sd.prettyPrint()
+        sd, rest = der_decoder(
+            asn1Object['content'], asn1Spec=rfc5652.SignedData())
 
-        assert sd['encapContentInfo']['eContentType'] == rfc5652.id_data
-        assert sd['encapContentInfo']['eContent']
+        self.assertTrue(sd.prettyPrint())
+
+        self.assertEqual(
+            rfc5652.id_data, sd['encapContentInfo']['eContentType'])
+        self.assertTrue(sd['encapContentInfo']['eContent'])
+
         v2 = rfc5280.Version(value='v2')
-        assert sd['crls'][0]['crl']['tbsCertList']['version'] == v2
-        ocspr_oid = rfc5940.id_ri_ocsp_response
-        assert sd['crls'][1]['other']['otherRevInfoFormat'] == ocspr_oid
 
-        ocspr, rest = der_decode(sd['crls'][1]['other']['otherRevInfo'],
+        self.assertEqual(v2, sd['crls'][0]['crl']['tbsCertList']['version'])
+
+        ocspr_oid = rfc5940.id_ri_ocsp_response
+
+        self.assertEqual(ocspr_oid, sd['crls'][1]['other']['otherRevInfoFormat'])
+
+        ocspr, rest = der_decoder(
+            sd['crls'][1]['other']['otherRevInfo'],
             asn1Spec=rfc5940.OCSPResponse())
-        assert ocspr.prettyPrint()
+
+        self.assertTrue(ocspr.prettyPrint())
+
         success = rfc2560.OCSPResponseStatus(value='successful')
-        assert ocspr['responseStatus'] == success
+
+        self.assertEqual(success, ocspr['responseStatus'])
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert asn1Object['contentType'] == rfc5652.id_signedData
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
+
         sd_eci = asn1Object['content']['encapContentInfo']
-        assert sd_eci['eContentType'] == rfc5652.id_data
-        assert sd_eci['eContent'].hasValue()
+
+        self.assertEqual(rfc5652.id_data, sd_eci['eContentType'])
+        self.assertTrue(sd_eci['eContent'].hasValue())
 
         for ri in asn1Object['content']['crls']:
             if ri.getName() == 'crl':
                 v2 = rfc5280.Version(value='v2')
-                assert ri['crl']['tbsCertList']['version'] == v2
+                self.assertEqual(v2, ri['crl']['tbsCertList']['version'])
+
             if ri.getName() == 'other':
                 ori = ri['other']
                 ocspr_oid = rfc5940.id_ri_ocsp_response
-                assert ori['otherRevInfoFormat'] == ocspr_oid
+
+                self.assertEqual(ocspr_oid, ori['otherRevInfoFormat'])
+
                 ocspr_status = ori['otherRevInfo']['responseStatus']
                 success = rfc2560.OCSPResponseStatus(value='successful')
-                assert ocspr_status == success
+
+                self.assertEqual(success, ocspr_status)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5958.py b/tests/test_rfc5958.py
index a6cf9b6..980a11e 100644
--- a/tests/test_rfc5958.py
+++ b/tests/test_rfc5958.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import univ
 
 from pyasn1_modules import pem
@@ -30,15 +30,19 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.priv_key_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object['privateKeyAlgorithm']['algorithm'] == rfc8410.id_Ed25519
-        assert asn1Object['privateKey'].isValue
-        assert asn1Object['privateKey'].prettyPrint()[0:10] == "0x0420d4ee"
-        assert asn1Object['publicKey'].isValue
-        assert asn1Object['publicKey'].prettyPrint()[0:10] == "1164575857"
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(
+            rfc8410.id_Ed25519, asn1Object['privateKeyAlgorithm']['algorithm'])
+        self.assertTrue(asn1Object['privateKey'].isValue)
+        self.assertEqual(
+            "0x0420d4ee", asn1Object['privateKey'].prettyPrint()[0:10])
+        self.assertTrue(asn1Object['publicKey'].isValue)
+        self.assertEqual(
+            "1164575857", asn1Object['publicKey'].prettyPrint()[0:10])
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 class PrivateKeyOpenTypesTestCase(unittest.TestCase):
@@ -53,17 +57,24 @@
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.asymmetric_key_pkg_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec, decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert rfc5958.id_ct_KP_aKeyPackage in rfc5652.cmsContentTypesMap.keys()
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertIn(
+            rfc5958.id_ct_KP_aKeyPackage, rfc5652.cmsContentTypesMap)
+
         oneKey = asn1Object['content'][0]
-        assert oneKey['privateKeyAlgorithm']['algorithm'] == rfc8410.id_Ed25519
+
+        self.assertEqual(
+            rfc8410.id_Ed25519, oneKey['privateKeyAlgorithm']['algorithm'])
+
         pkcs_9_at_friendlyName = univ.ObjectIdentifier('1.2.840.113549.1.9.9.20')
-        assert oneKey['attributes'][0]['attrType'] == pkcs_9_at_friendlyName
+
+        self.assertEqual(
+            pkcs_9_at_friendlyName, oneKey['attributes'][0]['attrType'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc5990.py b/tests/test_rfc5990.py
index f23e1bc..7d51d67 100755
--- a/tests/test_rfc5990.py
+++ b/tests/test_rfc5990.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -27,45 +27,57 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['algorithm'] == rfc5990.id_rsa_kem
-        rsa_kem_p, rest = der_decode(asn1Object['parameters'],
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(rfc5990.id_rsa_kem, asn1Object['algorithm'])
+
+        rsa_kem_p, rest = der_decoder(
+            asn1Object['parameters'],
             asn1Spec=rfc5280.algorithmIdentifierMap[rfc5990.id_rsa_kem])
-        assert not rest
-        assert rsa_kem_p.prettyPrint()
-        assert der_encode(rsa_kem_p) == asn1Object['parameters']
 
-        assert rsa_kem_p['kem']['algorithm'] == rfc5990.id_kem_rsa
-        kem_rsa_p, rest = der_decode(rsa_kem_p['kem']['parameters'],
+        self.assertFalse(rest)
+        self.assertTrue(rsa_kem_p.prettyPrint())
+        self.assertEqual(asn1Object['parameters'], der_encoder(rsa_kem_p))
+        self.assertEqual(rfc5990.id_kem_rsa, rsa_kem_p['kem']['algorithm'])
+
+        kem_rsa_p, rest = der_decoder(
+            rsa_kem_p['kem']['parameters'],
             asn1Spec=rfc5280.algorithmIdentifierMap[rfc5990.id_kem_rsa])
-        assert not rest
-        assert kem_rsa_p.prettyPrint()
-        assert der_encode(kem_rsa_p) == rsa_kem_p['kem']['parameters']
 
-        assert kem_rsa_p['keyLength'] == 16
-        assert kem_rsa_p['keyDerivationFunction']['algorithm'] == rfc5990.id_kdf_kdf3
-        kdf_p, rest = der_decode(kem_rsa_p['keyDerivationFunction']['parameters'],
+        self.assertFalse(rest)
+        self.assertTrue(kem_rsa_p.prettyPrint())
+        self.assertEqual(
+            rsa_kem_p['kem']['parameters'], der_encoder(kem_rsa_p))
+        self.assertEqual(16, kem_rsa_p['keyLength'])
+        self.assertEqual(
+            rfc5990.id_kdf_kdf3, kem_rsa_p['keyDerivationFunction']['algorithm'])
+
+        kdf_p, rest = der_decoder(
+            kem_rsa_p['keyDerivationFunction']['parameters'],
             asn1Spec=rfc5280.algorithmIdentifierMap[rfc5990.id_kdf_kdf3])
-        assert not rest
-        assert kdf_p.prettyPrint()
-        assert der_encode(kdf_p) == kem_rsa_p['keyDerivationFunction']['parameters']
+
+        self.assertFalse(rest)
+        self.assertTrue(kdf_p.prettyPrint())
+        self.assertEqual(
+            kem_rsa_p['keyDerivationFunction']['parameters'],
+            der_encoder(kdf_p))
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert asn1Object['algorithm'] == rfc5990.id_rsa_kem
-        assert asn1Object['parameters']['kem']['algorithm'] == rfc5990.id_kem_rsa
-        assert asn1Object['parameters']['kem']['parameters']['keyLength'] == 16
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(rfc5990.id_rsa_kem, asn1Object['algorithm'])
+        self.assertEqual(
+            rfc5990.id_kem_rsa, asn1Object['parameters']['kem']['algorithm'])
+        self.assertEqual(
+            16, asn1Object['parameters']['kem']['parameters']['keyLength'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc6010.py b/tests/test_rfc6010.py
index 6054789..1726a8d 100644
--- a/tests/test_rfc6010.py
+++ b/tests/test_rfc6010.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -24,19 +24,23 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.unconstrained_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['extnID'] == rfc6010.id_pe_cmsContentConstraints
-        evalue, rest = der_decode(asn1Object['extnValue'],
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(
+            rfc6010.id_pe_cmsContentConstraints, asn1Object['extnID'])
+
+        evalue, rest = der_decoder(
+            asn1Object['extnValue'],
             asn1Spec=rfc6010.CMSContentConstraints())
-        assert not rest
-        assert evalue.prettyPrint()
-        assert der_encode(evalue) == asn1Object['extnValue']
 
-        assert evalue[0]['contentType'] == rfc6010.id_ct_anyContentType
+        self.assertFalse(rest)
+        self.assertTrue(evalue.prettyPrint())
+        self.assertEqual(asn1Object['extnValue'], der_encoder(evalue))
+        self.assertEqual(
+            rfc6010.id_ct_anyContentType, evalue[0]['contentType'])
 
 
 class ConstrainedCCCExtensionTestCase(unittest.TestCase):
@@ -52,21 +56,26 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.constrained_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['extnID'] == rfc6010.id_pe_cmsContentConstraints
-        evalue, rest = der_decode(asn1Object['extnValue'],
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(
+            rfc6010.id_pe_cmsContentConstraints, asn1Object['extnID'])
+
+        evalue, rest = der_decoder(
+            asn1Object['extnValue'],
             asn1Spec=rfc6010.CMSContentConstraints())
-        assert not rest
-        assert evalue.prettyPrint()
-        assert der_encode(evalue) == asn1Object['extnValue']
+
+        self.assertFalse(rest)
+        self.assertTrue(evalue.prettyPrint())
+        self.assertEqual(asn1Object['extnValue'], der_encoder(evalue))
 
         constraint_count = 0
         attribute_count = 0
         cannot_count = 0
+
         for ccc in evalue:
             constraint_count += 1
             if ccc['canSource'] == 1:
@@ -74,14 +83,16 @@
             if ccc['attrConstraints'].hasValue():
                 for attr in ccc['attrConstraints']:
                     attribute_count += 1
-        assert constraint_count == 4
-        assert attribute_count == 3
-        assert cannot_count == 1
+
+        self.assertEqual(4, constraint_count)
+        self.assertEqual(3, attribute_count)
+        self.assertEqual(1, cannot_count)
 
     def testExtensionsMap(self):
         substrate = pem.readBase64fromText(self.constrained_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert asn1Object['extnID'] in rfc5280.certificateExtensionsMap.keys()
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertIn(asn1Object['extnID'], rfc5280.certificateExtensionsMap)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc6019.py b/tests/test_rfc6019.py
index 301b0d4..2e08670 100644
--- a/tests/test_rfc6019.py
+++ b/tests/test_rfc6019.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5652
@@ -24,28 +24,29 @@
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
 
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(rfc6019.id_aa_binarySigningTime, asn1Object['attrType'])
 
-        assert asn1Object['attrType'] == rfc6019.id_aa_binarySigningTime
-        bintime, rest = der_decode(asn1Object['attrValues'][0],
-                                   asn1Spec=rfc6019.BinaryTime())
-        assert bintime == 0x5cbf8654
+        bintime, rest = der_decoder(
+            asn1Object['attrValues'][0], asn1Spec=rfc6019.BinaryTime())
+
+        self.assertEqual(0x5cbf8654, bintime)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate,
-                                      asn1Spec=self.asn1Spec,
-                                      decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec,
+            decodeOpenTypes=True)
 
-        assert asn1Object['attrType'] in rfc5652.cmsAttributesMap.keys()
-        assert asn1Object['attrValues'][0] == 0x5cbf8654
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertIn(asn1Object['attrType'], rfc5652.cmsAttributesMap)
+        self.assertEqual(0x5cbf8654, asn1Object['attrValues'][0])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc6031.py b/tests/test_rfc6031.py
index 79ea55e..29a8d86 100644
--- a/tests/test_rfc6031.py
+++ b/tests/test_rfc6031.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5652
@@ -29,50 +29,57 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.key_pkg_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
-    
-        assert asn1Object['contentType'] in rfc5652.cmsContentTypesMap
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertIn(asn1Object['contentType'], rfc5652.cmsContentTypesMap)
+
         asn1Spec = rfc5652.cmsContentTypesMap[asn1Object['contentType']]
-        skp, rest = der_decode(asn1Object['content'], asn1Spec=asn1Spec)
-        assert not rest
-        assert skp.prettyPrint()
-        assert der_encode(skp) == asn1Object['content']
+        skp, rest = der_decoder(asn1Object['content'], asn1Spec=asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(skp.prettyPrint())
+        self.assertEqual(asn1Object['content'], der_encoder(skp))
 
         for attr in skp['sKeyPkgAttrs']:
-            assert attr['attrType'] in rfc6031.sKeyPkgAttributesMap.keys()
+            self.assertIn(attr['attrType'], rfc6031.sKeyPkgAttributesMap)
 
         for osk in skp['sKeys']:
             for attr in osk['sKeyAttrs']:
-                assert attr['attrType'] in rfc6031.sKeyAttributesMap.keys()
+                self.assertIn(attr['attrType'], rfc6031.sKeyAttributesMap)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.key_pkg_pem_text)
-        asn1Object, rest = der_decode(substrate, 
-                                      asn1Spec=self.asn1Spec,
-                                      decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert asn1Object['contentType'] in rfc5652.cmsContentTypesMap
-        assert asn1Object['content'].hasValue()
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertIn(asn1Object['contentType'], rfc5652.cmsContentTypesMap)
+        self.assertTrue(asn1Object['content'].hasValue())
+
         keypkg = asn1Object['content']
-        assert keypkg['version'] == rfc6031.KeyPkgVersion().subtype(value='v1')
+
+        self.assertEqual(
+            rfc6031.KeyPkgVersion().subtype(value='v1'), keypkg['version'])
 
         for attr in keypkg['sKeyPkgAttrs']:
-            assert attr['attrType'] in rfc6031.sKeyPkgAttributesMap.keys()
-            assert attr['attrValues'][0].prettyPrint()[:2] != '0x'
+            self.assertIn(attr['attrType'], rfc6031.sKeyPkgAttributesMap)
+            self.assertNotEqual('0x', attr['attrValues'][0].prettyPrint()[:2])
+
             # decodeOpenTypes=True did not decode if the value is shown in hex ...
             if attr['attrType'] == rfc6031.id_pskc_manufacturer:
                 attr['attrValues'][0] == 'Vigil Security LLC'
 
         for osk in keypkg['sKeys']:
             for attr in osk['sKeyAttrs']:
-                assert attr['attrType'] in rfc6031.sKeyAttributesMap.keys()
-                assert attr['attrValues'][0].prettyPrint()[:2] != '0x'
+                self.assertIn(attr['attrType'], rfc6031.sKeyAttributesMap)
+                self.assertNotEqual(
+                    '0x', attr['attrValues'][0].prettyPrint()[:2])
+
                 # decodeOpenTypes=True did not decode if the value is shown in hex ...
                 if attr['attrType'] == rfc6031.id_pskc_issuer:
                     attr['attrValues'][0] == 'kta.example.com'
diff --git a/tests/test_rfc6032.py b/tests/test_rfc6032.py
index bf6bc6c..287bad8 100644
--- a/tests/test_rfc6032.py
+++ b/tests/test_rfc6032.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.compat.octets import str2octs
 
 from pyasn1_modules import pem
@@ -32,47 +32,62 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.encrypted_key_pkg_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
-        assert asn1Object['contentType'] == rfc6032.id_ct_KP_encryptedKeyPkg
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        content, rest = der_decode(asn1Object['content'], rfc6032.EncryptedKeyPackage())
-        assert not rest
-        assert content.prettyPrint()
-        assert der_encode(content) == asn1Object['content']
-        assert content.getName() == 'encrypted'
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        self.assertEqual(
+            rfc6032.id_ct_KP_encryptedKeyPkg, asn1Object['contentType'])
+
+        content, rest = der_decoder(
+            asn1Object['content'], rfc6032.EncryptedKeyPackage())
+
+        self.assertFalse(rest)
+        self.assertTrue(content.prettyPrint())
+        self.assertEqual(asn1Object['content'], der_encoder(content))
+        self.assertEqual('encrypted', content.getName())
+
         eci = content['encrypted']['encryptedContentInfo']
-        assert eci['contentType'] == rfc6032.id_ct_KP_encryptedKeyPkg
+
+        self.assertEqual(
+            rfc6032.id_ct_KP_encryptedKeyPkg, eci['contentType'])
+
         attrType = content['encrypted']['unprotectedAttrs'][0]['attrType']
-        assert attrType == rfc6032.id_aa_KP_contentDecryptKeyID
+
+        self.assertEqual(rfc6032.id_aa_KP_contentDecryptKeyID, attrType)
 
         attrVal0 = content['encrypted']['unprotectedAttrs'][0]['attrValues'][0]
-        keyid, rest = der_decode(attrVal0, rfc6032.ContentDecryptKeyID())
-        assert not rest
-        assert keyid.prettyPrint()
-        assert der_encode(keyid) == attrVal0
-        assert keyid == b'ptf-kdc-812374'
+        keyid, rest = der_decoder(attrVal0, rfc6032.ContentDecryptKeyID())
+
+        self.assertFalse(rest)
+        self.assertTrue(keyid.prettyPrint())
+        self.assertEqual(attrVal0, der_encoder(keyid))
+        self.assertEqual(str2octs('ptf-kdc-812374'), keyid)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.encrypted_key_pkg_pem_text)
-        asn1Object, rest = der_decode(substrate,
-                                      asn1Spec=self.asn1Spec,
-                                      decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate,
+                                       asn1Spec=self.asn1Spec,
+                                       decodeOpenTypes=True)
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
-        assert asn1Object['contentType'] in rfc5652.cmsContentTypesMap
+        self.assertIn(asn1Object['contentType'], rfc5652.cmsContentTypesMap)
+
         eci = asn1Object['content']['encrypted']['encryptedContentInfo']
-        assert eci['contentType'] in rfc5652.cmsContentTypesMap
+
+        self.assertIn(eci['contentType'], rfc5652.cmsContentTypesMap)
 
         for attr in asn1Object['content']['encrypted']['unprotectedAttrs']:
-            assert attr['attrType'] in rfc5652.cmsAttributesMap.keys()
-            assert attr['attrValues'][0].prettyPrint()[:2] != '0x'
+            self.assertIn(attr['attrType'], rfc5652.cmsAttributesMap)
+            self.assertNotEqual('0x', attr['attrValues'][0].prettyPrint()[:2])
+
             if attr['attrType'] == rfc6032.id_aa_KP_contentDecryptKeyID:
-                assert attr['attrValues'][0] == str2octs('ptf-kdc-812374')
+                self.assertEqual(str2octs(
+                    'ptf-kdc-812374'), attr['attrValues'][0])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc6120.py b/tests/test_rfc6120.py
index 18bf2db..bdedab8 100644
--- a/tests/test_rfc6120.py
+++ b/tests/test_rfc6120.py
@@ -8,8 +8,9 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
+from pyasn1.compat.octets import str2octs
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -41,58 +42,70 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.xmpp_server_cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         count = 0
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_ce_subjectAltName:
-                extnValue, rest = der_decode(extn['extnValue'],
-                    asn1Spec=rfc5280.SubjectAltName())
-                assert not rest
-                assert extnValue.prettyPrint()
-                assert der_encode(extnValue) == extn['extnValue']
+                extnValue, rest = der_decoder(
+                    extn['extnValue'], asn1Spec=rfc5280.SubjectAltName())
+
+                self.assertFalse(rest)
+                self.assertTrue(extnValue.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(extnValue))
+
                 for gn in extnValue:
                     if gn['otherName'].hasValue():
                         gn_on = gn['otherName']
                         if gn_on['type-id'] == rfc6120.id_on_xmppAddr:
-                            assert gn_on['type-id'] in rfc5280.anotherNameMap.keys()
+                            self.assertIn(gn_on['type-id'], rfc5280.anotherNameMap)
+
                             spec = rfc5280.anotherNameMap[gn['otherName']['type-id']]
-                            on, rest = der_decode(gn_on['value'], asn1Spec=spec)
-                            assert not rest
-                            assert on.prettyPrint()
-                            assert der_encode(on) == gn_on['value']
-                            assert on == u'im.example.com'
+                            on, rest = der_decoder(gn_on['value'], asn1Spec=spec)
+
+                            self.assertFalse(rest)
+                            self.assertTrue(on.prettyPrint())
+                            self.assertEqual(gn_on['value'], der_encoder(on))
+                            self.assertEqual('im.example.com', on)
+
                             count += 1
 
-        assert count == 1
+        self.assertEqual(1, count)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.xmpp_server_cert_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate,
+                                       asn1Spec=self.asn1Spec,
+                                       decodeOpenTypes=True)
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         count = 0
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_ce_subjectAltName:
-                extnValue, rest = der_decode(extn['extnValue'],
-                    asn1Spec=rfc5280.SubjectAltName(), decodeOpenTypes=True)
-                assert not rest
-                assert extnValue.prettyPrint()
-                assert der_encode(extnValue) == extn['extnValue']
+                extnValue, rest = der_decoder(
+                    extn['extnValue'], asn1Spec=rfc5280.SubjectAltName(),
+                    decodeOpenTypes=True)
+
+                self.assertFalse(rest)
+                self.assertTrue(extnValue.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(extnValue))
+
                 for gn in extnValue:
                     if gn['otherName'].hasValue():
                         if gn['otherName']['type-id'] == rfc6120.id_on_xmppAddr:
-                            assert gn['otherName']['value'] == u'im.example.com'
+                            self.assertEqual(
+                                'im.example.com', gn['otherName']['value'])
                             count += 1
 
-        assert count == 1
+        self.assertEqual(1, count)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc6187.py b/tests/test_rfc6187.py
index 4a66a23..75c1e91 100644
--- a/tests/test_rfc6187.py
+++ b/tests/test_rfc6187.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -43,21 +43,24 @@
         ]
 
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         count = 0
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_ce_extKeyUsage:
-                extnValue, rest = der_decode(extn['extnValue'],
-                    asn1Spec=rfc5280.ExtKeyUsageSyntax())
+                extnValue, rest = der_decoder(
+                    extn['extnValue'], asn1Spec=rfc5280.ExtKeyUsageSyntax())
+
                 for oid in extnValue:
                     if oid in ssh_eku_oids:
                         count += 1
 
-        assert count == 1
+        self.assertEqual(1, count)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc6210.py b/tests/test_rfc6210.py
index a52e7e8..54d8b66 100644
--- a/tests/test_rfc6210.py
+++ b/tests/test_rfc6210.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -38,27 +38,32 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode (substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['contentType'] == rfc5652.id_ct_authData
-        ad, rest = der_decode (asn1Object['content'], asn1Spec=rfc5652.AuthenticatedData())
-        assert not rest
-        assert ad.prettyPrint()
-        assert der_encode(ad) == asn1Object['content']
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(rfc5652.id_ct_authData, asn1Object['contentType'])
 
-        assert ad['version'] == 0
-        assert ad['digestAlgorithm']['algorithm'] == rfc6210.id_alg_MD5_XOR_EXPERIMENT
+        ad, rest = der_decoder(
+            asn1Object['content'], asn1Spec=rfc5652.AuthenticatedData())
 
-        mac_alg_p, rest = der_decode (ad['digestAlgorithm']['parameters'],
+        self.assertFalse(rest)
+        self.assertTrue(ad.prettyPrint())
+        self.assertEqual(asn1Object['content'], der_encoder(ad))
+        self.assertEqual(0, ad['version'])
+        self.assertEqual(
+            rfc6210.id_alg_MD5_XOR_EXPERIMENT, ad['digestAlgorithm']['algorithm'])
+
+        mac_alg_p, rest = der_decoder(
+            ad['digestAlgorithm']['parameters'],
             asn1Spec=rfc5280.algorithmIdentifierMap[ad['digestAlgorithm']['algorithm']])
-        assert not rest
-        assert mac_alg_p.prettyPrint()
-        assert der_encode(mac_alg_p) == ad['digestAlgorithm']['parameters']
 
-        assert mac_alg_p.prettyPrint()[:10] == "0x01020304"
+        self.assertFalse(rest)
+        self.assertTrue(mac_alg_p.prettyPrint())
+        self.assertEqual(
+            ad['digestAlgorithm']['parameters'], der_encoder(mac_alg_p))
+        self.assertEqual("0x01020304", mac_alg_p.prettyPrint()[:10])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc6211.py b/tests/test_rfc6211.py
index 151092a..040b17a 100644
--- a/tests/test_rfc6211.py
+++ b/tests/test_rfc6211.py
@@ -10,8 +10,8 @@
 
 from pyasn1.type import univ
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5652
 from pyasn1_modules import rfc6211
@@ -52,54 +52,67 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.signed_message_pem_text)
-        asn1Object, rest = der_decode (substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder (substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['contentType'] == rfc5652.id_signedData
-        sd, rest = der_decode(asn1Object['content'], asn1Spec=rfc5652.SignedData())
-        assert not rest
-        assert sd.prettyPrint()
-        assert der_encode(sd) == asn1Object['content'] 
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
+
+        sd, rest = der_decoder(
+            asn1Object['content'], asn1Spec=rfc5652.SignedData())
+
+        self.assertFalse(rest)
+        self.assertTrue(sd.prettyPrint())
+        self.assertEqual(asn1Object['content'], der_encoder(sd))
        
         for sa in sd['signerInfos'][0]['signedAttrs']:
             sat = sa['attrType']
             sav0 = sa['attrValues'][0]
 
             if sat in rfc6211.id_aa_cmsAlgorithmProtect:
-                sav, rest = der_decode(sav0, asn1Spec=rfc6211.CMSAlgorithmProtection())
-                assert not rest
-                assert sav.prettyPrint()
-                assert der_encode(sav) == sav0
+                sav, rest = der_decoder(
+                    sav0, asn1Spec=rfc6211.CMSAlgorithmProtection())
+
+                self.assertFalse(rest)
+                self.assertTrue(sav.prettyPrint())
+                self.assertEqual(sav0, der_encoder(sav))
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.signed_message_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec, decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert asn1Object['contentType'] in rfc5652.cmsContentTypesMap.keys()
-        assert asn1Object['contentType'] == rfc5652.id_signedData
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        self.assertIn(asn1Object['contentType'], rfc5652.cmsContentTypesMap)
+        self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
 
         sd = asn1Object['content']
-        assert sd['version'] == rfc5652.CMSVersion().subtype(value='v1')
+
+        self.assertEqual(
+            rfc5652.CMSVersion().subtype(value='v1'), sd['version'])
 
         ect = sd['encapContentInfo']['eContentType']
-        assert ect in rfc5652.cmsContentTypesMap.keys()
-        assert ect == rfc5652.id_data
+
+        self.assertIn(ect, rfc5652.cmsContentTypesMap)
+        self.assertEqual(rfc5652.id_data, ect)
 
         for sa in sd['signerInfos'][0]['signedAttrs']:
             if sa['attrType'] == rfc6211.id_aa_cmsAlgorithmProtect:
-                assert sa['attrType'] in rfc5652.cmsAttributesMap.keys()
+                self.assertIn(sa['attrType'], rfc5652.cmsAttributesMap)
                 
                 sav0 = sa['attrValues'][0]
                 digest_oid = univ.ObjectIdentifier('2.16.840.1.101.3.4.2.2')
                 sig_oid = univ.ObjectIdentifier('1.2.840.10045.4.3.3')
-                assert sav0['digestAlgorithm']['algorithm'] == digest_oid
-                assert sav0['signatureAlgorithm']['algorithm'] == sig_oid
+
+                self.assertEqual(
+                    digest_oid, sav0['digestAlgorithm']['algorithm'])
+                self.assertEqual(
+                    sig_oid, sav0['signatureAlgorithm']['algorithm'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc6402.py b/tests/test_rfc6402.py
index 8e4bb56..e970dfa 100755
--- a/tests/test_rfc6402.py
+++ b/tests/test_rfc6402.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import char
 from pyasn1.type import namedtype
 from pyasn1.type import univ
@@ -62,10 +62,10 @@
 
         next_layer = rfc5652.id_ct_contentInfo
         while next_layer:
-            asn1Object, rest = der_decode(substrate, asn1Spec=layers[next_layer])
-            assert not rest
-            assert asn1Object.prettyPrint()
-            assert der_encode(asn1Object) == substrate
+            asn1Object, rest = der_decoder(substrate, asn1Spec=layers[next_layer])
+            self.assertFalse(rest)
+            self.assertTrue(asn1Object.prettyPrint())
+            self.assertEqual(substrate, der_encoder(asn1Object))
 
             substrate = getNextSubstrate[next_layer](asn1Object)
             next_layer = getNextLayer[next_layer](asn1Object)
@@ -106,43 +106,49 @@
         openTypeMap.update(rfc6402.cmcControlAttributesMap)
 
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=rfc5652.ContentInfo(),
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=rfc5652.ContentInfo(), decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         eci = asn1Object['content']['encapContentInfo']
-        assert eci['eContentType'] == rfc6402.id_cct_PKIData
+
+        self.assertEqual(rfc6402.id_cct_PKIData, eci['eContentType'])
+
         substrate = eci['eContent']
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=rfc6402.PKIData(),
-            openTypes=openTypeMap,
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=rfc6402.PKIData(), openTypes=openTypeMap,
             decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         for req in asn1Object['reqSequence']:
             cr = req['tcr']['certificationRequest']
 
             sig_alg = cr['signatureAlgorithm']
-            assert sig_alg['algorithm'] in openTypeMap.keys()
-            assert sig_alg['parameters'] == univ.Null("")
+
+            self.assertIn(sig_alg['algorithm'], openTypeMap)
+            self.assertEqual(univ.Null(""), sig_alg['parameters'])
 
             cri = cr['certificationRequestInfo']
             spki_alg = cri['subjectPublicKeyInfo']['algorithm']
-            assert spki_alg['algorithm'] in openTypeMap.keys()
-            assert spki_alg['parameters'] == univ.Null("")
+
+            self.assertIn(spki_alg['algorithm'], openTypeMap)
+            self.assertEqual(univ.Null(""), spki_alg['parameters'])
 
             attrs = cr['certificationRequestInfo']['attributes']
             for attr in attrs:
-                assert attr['attrType'] in openTypeMap.keys()
+                self.assertIn( attr['attrType'], openTypeMap)
+
                 if attr['attrType'] == univ.ObjectIdentifier('1.3.6.1.4.1.311.13.2.3'):
-                    assert attr['attrValues'][0] == "6.2.9200.2"
+                    self.assertEqual("6.2.9200.2", attr['attrValues'][0])
+
                 else:
-                    assert attr['attrValues'][0].hasValue()
+                    self.assertTrue(attr['attrValues'][0].hasValue())
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc6482.py b/tests/test_rfc6482.py
index 44f4580..c2f6a94 100644
--- a/tests/test_rfc6482.py
+++ b/tests/test_rfc6482.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5652
@@ -72,38 +72,41 @@
 
         next_layer = rfc5652.id_ct_contentInfo
         while next_layer:
-            asn1Object, rest = der_decode(substrate, asn1Spec=layers[next_layer])
-            assert not rest
-            assert asn1Object.prettyPrint()
-            assert der_encode(asn1Object) == substrate
+            asn1Object, rest = der_decoder(substrate, asn1Spec=layers[next_layer])
+
+            self.assertFalse(rest)
+            self.assertTrue(asn1Object.prettyPrint())
+            self.assertEqual(substrate, der_encoder(asn1Object))
 
             substrate = getNextSubstrate[next_layer](asn1Object)
             next_layer = getNextLayer[next_layer](asn1Object)
 
-        assert asn1Object['version'] == 0
-        assert asn1Object['asID'] == 58363
+        self.assertEqual(0, asn1Object['version'])
+        self.assertEqual(58363, asn1Object['asID'])
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.roa_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=rfc5652.ContentInfo(),
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=rfc5652.ContentInfo(), decodeOpenTypes=True)
 
-        oid =  asn1Object['content']['encapContentInfo']['eContentType']
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        oid = asn1Object['content']['encapContentInfo']['eContentType']
         substrate = asn1Object['content']['encapContentInfo']['eContent']
-        assert oid in rfc5652.cmsContentTypesMap.keys()
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=rfc5652.cmsContentTypesMap[oid],
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
 
-        assert asn1Object['version'] == 0
-        assert asn1Object['asID'] == 58363
+        self.assertIn(oid, rfc5652.cmsContentTypesMap)
+
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=rfc5652.cmsContentTypesMap[oid],
+            decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(0, asn1Object['version'])
+        self.assertEqual(58363, asn1Object['asID'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc6486.py b/tests/test_rfc6486.py
index 5d5f139..1e0075c 100644
--- a/tests/test_rfc6486.py
+++ b/tests/test_rfc6486.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5652
@@ -57,8 +57,7 @@
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.manifest_pem_text)
 
-        layers = { }
-        layers.update(rfc5652.cmsContentTypesMap)
+        layers = rfc5652.cmsContentTypesMap.copy()
 
         getNextLayer = {
             rfc5652.id_ct_contentInfo: lambda x: x['contentType'],
@@ -73,41 +72,47 @@
         }
 
         next_layer = rfc5652.id_ct_contentInfo
+
         while next_layer:
-            asn1Object, rest = der_decode(substrate, asn1Spec=layers[next_layer])
-            assert not rest
-            assert asn1Object.prettyPrint()
-            assert der_encode(asn1Object) == substrate
+            asn1Object, rest = der_decoder(substrate, asn1Spec=layers[next_layer])
+
+            self.assertFalse(rest)
+            self.assertTrue(asn1Object.prettyPrint())
+            self.assertEqual(substrate, der_encoder(asn1Object))
 
             substrate = getNextSubstrate[next_layer](asn1Object)
             next_layer = getNextLayer[next_layer](asn1Object)
 
-        assert asn1Object['version'] == 0
+        self.assertEqual(0, asn1Object['version'])
+
         for f in asn1Object['fileList']:
-            assert f['file'] == 'ZXSGBDBkL82TFGHuE4VOYtJP-E4.crl'
+            self.assertEqual('ZXSGBDBkL82TFGHuE4VOYtJP-E4.crl', f['file'])
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.manifest_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=rfc5652.ContentInfo(),
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=rfc5652.ContentInfo(), decodeOpenTypes=True)
 
-        oid =  asn1Object['content']['encapContentInfo']['eContentType']
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        oid = asn1Object['content']['encapContentInfo']['eContentType']
         substrate = asn1Object['content']['encapContentInfo']['eContent']
-        assert oid in rfc5652.cmsContentTypesMap.keys()
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=rfc5652.cmsContentTypesMap[oid],
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
 
-        assert asn1Object['version'] == 0
+        self.assertIn(oid, rfc5652.cmsContentTypesMap)
+
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=rfc5652.cmsContentTypesMap[oid],
+            decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(0, asn1Object['version'])
+
         for f in asn1Object['fileList']:
-            assert f['file'] == 'ZXSGBDBkL82TFGHuE4VOYtJP-E4.crl'
+            self.assertEqual('ZXSGBDBkL82TFGHuE4VOYtJP-E4.crl', f['file'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc6487.py b/tests/test_rfc6487.py
index d6af7c6..9e42d07 100644
--- a/tests/test_rfc6487.py
+++ b/tests/test_rfc6487.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -58,23 +58,25 @@
         ]
 
         substrate = pem.readBase64fromText(self.rpki_cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         count = 0
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_pe_subjectInfoAccess:
-                extnValue, rest = der_decode(extn['extnValue'],
-                    asn1Spec=rfc5280.SubjectInfoAccessSyntax())
+                extnValue, rest = der_decoder(
+                    extn['extnValue'], asn1Spec=rfc5280.SubjectInfoAccessSyntax())
                 for ad in extnValue:
                     if ad['accessMethod'] in access_methods:
                         uri = ad['accessLocation']['uniformResourceIdentifier']
-                        assert 'rpki.apnic.net' in uri
+                        self.assertIn('rpki.apnic.net', uri)
                         count += 1
 
-        assert count == 1
+        self.assertEqual(1, count)
 
 
 class CertificateWithSignedObjectTestCase(unittest.TestCase):
@@ -117,23 +119,24 @@
         ]
 
         substrate = pem.readBase64fromText(self.rpki_cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         count = 0
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_pe_subjectInfoAccess:
-                extnValue, rest = der_decode(extn['extnValue'],
-                    asn1Spec=rfc5280.SubjectInfoAccessSyntax())
+                extnValue, rest = der_decoder(
+                    extn['extnValue'], asn1Spec=rfc5280.SubjectInfoAccessSyntax())
                 for ad in extnValue:
                     if ad['accessMethod'] in access_methods:
                         uri = ad['accessLocation']['uniformResourceIdentifier']
-                        assert 'ca.rg.net' in uri
+                        self.assertIn('ca.rg.net', uri)
                         count += 1
 
-        assert count == 1
+        self.assertEqual(1, count)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc6664.py b/tests/test_rfc6664.py
index 0e1f0cf..83278a7 100644
--- a/tests/test_rfc6664.py
+++ b/tests/test_rfc6664.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5480
@@ -37,51 +37,52 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.smime_capabilities_pem_text)
-        asn1Object, rest = der_decode (substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         count = 0
         for cap in asn1Object:
             if cap['capabilityID'] in rfc5751.smimeCapabilityMap.keys():
                 substrate = cap['parameters']
-                cap_p, rest = der_decode (substrate,
-                    asn1Spec=rfc5751.smimeCapabilityMap[cap['capabilityID']])
-                assert not rest
-                assert cap_p.prettyPrint()
-                assert der_encode(cap_p) == substrate
+                cap_p, rest = der_decoder(
+                    substrate, asn1Spec=rfc5751.smimeCapabilityMap[cap['capabilityID']])
+                self.assertFalse(rest)
+                self.assertTrue(cap_p.prettyPrint())
+                self.assertEqual(substrate, der_encoder(cap_p))
                 count += 1
 
-        assert count == 8
+        self.assertEqual(8, count)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.smime_capabilities_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         parameterValue = {
-            rfc6664.rsaEncryption:  lambda x: x['maxKeySize'],
-            rfc6664.id_RSAES_OAEP:  lambda x: x['maxKeySize'],
-            rfc6664.id_RSASSA_PSS:  lambda x: x['minKeySize'],
-            rfc6664.id_dsa:         lambda x: x['keySizes']['maxKeySize'],
+            rfc6664.rsaEncryption: lambda x: x['maxKeySize'],
+            rfc6664.id_RSAES_OAEP: lambda x: x['maxKeySize'],
+            rfc6664.id_RSASSA_PSS: lambda x: x['minKeySize'],
+            rfc6664.id_dsa: lambda x: x['keySizes']['maxKeySize'],
             rfc6664.dhpublicnumber: lambda x: x['keyParams']['q'] % 1023,
             rfc6664.id_ecPublicKey: lambda x: x[0]['namedCurve'],
-            rfc6664.id_ecMQV:       lambda x: x[1]['namedCurve'],
+            rfc6664.id_ecMQV: lambda x: x[1]['namedCurve'],
         }
 
         expectedValue = {
-            rfc6664.rsaEncryption:  4096,
-            rfc6664.id_RSAES_OAEP:  4096,
-            rfc6664.id_RSASSA_PSS:  1024,
-            rfc6664.id_dsa:         3072,
+            rfc6664.rsaEncryption: 4096,
+            rfc6664.id_RSAES_OAEP: 4096,
+            rfc6664.id_RSASSA_PSS: 1024,
+            rfc6664.id_dsa: 3072,
             rfc6664.dhpublicnumber: 257,
             rfc6664.id_ecPublicKey: rfc5480.secp256r1,
-            rfc6664.id_ecMQV:       rfc5480.secp384r1,
+            rfc6664.id_ecMQV: rfc5480.secp384r1,
         }
 
         count = 0
@@ -89,10 +90,10 @@
             if cap['capabilityID'] in parameterValue.keys():
                 pValue = parameterValue[cap['capabilityID']](cap['parameters'])
                 eValue = expectedValue[cap['capabilityID']]
-                assert pValue == eValue
+                self.assertEqual(eValue, pValue)
                 count += 1
 
-        assert count == 7
+        self.assertEqual(7, count)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc6955.py b/tests/test_rfc6955.py
index 0476d5c..443d70d 100644
--- a/tests/test_rfc6955.py
+++ b/tests/test_rfc6955.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import univ
 
 from pyasn1_modules import pem
@@ -46,41 +46,52 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         spki_a = asn1Object['certificationRequestInfo']['subjectPublicKeyInfo']['algorithm']
-        assert spki_a['algorithm'] == rfc5480.dhpublicnumber
-        assert spki_a['algorithm'] in rfc5280.algorithmIdentifierMap.keys()
-        params, rest = der_decode(spki_a['parameters'], asn1Spec=rfc6955.DomainParameters())
-        assert not rest
-        assert params.prettyPrint()
-        assert der_encode(params) == spki_a['parameters']
-        assert params['validationParms']['pgenCounter'] == 55
+
+        self.assertEqual(rfc5480.dhpublicnumber, spki_a['algorithm'])
+        self.assertIn(spki_a['algorithm'], rfc5280.algorithmIdentifierMap)
+
+        params, rest = der_decoder(
+            spki_a['parameters'], asn1Spec=rfc6955.DomainParameters())
+
+        self.assertFalse(rest)
+        self.assertTrue(params.prettyPrint())
+        self.assertEqual(spki_a['parameters'], der_encoder(params))
+        self.assertEqual(55, params['validationParms']['pgenCounter'])
 
         sig_a = asn1Object['signatureAlgorithm']
-        assert sig_a['algorithm'] == rfc6955.id_dhPop_static_sha1_hmac_sha1
-        assert sig_a['algorithm'] in rfc5280.algorithmIdentifierMap.keys()
-        assert sig_a['parameters'] == der_encode(univ.Null(""))
+
+        self.assertEqual(
+            rfc6955.id_dhPop_static_sha1_hmac_sha1, sig_a['algorithm'])
+        self.assertIn(sig_a['algorithm'], rfc5280.algorithmIdentifierMap)
+        self.assertEqual(sig_a['parameters'], der_encoder(univ.Null("")))
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate,
-           asn1Spec=self.asn1Spec,
-           decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         spki_a = asn1Object['certificationRequestInfo']['subjectPublicKeyInfo']['algorithm']
-        assert spki_a['algorithm'] == rfc5480.dhpublicnumber
-        assert spki_a['parameters']['validationParms']['pgenCounter'] == 55
+
+        self.assertEqual(rfc5480.dhpublicnumber, spki_a['algorithm'])
+        self.assertEqual(
+            55, spki_a['parameters']['validationParms']['pgenCounter'])
 
         sig_a = asn1Object['signatureAlgorithm']
-        assert sig_a['algorithm'] == rfc6955.id_dhPop_static_sha1_hmac_sha1
-        assert sig_a['parameters'] == univ.Null("")
+
+        self.assertEqual(
+            rfc6955.id_dhPop_static_sha1_hmac_sha1, sig_a['algorithm'])
+        self.assertEqual(univ.Null(""), sig_a['parameters'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc6960.py b/tests/test_rfc6960.py
index 936bfca..151c934 100644
--- a/tests/test_rfc6960.py
+++ b/tests/test_rfc6960.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import univ
 
 from pyasn1_modules import pem
@@ -29,39 +29,43 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.ocsp_req_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['tbsRequest']['version'] == 0
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(0, asn1Object['tbsRequest']['version'])
 
         count = 0
         for extn in asn1Object['tbsRequest']['requestExtensions']:
-            assert extn['extnID'] in rfc5280.certificateExtensionsMap.keys()
-            ev, rest = der_decode(extn['extnValue'],
+            self.assertIn(extn['extnID'], rfc5280.certificateExtensionsMap)
+
+            ev, rest = der_decoder(
+                extn['extnValue'],
                 asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-            assert not rest
-            assert ev.prettyPrint()
-            assert der_encode(ev) == extn['extnValue']
+
+            self.assertFalse(rest)
+            self.assertTrue(ev.prettyPrint())
+            self.assertEqual(extn['extnValue'], der_encoder(ev))
+
             count += 1
 
-        assert count == 1
+        self.assertEqual(1, count)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.ocsp_req_pem_text)
-        asn1Object, rest = der_decode(substrate,
-           asn1Spec=self.asn1Spec,
-           decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert asn1Object['tbsRequest']['version'] == 0
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(0, asn1Object['tbsRequest']['version'])
+
         for req in  asn1Object['tbsRequest']['requestList']:
             ha = req['reqCert']['hashAlgorithm']
-            assert ha['algorithm'] == rfc4055.id_sha1
-            assert ha['parameters'] == univ.Null("")
+            self.assertEqual(rfc4055.id_sha1, ha['algorithm'])
+            self.assertEqual(univ.Null(""), ha['parameters'])
 
 
 class OCSPResponseTestCase(unittest.TestCase):
@@ -95,62 +99,74 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.ocsp_resp_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['responseStatus'] == 0
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(0, asn1Object['responseStatus'])
+
         rb = asn1Object['responseBytes']
-        assert rb['responseType'] in rfc6960.ocspResponseMap.keys()
-        resp, rest = der_decode(rb['response'],
-                asn1Spec=rfc6960.ocspResponseMap[rb['responseType']])
-        assert not rest
-        assert resp.prettyPrint()
-        assert der_encode(resp) == rb['response']
 
-        resp['tbsResponseData']['version'] == 0
+        self.assertIn(rb['responseType'], rfc6960.ocspResponseMap)
+
+        resp, rest = der_decoder(
+            rb['response'], asn1Spec=rfc6960.ocspResponseMap[rb['responseType']])
+
+        self.assertFalse(rest)
+        self.assertTrue(resp.prettyPrint())
+        self.assertEqual(rb['response'], der_encoder(resp))
+        self.assertEqual(0, resp['tbsResponseData']['version'])
+
         count = 0
         for extn in resp['tbsResponseData']['responseExtensions']:
-            assert extn['extnID'] in rfc5280.certificateExtensionsMap.keys()
-            ev, rest = der_decode(extn['extnValue'],
+            self.assertIn(extn['extnID'], rfc5280.certificateExtensionsMap)
+
+            ev, rest = der_decoder(
+                extn['extnValue'],
                 asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-            assert not rest
-            assert ev.prettyPrint()
-            assert der_encode(ev) == extn['extnValue']
+
+            self.assertFalse(rest)
+            self.assertTrue(ev.prettyPrint())
+            self.assertEqual(extn['extnValue'], der_encoder(ev))
+
             count += 1
 
-        assert count == 1
+        self.assertEqual(1, count)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.ocsp_resp_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert asn1Object['responseStatus'] == 0
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(0, asn1Object['responseStatus'])
+
         rb = asn1Object['responseBytes']
-        assert rb['responseType'] in rfc6960.ocspResponseMap.keys()
-        resp, rest = der_decode(rb['response'],
-                asn1Spec=rfc6960.ocspResponseMap[rb['responseType']],
-                decodeOpenTypes=True)
-        assert not rest
-        assert resp.prettyPrint()
-        assert der_encode(resp) == rb['response']
 
-        resp['tbsResponseData']['version'] == 0
+        self.assertIn(rb['responseType'], rfc6960.ocspResponseMap)
+
+        resp, rest = der_decoder(
+            rb['response'],
+            asn1Spec=rfc6960.ocspResponseMap[rb['responseType']],
+            decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(resp.prettyPrint())
+        self.assertEqual(rb['response'], der_encoder(resp))
+        self.assertEqual(0, resp['tbsResponseData']['version'])
+
         for rdn in resp['tbsResponseData']['responderID']['byName']['rdnSequence']:
             for attr in rdn:
                 if attr['type'] == rfc5280.id_emailAddress:
-                    assert attr['value'] == 'info@snmplabs.com'
+                    self.assertEqual('info@snmplabs.com', attr['value'])
 
         for r in resp['tbsResponseData']['responses']:
             ha = r['certID']['hashAlgorithm']
-            assert ha['algorithm'] == rfc4055.id_sha1
-            assert ha['parameters'] == univ.Null("")
+            self.assertEqual(rfc4055.id_sha1, ha['algorithm'])
+            self.assertEqual(univ.Null(""), ha['parameters'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc7030.py b/tests/test_rfc7030.py
index 521dc6b..7d011f0 100644
--- a/tests/test_rfc7030.py
+++ b/tests/test_rfc7030.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import univ
 
 from pyasn1_modules import pem
@@ -23,60 +23,64 @@
 BgcrBgEBAQEWBggqhkjOPQQDAw==
 """
 
-    the_oids = (univ.ObjectIdentifier('1.2.840.113549.1.9.7'),
-                univ.ObjectIdentifier('1.2.840.10045.4.3.3'),
+    the_oids = (
+        univ.ObjectIdentifier('1.2.840.113549.1.9.7'),
+        univ.ObjectIdentifier('1.2.840.10045.4.3.3')
     )
 
-    the_attrTypes = (univ.ObjectIdentifier('1.2.840.10045.2.1'),
-                     univ.ObjectIdentifier('1.2.840.113549.1.9.14'),
+    the_attrTypes = (
+        univ.ObjectIdentifier('1.2.840.10045.2.1'),
+        univ.ObjectIdentifier('1.2.840.113549.1.9.14'),
     )
 
-    the_attrVals = ('1.3.132.0.34',
-                    '1.3.6.1.1.1.1.22',
+    the_attrVals = (
+        '1.3.132.0.34',
+        '1.3.6.1.1.1.1.22',
     )
 
-
     def setUp(self):
         self.asn1Spec = rfc7030.CsrAttrs()
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         for attr_or_oid in asn1Object:
             if attr_or_oid.getName() == 'oid':
-                assert attr_or_oid['oid'] in self.the_oids
+                self.assertIn(attr_or_oid['oid'], self.the_oids)
 
             if attr_or_oid.getName() == 'attribute':
-                assert attr_or_oid['attribute']['attrType'] in self.the_attrTypes
+                self.assertIn(
+                    attr_or_oid['attribute']['attrType'], self.the_attrTypes)
 
     def testOpenTypes(self):
-        openTypesMap = { }
-        openTypesMap.update(rfc5652.cmsAttributesMap)
+        openTypesMap = rfc5652.cmsAttributesMap.copy()
+
         for at in self.the_attrTypes:
-            openTypesMap.update({ at: univ.ObjectIdentifier(), })
+            openTypesMap.update({at: univ.ObjectIdentifier()})
 
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            openTypes=openTypesMap,
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, openTypes=openTypesMap,
             decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         for attr_or_oid in asn1Object:
             if attr_or_oid.getName() == 'attribute':
                 valString = attr_or_oid['attribute']['attrValues'][0].prettyPrint()
-        
+
                 if attr_or_oid['attribute']['attrType'] == self.the_attrTypes[0]:
-                    assert valString == self.the_attrVals[0]
-            
+                    self.assertEqual(self.the_attrVals[0], valString)
+
                 if attr_or_oid['attribute']['attrType'] == self.the_attrTypes[1]:
-                    assert valString == self.the_attrVals[1]
+                    self.assertEqual(self.the_attrVals[1], valString)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc7191.py b/tests/test_rfc7191.py
index efb6dbb..40afbd4 100644
--- a/tests/test_rfc7191.py
+++ b/tests/test_rfc7191.py
@@ -9,8 +9,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5652
@@ -57,48 +57,52 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.message1_pem_text)
-        asn1Object, rest = der_decode (substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['contentType'] == rfc5652.id_signedData
-        sd, rest = der_decode (asn1Object['content'], 
-            asn1Spec=rfc5652.SignedData())
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
+
+        sd, rest = der_decoder(
+            asn1Object['content'], asn1Spec=rfc5652.SignedData())
 
         for sa in sd['signerInfos'][0]['signedAttrs']:
             sat = sa['attrType']
             sav0 = sa['attrValues'][0]
 
             if sat == rfc7191.id_aa_KP_keyPkgIdAndReceiptReq:
-                sav, rest = der_decode(sav0, 
-                    asn1Spec=rfc7191.KeyPkgIdentifierAndReceiptReq())
-                assert not rest
-                assert sav.prettyPrint()
-                assert der_encode(sav) == sav0
- 
+                sav, rest = der_decoder(
+                    sav0, asn1Spec=rfc7191.KeyPkgIdentifierAndReceiptReq())
+
+                self.assertFalse(rest)
+                self.assertTrue(sav.prettyPrint())
+                self.assertEqual(sav0, der_encoder(sav))
+
                 package_id_pem_text = "J7icVjsWIlGdF4cceb+siG3f+D0="
                 package_id = pem.readBase64fromText(package_id_pem_text)
-                assert sav['pkgID'] == package_id
+
+                self.assertEqual(package_id, sav['pkgID'])
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.message1_pem_text)
-        asn1Object, rest = der_decode (substrate,
-                                       asn1Spec=self.asn1Spec,
-                                       decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert asn1Object['contentType'] == rfc5652.id_signedData
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
+
         v3 = rfc5652.CMSVersion().subtype(value='v3')
-        assert asn1Object['content']['version'] == v3
+
+        self.assertEqual(v3, asn1Object['content']['version'])
 
         for sa in asn1Object['content']['signerInfos'][0]['signedAttrs']:
             if sa['attrType'] == rfc7191.id_aa_KP_keyPkgIdAndReceiptReq:
                 package_id_pem_text = "J7icVjsWIlGdF4cceb+siG3f+D0="
                 package_id = pem.readBase64fromText(package_id_pem_text)
-                assert sa['attrValues'][0]['pkgID'] == package_id
+                self.assertEqual(package_id, sa['attrValues'][0]['pkgID'])
 
 
 class ReceiptTestCase(unittest.TestCase):
@@ -132,60 +136,72 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.message2_pem_text)
-        asn1Object, rest = der_decode (substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['contentType'] == rfc5652.id_signedData
-        sd, rest = der_decode (asn1Object['content'],
-            asn1Spec=rfc5652.SignedData())
-        assert not rest
-        assert sd.prettyPrint()
-        assert der_encode(sd) == asn1Object['content']
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
+
+        sd, rest = der_decoder(
+            asn1Object['content'], asn1Spec=rfc5652.SignedData())
+
+        self.assertFalse(rest)
+        self.assertTrue(sd.prettyPrint())
+        self.assertEqual(asn1Object['content'], der_encoder(sd))
 
         oid = sd['encapContentInfo']['eContentType']
-        assert oid == rfc7191.id_ct_KP_keyPackageReceipt
-        receipt, rest = der_decode(sd['encapContentInfo']['eContent'],
+
+        self.assertEqual(rfc7191.id_ct_KP_keyPackageReceipt, oid)
+
+        receipt, rest = der_decoder(
+            sd['encapContentInfo']['eContent'],
             asn1Spec=rfc7191.KeyPackageReceipt())
-        assert not rest
-        assert receipt.prettyPrint()
-        assert der_encode(receipt) == sd['encapContentInfo']['eContent']
+
+        self.assertFalse(rest)
+        self.assertTrue(receipt.prettyPrint())
+        self.assertEqual(sd['encapContentInfo']['eContent'], der_encoder(receipt))
 
         package_id_pem_text = "J7icVjsWIlGdF4cceb+siG3f+D0="
         package_id = pem.readBase64fromText(package_id_pem_text)
-        assert receipt['receiptOf']['pkgID'] == package_id
+
+        self.assertEqual(package_id, receipt['receiptOf']['pkgID'])
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.message2_pem_text)
-        asn1Object, rest = der_decode (substrate,
-                                       asn1Spec=self.asn1Spec,
-                                       decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert asn1Object['contentType'] == rfc5652.id_signedData
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
+
         v3 = rfc5652.CMSVersion().subtype(value='v3')
-        assert asn1Object['content']['version'] == v3
+
+        self.assertEqual(v3, asn1Object['content']['version'])
 
         for sa in asn1Object['content']['signerInfos'][0]['signedAttrs']:
-            assert sa['attrType'] in rfc5652.cmsAttributesMap.keys()
+            self.assertIn( sa['attrType'], rfc5652.cmsAttributesMap)
             if sa['attrType'] == rfc5652.id_messageDigest:
-                assert '0x412598a6ae2' in sa['attrValues'][0].prettyPrint()
+                self.assertIn(
+                    '0x412598a6ae2', sa['attrValues'][0].prettyPrint())
 
         ct_oid = asn1Object['content']['encapContentInfo']['eContentType']
-        assert ct_oid in rfc5652.cmsContentTypesMap
-        assert ct_oid == rfc7191.id_ct_KP_keyPackageReceipt
+
+        self.assertIn(ct_oid, rfc5652.cmsContentTypesMap)
+        self.assertEqual(ct_oid, rfc7191.id_ct_KP_keyPackageReceipt)
 
         # Since receipt is inside an OCTET STRING, decodeOpenTypes=True cannot
         # automatically decode it
         sd_eci = asn1Object['content']['encapContentInfo']
-        receipt, rest = der_decode(sd_eci['eContent'],
+        receipt, rest = der_decoder(
+            sd_eci['eContent'],
             asn1Spec=rfc5652.cmsContentTypesMap[sd_eci['eContentType']])
         package_id_pem_text = "J7icVjsWIlGdF4cceb+siG3f+D0="
         package_id = pem.readBase64fromText(package_id_pem_text)
-        assert receipt['receiptOf']['pkgID'] == package_id
+
+        self.assertEqual(package_id, receipt['receiptOf']['pkgID'])
 
 
 class ErrorTestCase(unittest.TestCase):
@@ -219,62 +235,75 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.message3_pem_text)
-        asn1Object, rest = der_decode (substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['contentType'] == rfc5652.id_signedData
-        sd, rest = der_decode (asn1Object['content'],
-            asn1Spec=rfc5652.SignedData())
-        assert not rest
-        assert sd.prettyPrint()
-        assert der_encode(sd) == asn1Object['content']
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
+
+        sd, rest = der_decoder(
+            asn1Object['content'], asn1Spec=rfc5652.SignedData())
+
+        self.assertFalse(rest)
+        self.assertTrue(sd.prettyPrint())
+        self.assertEqual(asn1Object['content'], der_encoder(sd))
 
         oid = sd['encapContentInfo']['eContentType']
-        assert oid == rfc7191.id_ct_KP_keyPackageError
-        kpe, rest = der_decode(sd['encapContentInfo']['eContent'],
+
+        self.assertEqual(rfc7191.id_ct_KP_keyPackageError, oid)
+
+        kpe, rest = der_decoder(
+            sd['encapContentInfo']['eContent'],
             asn1Spec=rfc7191.KeyPackageError())
-        assert not rest
-        assert kpe.prettyPrint()
-        assert der_encode(kpe) == sd['encapContentInfo']['eContent']
+
+        self.assertFalse(rest)
+        self.assertTrue(kpe.prettyPrint())
+        self.assertEqual(sd['encapContentInfo']['eContent'], der_encoder(kpe))
 
         package_id_pem_text = "J7icVjsWIlGdF4cceb+siG3f+D0="
         package_id = pem.readBase64fromText(package_id_pem_text)
-        assert kpe['errorOf']['pkgID'] == package_id
-        assert kpe['errorCode'] == rfc7191.EnumeratedErrorCode(value=10)
+
+        self.assertEqual(package_id, kpe['errorOf']['pkgID'])
+        self.assertEqual(
+            rfc7191.EnumeratedErrorCode(value=10), kpe['errorCode'])
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.message3_pem_text)
-        asn1Object, rest = der_decode (substrate,
-                                       asn1Spec=self.asn1Spec,
-                                       decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert asn1Object['contentType'] == rfc5652.id_signedData
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
+
         v3 = rfc5652.CMSVersion().subtype(value='v3')
-        assert asn1Object['content']['version'] == v3
+
+        self.assertEqual(v3, asn1Object['content']['version'])
 
         for sa in asn1Object['content']['signerInfos'][0]['signedAttrs']:
-            assert sa['attrType'] in rfc5652.cmsAttributesMap.keys()
+            self.assertIn(sa['attrType'], rfc5652.cmsAttributesMap)
             if sa['attrType'] == rfc5652.id_messageDigest:
-                assert '0xa05c54d4737' in sa['attrValues'][0].prettyPrint()
+                self.assertIn(
+                    '0xa05c54d4737', sa['attrValues'][0].prettyPrint())
 
         ct_oid = asn1Object['content']['encapContentInfo']['eContentType']
-        assert ct_oid in rfc5652.cmsContentTypesMap.keys()
-        assert ct_oid == rfc7191.id_ct_KP_keyPackageError
+
+        self.assertIn(ct_oid, rfc5652.cmsContentTypesMap)
+        self.assertEqual(rfc7191.id_ct_KP_keyPackageError, ct_oid)
 
         # Since receipt is inside an OCTET STRING, decodeOpenTypes=True cannot
         # automatically decode it
         sd_eci = asn1Object['content']['encapContentInfo']
-        kpe, rest = der_decode(sd_eci['eContent'],
+        kpe, rest = der_decoder(
+            sd_eci['eContent'],
             asn1Spec=rfc5652.cmsContentTypesMap[sd_eci['eContentType']])
         package_id_pem_text = "J7icVjsWIlGdF4cceb+siG3f+D0="
         package_id = pem.readBase64fromText(package_id_pem_text)
-        assert kpe['errorOf']['pkgID'] == package_id
-        assert kpe['errorCode'] == rfc7191.EnumeratedErrorCode(value=10)
+
+        self.assertEqual(package_id, kpe['errorOf']['pkgID'])
+        self.assertEqual(rfc7191.EnumeratedErrorCode(value=10), kpe['errorCode'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc7229.py b/tests/test_rfc7229.py
index de5dbda..915b9be 100644
--- a/tests/test_rfc7229.py
+++ b/tests/test_rfc7229.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -53,19 +53,23 @@
         ]
 
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         count = 0
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] in rfc5280.certificateExtensionsMap.keys():
                 s = extn['extnValue']
-                ev, rest = der_decode(s, rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert not rest
-                assert ev.prettyPrint()
-                assert s == der_encode(ev)
+                ev, rest = der_decoder(
+                    s, rfc5280.certificateExtensionsMap[extn['extnID']])
+
+                self.assertFalse(rest)
+                self.assertTrue(ev.prettyPrint())
+                self.assertEqual(s, der_encoder(ev))
 
                 if extn['extnID'] == rfc5280.id_ce_certificatePolicies:
                     for pol in ev:
@@ -79,7 +83,7 @@
                         if pmap['subjectDomainPolicy'] in test_oids:
                             count += 1
 
-        assert count == 6
+        self.assertEqual(6, count)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc7292.py b/tests/test_rfc7292.py
index 5fdb2c7..583d396 100644
--- a/tests/test_rfc7292.py
+++ b/tests/test_rfc7292.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import univ
 
 from pyasn1_modules import pem
@@ -73,91 +73,108 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pfx_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['version'] == univ.Integer(3)
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(3, asn1Object['version'])
+
         oid = asn1Object['macData']['mac']['digestAlgorithm']['algorithm']
-        assert oid ==  univ.ObjectIdentifier('1.3.14.3.2.26')
+
+        self.assertEqual(univ.ObjectIdentifier('1.3.14.3.2.26'), oid)
+
         md_hex = asn1Object['macData']['mac']['digest'].prettyPrint()
-        assert md_hex == '0xa5608ffdf651d132b90701aeaaf4ddd3e76e88a7'
 
-        assert asn1Object['authSafe']['contentType'] == rfc5652.id_data
-        data, rest = der_decode(asn1Object['authSafe']['content'], 
-            asn1Spec=univ.OctetString())
-        assert not rest
+        self.assertEqual('0xa5608ffdf651d132b90701aeaaf4ddd3e76e88a7', md_hex)
+        self.assertEqual(
+            rfc5652.id_data, asn1Object['authSafe']['contentType'])
 
-        authsafe, rest = der_decode(data, asn1Spec=rfc7292.AuthenticatedSafe())
-        assert not rest
-        assert authsafe.prettyPrint()
-        assert der_encode(authsafe) == data
+        data, rest = der_decoder(
+            asn1Object['authSafe']['content'], asn1Spec=univ.OctetString())
+
+        self.assertFalse(rest)
+
+        authsafe, rest = der_decoder(data, asn1Spec=rfc7292.AuthenticatedSafe())
+
+        self.assertFalse(rest)
+        self.assertTrue(authsafe.prettyPrint())
+        self.assertEqual(data, der_encoder(authsafe))
 
         for ci in authsafe:
-            assert ci['contentType'] == rfc5652.id_data
-            data, rest = der_decode(ci['content'], asn1Spec=univ.OctetString())
-            assert not rest
+            self.assertEqual(rfc5652.id_data, ci['contentType'])
 
-            sc, rest = der_decode(data, asn1Spec=rfc7292.SafeContents())
-            assert not rest
-            assert sc.prettyPrint()
-            assert der_encode(sc) == data
+            data, rest = der_decoder(ci['content'], asn1Spec=univ.OctetString())
+
+            self.assertFalse(rest)
+
+            sc, rest = der_decoder(data, asn1Spec=rfc7292.SafeContents())
+
+            self.assertFalse(rest)
+            self.assertTrue(sc.prettyPrint())
+            self.assertEqual(data, der_encoder(sc))
 
             for sb in sc:
                 if sb['bagId'] in rfc7292.pkcs12BagTypeMap:
-                    bv, rest = der_decode(sb['bagValue'],
-                       asn1Spec=rfc7292.pkcs12BagTypeMap[sb['bagId']])
-                    assert not rest
-                    assert bv.prettyPrint()
-                    assert der_encode(bv) == sb['bagValue']
+                    bv, rest = der_decoder(
+                        sb['bagValue'],
+                        asn1Spec=rfc7292.pkcs12BagTypeMap[sb['bagId']])
+
+                    self.assertFalse(rest)
+                    self.assertTrue(bv.prettyPrint())
+                    self.assertEqual(sb['bagValue'], der_encoder(bv))
 
                     for attr in sb['bagAttributes']:
                         if attr['attrType'] in rfc5652.cmsAttributesMap:
-                            av, rest = der_decode(attr['attrValues'][0],
+                            av, rest = der_decoder(
+                                attr['attrValues'][0],
                                 asn1Spec=rfc5652.cmsAttributesMap[attr['attrType']])
-                            assert not rest
-                            assert av.prettyPrint()
-                            assert der_encode(av) == attr['attrValues'][0]
+                            self.assertFalse(rest)
+                            self.assertTrue(av.prettyPrint())
+                            self.assertEqual(
+                                attr['attrValues'][0], der_encoder(av))
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.pfx_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True
-        )
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         digest_alg = asn1Object['macData']['mac']['digestAlgorithm']
-        assert not digest_alg['parameters'].hasValue()
 
-        authsafe, rest = der_decode(asn1Object['authSafe']['content'],
+        self.assertFalse(digest_alg['parameters'].hasValue())
+
+        authsafe, rest = der_decoder(
+            asn1Object['authSafe']['content'],
             asn1Spec=rfc7292.AuthenticatedSafe(),
-            decodeOpenTypes=True
-        )
-        assert not rest
-        assert authsafe.prettyPrint()
-        assert der_encode(authsafe) == asn1Object['authSafe']['content']
+            decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(authsafe.prettyPrint())
+        self.assertEqual(
+            asn1Object['authSafe']['content'], der_encoder(authsafe))
 
         for ci in authsafe:
-            assert ci['contentType'] == rfc5652.id_data
-            sc, rest = der_decode(ci['content'],
-                asn1Spec=rfc7292.SafeContents(),
-                decodeOpenTypes=True
-            )
-            assert not rest
-            assert sc.prettyPrint()
-            assert der_encode(sc) == ci['content']
-    
+            self.assertEqual(rfc5652.id_data, ci['contentType'])
+            sc, rest = der_decoder(
+                ci['content'], asn1Spec=rfc7292.SafeContents(),
+                decodeOpenTypes=True)
+
+            self.assertFalse(rest)
+            self.assertTrue(sc.prettyPrint())
+            self.assertEqual(ci['content'], der_encoder(sc))
+
             for sb in sc:
                 if sb['bagId'] == rfc7292.id_pkcs8ShroudedKeyBag:
                     bv = sb['bagValue']
                     enc_alg = bv['encryptionAlgorithm']['algorithm']
-                    assert enc_alg == rfc7292.pbeWithSHAAnd3_KeyTripleDES_CBC
+                    self.assertEqual(
+                        rfc7292.pbeWithSHAAnd3_KeyTripleDES_CBC, enc_alg)
                     enc_alg_param = bv['encryptionAlgorithm']['parameters']
-                    assert enc_alg_param['iterations'] == 2000
+                    self.assertEqual(2000, enc_alg_param['iterations'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc7296.py b/tests/test_rfc7296.py
index e1899d1..4bc7577 100644
--- a/tests/test_rfc7296.py
+++ b/tests/test_rfc7296.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc7296
@@ -129,25 +129,29 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.cert_bundle_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         cert_count = 0
         crl_count = 0
         unk_count = 0
+
         for item in asn1Object:
             if item.getName() == 'cert':
                 cert_count += 1
+
             elif item.getName() == 'crl':
                 crl_count += 1
+
             else:
                 unk_count += 1
 
-        assert cert_count == 3
-        assert crl_count == 2
-        assert unk_count == 0
+        self.assertEqual(3, cert_count)
+        self.assertEqual(2, crl_count)
+        self.assertEqual(0, unk_count)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc7508.py b/tests/test_rfc7508.py
index b989874..914e6d8 100644
--- a/tests/test_rfc7508.py
+++ b/tests/test_rfc7508.py
@@ -9,8 +9,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5652
@@ -53,68 +53,78 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.signed_message_pem_text)
-        asn1Object, rest = der_decode (substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         secure_header_field_attr_found = False
-        assert asn1Object['contentType'] == rfc5652.id_signedData
-        sd, rest = der_decode (asn1Object['content'], asn1Spec=rfc5652.SignedData())
+
+        self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
+
+        sd, rest = der_decoder(
+            asn1Object['content'], asn1Spec=rfc5652.SignedData())
+
         for sa in sd['signerInfos'][0]['signedAttrs']:
             sat = sa['attrType']
             sav0 = sa['attrValues'][0]
 
             if sat == rfc7508.id_aa_secureHeaderFieldsIdentifier:
-                assert sat in rfc5652.cmsAttributesMap.keys()
-                sav, rest = der_decode(sav0, asn1Spec=rfc5652.cmsAttributesMap[sat])
-                assert not rest
-                assert sav.prettyPrint()
-                assert der_encode(sav) == sav0
+                self.assertIn(sat, rfc5652.cmsAttributesMap)
+                sav, rest = der_decoder(
+                    sav0, asn1Spec=rfc5652.cmsAttributesMap[sat])
+
+                self.assertFalse(rest)
+                self.assertTrue(sav.prettyPrint())
+                self.assertEqual(sav0, der_encoder(sav))
 
                 from_field = rfc7508.HeaderFieldName('From')
                 alice_email = rfc7508.HeaderFieldValue('alice@example.com')
                 for shf in sav['secHeaderFields']:
                     if shf['field-Name'] == from_field:
-                        assert shf['field-Value'] == alice_email
+                        self.assertEqual(alice_email, shf['field-Value'])
                         secure_header_field_attr_found = True
 
-        assert secure_header_field_attr_found
+        self.assertTrue(secure_header_field_attr_found)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.signed_message_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec, decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert asn1Object['contentType'] in rfc5652.cmsContentTypesMap.keys()
-        assert asn1Object['contentType'] == rfc5652.id_signedData
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertIn(asn1Object['contentType'], rfc5652.cmsContentTypesMap)
+        self.assertEqual(asn1Object['contentType'], rfc5652.id_signedData)
 
         sd = asn1Object['content']
-        assert sd['version'] == rfc5652.CMSVersion().subtype(value='v1')
+
+        self.assertEqual(
+            rfc5652.CMSVersion().subtype(value='v1'), sd['version'])
 
         ect = sd['encapContentInfo']['eContentType']
-        assert ect in rfc5652.cmsContentTypesMap.keys()
-        assert ect == rfc5652.id_data
+
+        self.assertIn(ect, rfc5652.cmsContentTypesMap)
+        self.assertEqual(rfc5652.id_data, ect)
 
         for sa in sd['signerInfos'][0]['signedAttrs']:
             if sa['attrType'] == rfc7508.id_aa_secureHeaderFieldsIdentifier:
-                assert sa['attrType'] in rfc5652.cmsAttributesMap.keys()
+                self.assertIn(sa['attrType'], rfc5652.cmsAttributesMap)
 
                 secure_header_field_attr_found = False
                 for sa in sd['signerInfos'][0]['signedAttrs']:
                     if sa['attrType'] == rfc7508.id_aa_secureHeaderFieldsIdentifier:
-                        assert sa['attrType'] in rfc5652.cmsAttributesMap.keys()
+                        self.assertIn(sa['attrType'], rfc5652.cmsAttributesMap)
                         from_field = rfc7508.HeaderFieldName('From')
                         alice_email = rfc7508.HeaderFieldValue('alice@example.com')
                         for shf in sa['attrValues'][0]['secHeaderFields']:
                             if shf['field-Name'] == from_field:
-                                assert shf['field-Value'] == alice_email
+                                self.assertEqual(alice_email, shf['field-Value'])
                                 secure_header_field_attr_found = True
 
-                assert secure_header_field_attr_found
+                self.assertTrue(secure_header_field_attr_found)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc7585.py b/tests/test_rfc7585.py
index 12189d4..5e53834 100644
--- a/tests/test_rfc7585.py
+++ b/tests/test_rfc7585.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -49,63 +49,74 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         nai_realm_oid = rfc7585.id_on_naiRealm
         nai_realm_found = False
 
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_ce_subjectAltName:
-                extnValue, rest = der_decode(extn['extnValue'],
-                    asn1Spec=rfc5280.SubjectAltName())
-                assert not rest
-                assert extnValue.prettyPrint()
-                assert der_encode(extnValue) == extn['extnValue']
+                extnValue, rest = der_decoder(
+                    extn['extnValue'], asn1Spec=rfc5280.SubjectAltName())
+
+                self.assertFalse(rest)
+                self.assertTrue(extnValue.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(extnValue))
 
                 for gn in extnValue:
                     if gn['otherName'].hasValue():
-                        assert gn['otherName']['type-id'] == nai_realm_oid
-                        onValue, rest = der_decode(gn['otherName']['value'],
-                            asn1Spec=rfc7585.NAIRealm())
-                        assert not rest
-                        assert onValue.prettyPrint()
-                        assert der_encode(onValue) == gn['otherName']['value']
-                        assert 'example' in onValue
+                        self.assertEqual(
+                            nai_realm_oid, gn['otherName']['type-id'])
+
+                        onValue, rest = der_decoder(
+                            gn['otherName']['value'], asn1Spec=rfc7585.NAIRealm())
+
+                        self.assertFalse(rest)
+                        self.assertTrue(onValue.prettyPrint())
+                        self.assertEqual(
+                            gn['otherName']['value'], der_encoder(onValue))
+                        self.assertIn('example', onValue)
+
                         nai_realm_found = True
 
-        assert nai_realm_found
+        self.assertTrue(nai_realm_found)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         nai_realm_oid = rfc7585.id_on_naiRealm
         nai_realm_found = False
 
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] == rfc5280.id_ce_subjectAltName:
-                extnValue, rest = der_decode(extn['extnValue'],
-                    asn1Spec=rfc5280.SubjectAltName(),
+                extnValue, rest = der_decoder(
+                    extn['extnValue'], asn1Spec=rfc5280.SubjectAltName(),
                     decodeOpenTypes=True)
-                assert not rest
-                assert extnValue.prettyPrint()
-                assert der_encode(extnValue) == extn['extnValue']
+
+                self.assertFalse(rest)
+                self.assertTrue(extnValue.prettyPrint())
+                self.assertEqual(extn['extnValue'], der_encoder(extnValue))
 
                 for gn in extnValue:
                     if gn['otherName'].hasValue():
-                        assert gn['otherName']['type-id'] == nai_realm_oid
-                        assert 'example' in gn['otherName']['value']
+                        self.assertEqual(
+                            nai_realm_oid, gn['otherName']['type-id'])
+                        self.assertIn('example', gn['otherName']['value'])
+
                         nai_realm_found = True
 
-        assert nai_realm_found
+        self.assertTrue(nai_realm_found)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc7633.py b/tests/test_rfc7633.py
index 8d2ca47..64e874e 100644
--- a/tests/test_rfc7633.py
+++ b/tests/test_rfc7633.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -49,26 +49,28 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        extn_list = [ ]
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        extn_list = []
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             extn_list.append(extn['extnID'])
             if extn['extnID'] == rfc7633.id_pe_tlsfeature:
                 s = extn['extnValue']
-                features, rest = der_decode(s,
-                    rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert not rest
-                assert features.prettyPrint()
-                assert s == der_encode(features)
+                features, rest = der_decoder(
+                    s, rfc5280.certificateExtensionsMap[extn['extnID']])
 
-                assert len(features) == 1
-                assert features[0] == 5
+                self.assertFalse(rest)
+                self.assertTrue(features.prettyPrint())
+                self.assertEqual(s, der_encoder(features))
+                self.assertEqual(1, len(features))
+                self.assertEqual(5, features[0])
 
-        assert rfc7633.id_pe_tlsfeature in extn_list
+        self.assertIn(rfc7633.id_pe_tlsfeature, extn_list)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc7773.py b/tests/test_rfc7773.py
index f00119e..2b4e50b 100644
--- a/tests/test_rfc7773.py
+++ b/tests/test_rfc7773.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -81,27 +81,29 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        extn_list = [ ]
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        extn_list = []
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             extn_list.append(extn['extnID'])
 
             if extn['extnID'] == rfc7773.id_ce_authContext:
                 s = extn['extnValue']
-                acs, rest = der_decode(s,
-                    asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert not rest
-                assert acs.prettyPrint()
-                assert s == der_encode(acs)
+                acs, rest = der_decoder(
+                    s, asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
+                self.assertFalse(rest)
+                self.assertTrue(acs.prettyPrint())
+                self.assertEqual(s, der_encoder(acs))
+                self.assertIn('id.elegnamnden.se', acs[0]['contextType'])
+                self.assertIn(
+                    'AuthContextInfo IdentityProvider', acs[0]['contextInfo'])
 
-                assert u'id.elegnamnden.se' in acs[0]['contextType']
-                assert u'AuthContextInfo IdentityProvider' in acs[0]['contextInfo']
-
-        assert rfc7773.id_ce_authContext in extn_list
+        self.assertIn(rfc7773.id_ce_authContext, extn_list)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc7894.py b/tests/test_rfc7894.py
index 925348c..3d38155 100644
--- a/tests/test_rfc7894.py
+++ b/tests/test_rfc7894.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc6402
@@ -40,40 +40,45 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.otp_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['certificationRequestInfo']['version'] == 0
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(0, asn1Object['certificationRequestInfo']['version'])
 
         for attr in asn1Object['certificationRequestInfo']['attributes']:
-            assert attr['attrType'] in rfc6402.cmcControlAttributesMap.keys()
-            av, rest = der_decode(attr['attrValues'][0],
+            self.assertIn(
+                attr['attrType'], rfc6402.cmcControlAttributesMap)
+
+            av, rest = der_decoder(
+                attr['attrValues'][0],
                 rfc6402.cmcControlAttributesMap[attr['attrType']])
-            assert not rest
-            assert der_encode(av) == attr['attrValues'][0]
+
+            self.assertFalse(rest)
+            self.assertEqual(attr['attrValues'][0], der_encoder(av))
 
             if attr['attrType'] == rfc7894.id_aa_otpChallenge:
-                assert av['printableString'] == '90503846'
+                self.assertEqual('90503846', av['printableString'])
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.otp_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         for attr in asn1Object['certificationRequestInfo']['attributes']:
-            assert attr['attrType'] in rfc6402.cmcControlAttributesMap.keys()
+            self.assertIn(attr['attrType'], rfc6402.cmcControlAttributesMap)
             if attr['attrType'] == rfc7894.id_aa_otpChallenge:
-                assert attr['attrValues'][0]['printableString'] == '90503846'
+                self.assertEqual(
+                    '90503846', attr['attrValues'][0]['printableString'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
 
 if __name__ == '__main__':
     result = unittest.TextTestRunner(verbosity=2).run(suite)
-    sys.exit(not result.wasSuccessful())
\ No newline at end of file
+    sys.exit(not result.wasSuccessful())
diff --git a/tests/test_rfc7906.py b/tests/test_rfc7906.py
index d725ee5..3806987 100644
--- a/tests/test_rfc7906.py
+++ b/tests/test_rfc7906.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import univ
 
 from pyasn1_modules import pem
@@ -122,39 +122,43 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.attr_set_pem_text)
-        asn1Object, rest = der_decode (substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         for attr in asn1Object:
-            assert attr['type'] in rfc5652.cmsAttributesMap.keys()
-            av, rest = der_decode(attr['values'][0],
+            self.assertIn(attr['type'], rfc5652.cmsAttributesMap)
+
+            av, rest = der_decoder(
+                attr['values'][0],
                 asn1Spec=rfc5652.cmsAttributesMap[attr['type']])
-            assert not rest
-            assert av.prettyPrint()
-            assert der_encode(av) == attr['values'][0]
+
+            self.assertFalse(rest)
+            self.assertTrue(av.prettyPrint())
+            self.assertEqual(attr['values'][0], der_encoder(av))
 
             if attr['type'] == rfc7906.id_aa_KP_contentDecryptKeyID:
-                assert av == univ.OctetString(hexValue='7906')
+                self.assertEqual(univ.OctetString(hexValue='7906'), av)
 
     def testOpenTypes(self):
-        openTypesMap = { }
-        openTypesMap.update(rfc5280.certificateAttributesMap)
+        openTypesMap = rfc5280.certificateAttributesMap.copy()
         openTypesMap.update(rfc5652.cmsAttributesMap)
 
         substrate = pem.readBase64fromText(self.attr_set_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            openTypes=openTypesMap,
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, openTypes=openTypesMap,
             decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         for attr in asn1Object:
             if attr['type'] == rfc7906.id_aa_KP_contentDecryptKeyID:
-                assert attr['values'][0] == univ.OctetString(hexValue='7906')
+                self.assertEqual(
+                    univ.OctetString(hexValue='7906'), attr['values'][0])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc7914.py b/tests/test_rfc7914.py
index 3e03287..e0b1cb3 100644
--- a/tests/test_rfc7914.py
+++ b/tests/test_rfc7914.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -34,50 +34,60 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         ea = asn1Object['encryptionAlgorithm']
-        assert ea['algorithm'] == rfc8018.id_PBES2
-        assert ea['algorithm'] in rfc5280.algorithmIdentifierMap.keys()
 
-        params, rest = der_decode(ea['parameters'],
+        self.assertEqual(rfc8018.id_PBES2, ea['algorithm'])
+        self.assertIn(ea['algorithm'], rfc5280.algorithmIdentifierMap)
+
+        params, rest = der_decoder(
+            ea['parameters'],
             asn1Spec=rfc5280.algorithmIdentifierMap[ea['algorithm']])
-        assert not rest
-        assert params.prettyPrint()
-        assert der_encode(params) == ea['parameters']
+
+        self.assertFalse(rest)
+        self.assertTrue(params.prettyPrint())
+        self.assertEqual(ea['parameters'], der_encoder(params))
 
         kdf = params['keyDerivationFunc']
-        assert kdf['algorithm'] == rfc7914.id_scrypt
-        assert kdf['algorithm'] in rfc5280.algorithmIdentifierMap.keys()
 
-        kdfp, rest = der_decode(kdf['parameters'],
+        self.assertEqual(rfc7914.id_scrypt, kdf['algorithm'])
+        self.assertIn(kdf['algorithm'], rfc5280.algorithmIdentifierMap)
+
+        kdfp, rest = der_decoder(
+            kdf['parameters'],
             asn1Spec=rfc5280.algorithmIdentifierMap[kdf['algorithm']])
-        assert not rest
-        assert kdfp.prettyPrint()
-        assert der_encode(kdfp) == kdf['parameters']
 
-        assert kdfp['costParameter'] == 1048576
+        self.assertFalse(rest)
+        self.assertTrue(kdfp.prettyPrint())
+        self.assertTrue(kdf['parameters'], der_encoder(kdfp))
+        self.assertEqual(1048576, kdfp['costParameter'])
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         ea = asn1Object['encryptionAlgorithm']
-        assert ea['algorithm'] == rfc8018.id_PBES2
+
+        self.assertEqual(rfc8018.id_PBES2, ea['algorithm'])
 
         params = asn1Object['encryptionAlgorithm']['parameters']
-        assert params['keyDerivationFunc']['algorithm'] == rfc7914.id_scrypt
+
+        self.assertEqual(
+            rfc7914.id_scrypt, params['keyDerivationFunc']['algorithm'])
 
         kdfp = params['keyDerivationFunc']['parameters']
-        assert kdfp['costParameter'] == 1048576
+
+        self.assertEqual(1048576, kdfp['costParameter'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc8017.py b/tests/test_rfc8017.py
index 8292421..9601997 100644
--- a/tests/test_rfc8017.py
+++ b/tests/test_rfc8017.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import univ
 
 from pyasn1_modules import pem
@@ -33,39 +33,47 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.smime_capabilities_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         for cap in asn1Object:
-            assert cap['algorithm'] in rfc5280.algorithmIdentifierMap.keys()
+            self.assertIn(cap['algorithm'], rfc5280.algorithmIdentifierMap)
+
             if cap['parameters'].hasValue():
-                p, rest = der_decode(cap['parameters'],
+                p, rest = der_decoder(
+                    cap['parameters'],
                     asn1Spec=rfc5280.algorithmIdentifierMap[cap['algorithm']])
-                assert not rest
+
+                self.assertFalse(rest)
                 if not p == univ.Null(""):
-                    assert p.prettyPrint()
-                assert der_encode(p) == cap['parameters']
+                    self.assertTrue(p.prettyPrint())
+                self.assertEqual(cap['parameters'], der_encoder(p))
 
                 if cap['algorithm'] == rfc8017.id_RSAES_OAEP:
-                    assert p['hashFunc']['algorithm'] == rfc8017.id_sha384
-                    assert p['maskGenFunc']['algorithm'] == rfc8017.id_mgf1
+                    self.assertEqual(
+                        rfc8017.id_sha384, p['hashFunc']['algorithm'])
+                    self.assertEqual(
+                        rfc8017.id_mgf1, p['maskGenFunc']['algorithm'])
 
     def OpenTypesCodec(self):
         substrate = pem.readBase64fromText(self.smime_capabilities_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         for cap in asn1Object:
             if cap['algorithm'] == rfc8017.id_RSAES_OAEP:
                 p = cap['parameters']
-                assert p['hashFunc']['algorithm'] == rfc8017.id_sha384
-                assert p['maskGenFunc']['algorithm'] == rfc8017.id_mgf1
+                self.assertEqual(
+                    rfc8017.id_sha384, p['hashFunc']['algorithm'])
+                self.assertEqual(
+                    rfc8017.id_mgf1, p['maskGenFunc']['algorithm'])
 
 
 class MultiprimeRSAPrivateKeyTestCase(unittest.TestCase):
@@ -103,10 +111,11 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc8018.py b/tests/test_rfc8018.py
index 4161784..f354c63 100644
--- a/tests/test_rfc8018.py
+++ b/tests/test_rfc8018.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5652
@@ -27,23 +27,29 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.rfc3211_ex1_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
         alg_oid = asn1Object['pwri']['keyDerivationAlgorithm']['algorithm']
-        assert alg_oid == rfc8018.id_PBKDF2
+
+        self.assertEqual(rfc8018.id_PBKDF2, alg_oid)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.rfc3211_ex1_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
-        icount = asn1Object['pwri']['keyDerivationAlgorithm']['parameters']['iterationCount']
-        assert icount == 5
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        icount = (asn1Object['pwri']['keyDerivationAlgorithm']
+                            ['parameters']['iterationCount'])
+
+        self.assertEqual(5, icount)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc8103.py b/tests/test_rfc8103.py
index 4e76311..002f5c9 100644
--- a/tests/test_rfc8103.py
+++ b/tests/test_rfc8103.py
@@ -24,15 +24,24 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.alg_id_pem_text)
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object[0] == rfc8103.id_alg_AEADChaCha20Poly1305
-        param, rest = der_decoder.decode(asn1Object[1], rfc8103.AEADChaCha20Poly1305Nonce())
-        assert not rest
-        assert param.prettyPrint()
-        assert param == rfc8103.AEADChaCha20Poly1305Nonce(value='\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88')
-        assert der_encoder.encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder.decode(
+            substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(rfc8103.id_alg_AEADChaCha20Poly1305, asn1Object[0])
+
+        param, rest = der_decoder.decode(
+            asn1Object[1], rfc8103.AEADChaCha20Poly1305Nonce())
+
+        self.assertFalse(rest)
+        self.assertTrue(param.prettyPrint())
+        self.assertEqual(
+            rfc8103.AEADChaCha20Poly1305Nonce(value='\xca\xfe\xba\xbe\xfa'
+                                                    '\xce\xdb\xad\xde\xca'
+                                                    '\xf8\x88'),
+            param)
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc8209.py b/tests/test_rfc8209.py
index c63fc2f..1afd77f 100644
--- a/tests/test_rfc8209.py
+++ b/tests/test_rfc8209.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -34,23 +34,27 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        extn_list = [ ]
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        extn_list = []
+
         for extn in asn1Object['tbsCertificate']['extensions']:
             extn_list.append(extn['extnID'])
             if extn['extnID'] in rfc5280.certificateExtensionsMap.keys():
-                extnValue, rest = der_decode(extn['extnValue'],
+                extnValue, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert der_encode(extnValue) == extn['extnValue']
+
+                self.assertEqual(extn['extnValue'], der_encoder(extnValue))
 
                 if extn['extnID'] == rfc5280.id_ce_extKeyUsage:
-                     assert rfc8209.id_kp_bgpsec_router in extnValue
+                    self.assertIn(rfc8209.id_kp_bgpsec_router, extnValue)
 
-        assert rfc5280.id_ce_extKeyUsage in extn_list
+        self.assertIn(rfc5280.id_ce_extKeyUsage, extn_list)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc8226.py b/tests/test_rfc8226.py
index 888df34..aa5257c 100644
--- a/tests/test_rfc8226.py
+++ b/tests/test_rfc8226.py
@@ -17,31 +17,37 @@
 
 
 class JWTClaimConstraintsTestCase(unittest.TestCase):
-    jwtcc_pem_text = "MD2gBzAFFgNmb2+hMjAwMBkWA2ZvbzASDARmb28xDARmb28yDARmb28zMBMWA2JhcjAMDARiYXIxDARiYXIy"
+    jwtcc_pem_text = ("MD2gBzAFFgNmb2+hMjAwMBkWA2ZvbzASDARmb28xDARmb28yDARmb2"
+                      "8zMBMWA2JhcjAMDARiYXIxDARiYXIy")
 
     def setUp(self):
         self.asn1Spec = rfc8226.JWTClaimConstraints()
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.jwtcc_pem_text)
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder.decode(
+            substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
 
 class TNAuthorizationListTestCase(unittest.TestCase):
-    tnal_pem_text = "MCugBxYFYm9ndXOhEjAQFgo1NzE1NTUxMjEyAgIDFKIMFgo3MDM1NTUxMjEy"
+    tnal_pem_text = ("MCugBxYFYm9ndXOhEjAQFgo1NzE1NTUxMjEyAgIDFKIMFgo3MDM1NTU"
+                     "xMjEy")
 
     def setUp(self):
         self.asn1Spec = rfc8226.TNAuthorizationList()
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.tnal_pem_text)
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder.decode(
+            substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
 
 class CertificateOpenTypesTestCase(unittest.TestCase):
@@ -67,23 +73,28 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.cert_pem_text)
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder.decode(
+            substrate, asn1Spec=self.asn1Spec)
 
-        extn_list = [ ]
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
+
+        extn_list = []
         for extn in asn1Object['tbsCertificate']['extensions']:
             extn_list.append(extn['extnID'])
             if extn['extnID'] in rfc5280.certificateExtensionsMap.keys():
-                extnValue, rest = der_decoder.decode(extn['extnValue'],
+                extnValue, rest = der_decoder.decode(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert der_encoder.encode(extnValue) == extn['extnValue']
+
+                self.assertEqual(
+                    extn['extnValue'], der_encoder.encode(extnValue))
 
                 if extn['extnID'] == rfc8226.id_pe_TNAuthList:
-                    assert extnValue[0]['spc'] == 'fake'
+                    self.assertEqual('fake', extnValue[0]['spc'])
 
-        assert rfc8226.id_pe_TNAuthList in extn_list
+        self.assertIn(rfc8226.id_pe_TNAuthList, extn_list)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc8358.py b/tests/test_rfc8358.py
index c5113d4..48a01ce 100644
--- a/tests/test_rfc8358.py
+++ b/tests/test_rfc8358.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5652
@@ -168,22 +168,24 @@
         oids = [ ]
         for pem_text in self.pem_text_list:
             substrate = pem.readBase64fromText(pem_text)
-            asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-            assert not rest
-            assert asn1Object.prettyPrint()
-            assert der_encode(asn1Object) == substrate
+            asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-            assert asn1Object['contentType'] == rfc5652.id_signedData
-            sd, rest = der_decode(asn1Object['content'], asn1Spec=rfc5652.SignedData())
-            assert not rest
-            assert sd.prettyPrint()
-            assert der_encode(sd) == asn1Object['content']
+            self.assertFalse(rest)
+            self.assertTrue(asn1Object.prettyPrint())
+            self.assertEqual(substrate, der_encoder(asn1Object))
+            self.assertEqual(rfc5652.id_signedData, asn1Object['contentType'])
+
+            sd, rest = der_decoder(asn1Object['content'], asn1Spec=rfc5652.SignedData())
+
+            self.assertFalse(rest)
+            self.assertTrue(sd.prettyPrint())
+            self.assertEqual(asn1Object['content'], der_encoder(sd))
 
             oids.append(sd['encapContentInfo']['eContentType'])
 
-        assert rfc8358.id_ct_asciiTextWithCRLF in oids
-        assert rfc8358.id_ct_pdf in oids
-        assert rfc8358.id_ct_xml in oids
+        self.assertIn(rfc8358.id_ct_asciiTextWithCRLF, oids)
+        self.assertIn(rfc8358.id_ct_pdf, oids)
+        self.assertIn(rfc8358.id_ct_xml, oids)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc8360.py b/tests/test_rfc8360.py
index 8d455ed..56a76cf 100644
--- a/tests/test_rfc8360.py
+++ b/tests/test_rfc8360.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -436,22 +436,25 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.extns_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        oids = [ ]
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        oids = []
         for extn in asn1Object:
             oids.append(extn['extnID'])
-            extn_value, rest = der_decode(extn['extnValue'],
+            extn_value, rest = der_decoder(
+                extn['extnValue'],
                 rfc5280.certificateExtensionsMap[extn['extnID']])
-            assert not rest
-            assert extn_value.prettyPrint()
-            assert der_encode(extn_value) == extn['extnValue']
 
-        assert rfc8360.id_pe_ipAddrBlocks_v2 in oids
-        assert rfc8360.id_pe_autonomousSysIds_v2 in oids
+            self.assertFalse(rest)
+            self.assertTrue(extn_value.prettyPrint())
+            self.assertEqual(extn['extnValue'], der_encoder(extn_value))
+
+        self.assertIn(rfc8360.id_pe_ipAddrBlocks_v2, oids)
+        self.assertIn(rfc8360.id_pe_autonomousSysIds_v2, oids)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc8398.py b/tests/test_rfc8398.py
index 5d23af0..b524831 100644
--- a/tests/test_rfc8398.py
+++ b/tests/test_rfc8398.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -23,35 +23,40 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['otherName']['type-id'] in rfc5280.anotherNameMap.keys()
-        assert asn1Object['otherName']['type-id'] == rfc8398.id_on_SmtpUTF8Mailbox
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertIn(asn1Object['otherName']['type-id'],
+                      rfc5280.anotherNameMap)
+        self.assertEqual(rfc8398.id_on_SmtpUTF8Mailbox,
+                         asn1Object['otherName']['type-id'])
 
-        eai, rest = der_decode(asn1Object['otherName']['value'],
+        eai, rest = der_decoder(
+            asn1Object['otherName']['value'],
             asn1Spec=rfc5280.anotherNameMap[asn1Object['otherName']['type-id']])
-        assert not rest
-        assert eai.prettyPrint()
-        assert der_encode(eai) == asn1Object['otherName']['value']
 
-        assert eai[0] == u'\u8001'
-        assert eai[1] == u'\u5E2B'
+        self.assertFalse(rest)
+        self.assertTrue(eai.prettyPrint())
+        self.assertEqual(asn1Object['otherName']['value'], der_encoder(eai))
+        self.assertEqual(u'\u8001', eai[0])
+        self.assertEqual(u'\u5E2B', eai[1])
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
 
-        assert asn1Object['otherName']['type-id'] == rfc8398.id_on_SmtpUTF8Mailbox
-        assert asn1Object['otherName']['value'][0] == u'\u8001'
-        assert asn1Object['otherName']['value'][1] ==  u'\u5E2B'
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        self.assertEqual(
+            rfc8398.id_on_SmtpUTF8Mailbox, asn1Object['otherName']['type-id'])
+        self.assertEqual(u'\u8001', asn1Object['otherName']['value'][0])
+
+        self.assertEqual(u'\u5E2B', asn1Object['otherName']['value'][1])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc8410.py b/tests/test_rfc8410.py
index 85beec4..d6df485 100644
--- a/tests/test_rfc8410.py
+++ b/tests/test_rfc8410.py
@@ -17,7 +17,8 @@
 
 
 class PrivateKeyTestCase(unittest.TestCase):
-    no_pub_key_pem_text = "MC4CAQAwBQYDK2VwBCIEINTuctv5E1hK1bbY8fdp+K06/nwoy/HU++CXqI9EdVhC"
+    no_pub_key_pem_text = ("MC4CAQAwBQYDK2VwBCIEINTuctv5E1hK1bbY8fdp+K06/nwo"
+                           "y/HU++CXqI9EdVhC")
 
     def setUp(self):
         self.asn1Spec = rfc5208.PrivateKeyInfo()
@@ -25,12 +26,15 @@
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.no_pub_key_pem_text)
         asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object['privateKeyAlgorithm']['algorithm'] == rfc8410.id_Ed25519
-        assert asn1Object['privateKey'].isValue
-        assert asn1Object['privateKey'].prettyPrint()[0:10] == "0x0420d4ee"
-        assert der_encoder.encode(asn1Object) == substrate
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(
+            rfc8410.id_Ed25519, asn1Object['privateKeyAlgorithm']['algorithm'])
+        self.assertTrue(asn1Object['privateKey'].isValue)
+        self.assertEqual(
+            "0x0420d4ee", asn1Object['privateKey'].prettyPrint()[0:10])
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc8418.py b/tests/test_rfc8418.py
index fd665d3..b5e8d3e 100644
--- a/tests/test_rfc8418.py
+++ b/tests/test_rfc8418.py
@@ -24,12 +24,16 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.key_agree_alg_id_pem_text)
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object['algorithm'] == rfc8418.dhSinglePass_stdDH_hkdf_sha384_scheme
-        assert asn1Object['parameters'].isValue
-        assert der_encoder.encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder.decode(
+            substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(
+            rfc8418.dhSinglePass_stdDH_hkdf_sha384_scheme,
+            asn1Object['algorithm'])
+        self.assertTrue(asn1Object['parameters'].isValue)
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc8419.py b/tests/test_rfc8419.py
index 3a63942..3ad05cb 100644
--- a/tests/test_rfc8419.py
+++ b/tests/test_rfc8419.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -24,12 +24,13 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.alg_id_1_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object['algorithm'] == rfc8419.id_Ed25519
-        assert not asn1Object['parameters'].isValue
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(rfc8419.id_Ed25519, asn1Object['algorithm'])
+        self.assertFalse(asn1Object['parameters'].isValue)
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 class Ed448TestCase(unittest.TestCase):
@@ -40,12 +41,14 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.alg_id_2_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object['algorithm'] == rfc8419.id_Ed448
-        assert not asn1Object['parameters'].isValue
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(rfc8419.id_Ed448, asn1Object['algorithm'])
+        self.assertFalse(asn1Object['parameters'].isValue)
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 class SHA512TestCase(unittest.TestCase):
@@ -56,12 +59,14 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.alg_id_3_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object['algorithm'] == rfc8419.id_sha512
-        assert not asn1Object['parameters'].isValue
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(rfc8419.id_sha512, asn1Object['algorithm'])
+        self.assertFalse(asn1Object['parameters'].isValue)
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 class SHAKE256TestCase(unittest.TestCase):
@@ -72,12 +77,13 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.alg_id_4_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object['algorithm'] == rfc8419.id_shake256
-        assert not asn1Object['parameters'].isValue
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(rfc8419.id_shake256, asn1Object['algorithm'])
+        self.assertFalse(asn1Object['parameters'].isValue)
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 class SHAKE256LENTestCase(unittest.TestCase):
@@ -88,30 +94,33 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.alg_id_5_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object['algorithm'] == rfc8419.id_shake256_len
-        assert asn1Object['parameters'].isValue
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        param, rest = der_decode(asn1Object['parameters'],
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(rfc8419.id_shake256_len, asn1Object['algorithm'])
+        self.assertTrue(asn1Object['parameters'].isValue)
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        param, rest = der_decoder(
+            asn1Object['parameters'],
             asn1Spec=rfc5280.algorithmIdentifierMap[asn1Object['algorithm']])
-        assert not rest
-        assert param.prettyPrint()
-        assert der_encode(param) == asn1Object['parameters']
-        assert param == 512
+
+        self.assertFalse(rest)
+        self.assertTrue(param.prettyPrint())
+        self.assertEqual(asn1Object['parameters'], der_encoder(param))
+        self.assertEqual(512, param)
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.alg_id_5_pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert asn1Object['algorithm'] == rfc8419.id_shake256_len
-        assert asn1Object['parameters'] == 512
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(rfc8419.id_shake256_len, asn1Object['algorithm'])
+        self.assertEqual(512, asn1Object['parameters'])
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc8479.py b/tests/test_rfc8479.py
index e410526..e5b135f 100644
--- a/tests/test_rfc8479.py
+++ b/tests/test_rfc8479.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 from pyasn1.type import univ
 
 from pyasn1_modules import pem
@@ -54,40 +54,51 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         for attr in asn1Object['attributes']:
-            assert attr['attrType'] in rfc5652.cmsAttributesMap.keys()
-            if attr['attrType'] == rfc8479.id_attr_validation_parameters:
-                av, rest = der_decode(attr['attrValues'][0],
-                    asn1Spec=rfc5652.cmsAttributesMap[attr['attrType']])
-                assert not rest
-                assert av.prettyPrint()
-                assert der_encode(av) == attr['attrValues'][0]
+            self.assertIn(attr['attrType'], rfc5652.cmsAttributesMap)
 
-                assert av['hashAlg'] == rfc4055.id_sha384
-                seed = univ.OctetString(hexValue='8af4328c87bebcec31e303b8f5537effcb6a91d947084d99a369823b36f01462')
-                assert av['seed'] == seed
+            if attr['attrType'] == rfc8479.id_attr_validation_parameters:
+                av, rest = der_decoder(
+                    attr['attrValues'][0],
+                    asn1Spec=rfc5652.cmsAttributesMap[attr['attrType']])
+                self.assertFalse(rest)
+                self.assertTrue(av.prettyPrint())
+                self.assertEqual(attr['attrValues'][0], der_encoder(av))
+                self.assertEqual(rfc4055.id_sha384, av['hashAlg'])
+
+                seed = univ.OctetString(hexValue='8af4328c87bebcec31e303b8f55'
+                                                 '37effcb6a91d947084d99a36982'
+                                                 '3b36f01462')
+
+                self.assertEqual(seed, av['seed'])
 
     def testOpenTypes(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate,
-            asn1Spec=self.asn1Spec,
-            decodeOpenTypes=True)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(
+            substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         for attr in asn1Object['attributes']:
-            assert attr['attrType'] in rfc5652.cmsAttributesMap.keys()
+            self.assertIn(attr['attrType'], rfc5652.cmsAttributesMap)
             if attr['attrType'] == rfc8479.id_attr_validation_parameters:
                 av = attr['attrValues'][0]
-                assert av['hashAlg'] == rfc4055.id_sha384
-                seed = univ.OctetString(hexValue='8af4328c87bebcec31e303b8f5537effcb6a91d947084d99a369823b36f01462')
-                assert av['seed'] == seed
+
+                self.assertEqual(av['hashAlg'], rfc4055.id_sha384)
+
+                seed = univ.OctetString(hexValue='8af4328c87bebcec31e303b8f553'
+                                                 '7effcb6a91d947084d99a369823b'
+                                                 '36f01462')
+
+                self.assertEqual(seed, av['seed'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc8494.py b/tests/test_rfc8494.py
index c22441c..2951e39 100644
--- a/tests/test_rfc8494.py
+++ b/tests/test_rfc8494.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc8494
@@ -31,15 +31,21 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['compressionAlgorithm']['algorithmID-ShortForm'] == 0
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        self.assertEqual(
+            0, asn1Object['compressionAlgorithm']['algorithmID-ShortForm'])
+
         cci = asn1Object['compressedContentInfo']
-        assert cci['unnamed']['contentType-ShortForm'] == 25
-        assert cci['compressedContent'].prettyPrint()[:12] == '0x789c6d8fd1'
+
+        self.assertEqual(
+            25, cci['unnamed']['contentType-ShortForm'])
+        self.assertEqual(
+            '0x789c6d8fd1', cci['compressedContent'].prettyPrint()[:12])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc8520.py b/tests/test_rfc8520.py
index bf5117e..da615dc 100644
--- a/tests/test_rfc8520.py
+++ b/tests/test_rfc8520.py
@@ -8,8 +8,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc5280
@@ -53,48 +53,59 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.mud_cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        extn_list = [ ]
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+
+        extn_list = []
         for extn in asn1Object['tbsCertificate']['extensions']:
             extn_list.append(extn['extnID'])
 
             if extn['extnID'] == rfc8520.id_pe_mudsigner:
-                mudsigner, rest = der_decode(extn['extnValue'], rfc8520.MUDsignerSyntax())
-                assert der_encode(mudsigner) == extn['extnValue']
+                mudsigner, rest = der_decoder(
+                    extn['extnValue'], rfc8520.MUDsignerSyntax())
+
+                self.assertEqual(extn['extnValue'], der_encoder(mudsigner))
 
                 c = rfc5280.X520countryName(value="CH")
-                assert mudsigner[0][0][0]['value'] == der_encode(c)
+
+                self.assertEqual(mudsigner[0][0][0]['value'], der_encoder(c))
+
                 e = rfc5280.EmailAddress(value="ascertia@ofcourseimright.com")
-                assert mudsigner[0][1][0]['value'] == der_encode(e)
+
+                self.assertEqual(mudsigner[0][1][0]['value'], der_encoder(e))
+
                 cn = rfc5280.X520CommonName()
                 cn['printableString'] = "Eliot Lear"
-                assert mudsigner[0][2][0]['value'] == der_encode(cn)
+
+                self.assertEqual(mudsigner[0][2][0]['value'], der_encoder(cn))
 
             if extn['extnID'] == rfc8520.id_pe_mud_url:
-                mudurl, rest = der_decode(extn['extnValue'], rfc8520.MUDURLSyntax())
-                assert der_encode(mudurl) == extn['extnValue']
+                mudurl, rest = der_decoder(
+                    extn['extnValue'], rfc8520.MUDURLSyntax())
 
-                assert mudurl[-5:] == ".json"
+                self.assertEqual(extn['extnValue'], der_encoder(mudurl))
+                self.assertEqual(".json", mudurl[-5:])
 
-        assert rfc8520.id_pe_mudsigner in extn_list
-        assert rfc8520.id_pe_mud_url in extn_list
+        self.assertIn(rfc8520.id_pe_mudsigner, extn_list)
+        self.assertIn(rfc8520.id_pe_mud_url, extn_list)
 
     def testExtensionsMap(self):
         substrate = pem.readBase64fromText(self.mud_cert_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
+
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
 
         for extn in asn1Object['tbsCertificate']['extensions']:
             if extn['extnID'] in rfc5280.certificateExtensionsMap.keys():
-                extnValue, rest = der_decode(extn['extnValue'],
+                extnValue, rest = der_decoder(
+                    extn['extnValue'],
                     asn1Spec=rfc5280.certificateExtensionsMap[extn['extnID']])
-                assert der_encode(extnValue) == extn['extnValue']
+                self.assertEqual(extn['extnValue'], der_encoder(extnValue))
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc8619.py b/tests/test_rfc8619.py
index 9dcfdc8..cd54db6 100644
--- a/tests/test_rfc8619.py
+++ b/tests/test_rfc8619.py
@@ -24,14 +24,15 @@
     def testDerCodec(self):
 
         substrate = pem.readBase64fromText(self.alg_id_1_pem_text)
+        asn1Object, rest = der_decoder.decode(
+            substrate, asn1Spec=self.asn1Spec)
 
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
-        
-        assert asn1Object['algorithm'] == rfc8619.id_alg_hkdf_with_sha256
+        self.assertEqual(
+            rfc8619.id_alg_hkdf_with_sha256, asn1Object['algorithm'])
 
 
 class HKDFSHA384TestCase(unittest.TestCase):
@@ -43,14 +44,13 @@
     def testDerCodec(self):
 
         substrate = pem.readBase64fromText(self.alg_id_1_pem_text)
-
         asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
-        
-        assert asn1Object['algorithm'] == rfc8619.id_alg_hkdf_with_sha384
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
+        self.assertEqual(
+            rfc8619.id_alg_hkdf_with_sha384, asn1Object['algorithm'])
 
 
 class HKDFSHA512TestCase(unittest.TestCase):
@@ -63,13 +63,14 @@
 
         substrate = pem.readBase64fromText(self.alg_id_1_pem_text)
 
-        asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec)
+        asn1Object, rest = der_decoder.decode(
+            substrate, asn1Spec=self.asn1Spec)
 
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encoder.encode(asn1Object) == substrate
-        
-        assert asn1Object['algorithm'] == rfc8619.id_alg_hkdf_with_sha512
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder.encode(asn1Object))
+        self.assertEqual(
+            rfc8619.id_alg_hkdf_with_sha512, asn1Object['algorithm'])
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
diff --git a/tests/test_rfc8649.py b/tests/test_rfc8649.py
index ee65c77..67f8f9f 100644
--- a/tests/test_rfc8649.py
+++ b/tests/test_rfc8649.py
@@ -7,8 +7,8 @@
 import sys
 import unittest
 
-from pyasn1.codec.der.decoder import decode as der_decode
-from pyasn1.codec.der.encoder import encode as der_encode
+from pyasn1.codec.der.decoder import decode as der_decoder
+from pyasn1.codec.der.encoder import encode as der_encoder
 
 from pyasn1_modules import pem
 from pyasn1_modules import rfc4055
@@ -28,27 +28,29 @@
 
     def testDerCodec(self):
         substrate = pem.readBase64fromText(self.extn_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
-        assert asn1Object.prettyPrint()
-        assert der_encode(asn1Object) == substrate
-        
-        assert asn1Object['extnID'] == rfc8649.id_ce_hashOfRootKey
-        hashed_root_key, rest = der_decode(asn1Object['extnValue'],
-            rfc8649.HashedRootKey())
-        assert not rest
-        assert hashed_root_key.prettyPrint()
-        assert der_encode(hashed_root_key) == asn1Object['extnValue']
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert hashed_root_key['hashAlg']['algorithm'] == rfc4055.id_sha512
+        self.assertFalse(rest)
+        self.assertTrue(asn1Object.prettyPrint())
+        self.assertEqual(substrate, der_encoder(asn1Object))
+        self.assertEqual(rfc8649.id_ce_hashOfRootKey, asn1Object['extnID'])
+
+        hashed_root_key, rest = der_decoder(
+            asn1Object['extnValue'], rfc8649.HashedRootKey())
+
+        self.assertFalse(rest)
+        self.assertTrue(hashed_root_key.prettyPrint())
+        self.assertEqual(asn1Object['extnValue'], der_encoder(hashed_root_key))
+        self.assertEqual(
+            rfc4055.id_sha512, hashed_root_key['hashAlg']['algorithm'])
 
     def testExtensionsMap(self):
         substrate = pem.readBase64fromText(self.extn_pem_text)
-        asn1Object, rest = der_decode(substrate, asn1Spec=self.asn1Spec)
-        assert not rest
+        asn1Object, rest = der_decoder(substrate, asn1Spec=self.asn1Spec)
 
-        assert asn1Object['extnID'] == rfc8649.id_ce_hashOfRootKey
-        assert asn1Object['extnID'] in rfc5280.certificateExtensionsMap.keys()
+        self.assertFalse(rest)
+        self.assertEqual(rfc8649.id_ce_hashOfRootKey, asn1Object['extnID'])
+        self.assertIn(asn1Object['extnID'], rfc5280.certificateExtensionsMap)
 
 
 suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])