+
+ def test_evgens(self):
+ fd = open(CRL_PATH, "rb")
+ raw = memoryview(fd.read()) if PY2 else file_mmaped(fd)
+ print("CRL opened")
+ evgens_count = 0
+ revoked_certs_count = 0
+ start = time()
+ for decode_path, _, _ in CertificateList().decode_evgen(raw):
+ evgens_count += 1
+ if (
+ len(decode_path) == 3 and
+ decode_path[:2] == ("tbsCertList", "revokedCertificates")
+ ):
+ revoked_certs_count += 1
+ print("CRL parsed", time() - start)
+ evgens_upto_count = 0
+ start = time()
+ for decode_path, _, _ in CertificateList().decode_evgen(raw, ctx={
+ "evgen_mode_upto": (
+ (("tbsCertList", "revokedCertificates", any), True),
+ ),
+ }):
+ evgens_upto_count += 1
+ print("CRL upto parsed", time() - start)
+ self.assertEqual(
+ float(evgens_count - evgens_upto_count) / revoked_certs_count,
+ 3,
+ )