MCPcopy Index your code
hub / github.com/python/cpython / test_random

Method test_random

Lib/test/test_ssl.py:462–480  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

460 self.assertIs(ctx.protocol, proto)
461
462 def test_random(self):
463 v = ssl.RAND_status()
464 if support.verbose:
465 sys.stdout.write("\n RAND_status is %d (%s)\n"
466 % (v, (v and "sufficient randomness") or
467 "insufficient randomness"))
468
469 if v:
470 data = ssl.RAND_bytes(16)
471 self.assertEqual(len(data), 16)
472 else:
473 self.assertRaises(ssl.SSLError, ssl.RAND_bytes, 16)
474
475 # negative num is invalid
476 self.assertRaises(ValueError, ssl.RAND_bytes, -5)
477
478 ssl.RAND_add("this is a random string", 75.0)
479 ssl.RAND_add(b"this is a random bytes object", 75.0)
480 ssl.RAND_add(bytearray(b"this is a random bytearray object"), 75.0)
481
482 def test_parse_cert(self):
483 self.maxDiff = None

Callers

nothing calls this directly

Calls 3

writeMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected