MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_random

Method test_random

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

Source from the content-addressed store, hash-verified

379 self.assertIs(ctx.protocol, proto)
380
381 def test_random(self):
382 v = ssl.RAND_status()
383 if support.verbose:
384 sys.stdout.write("\n RAND_status is %d (%s)\n"
385 % (v, (v and "sufficient randomness") or
386 "insufficient randomness"))
387
388 if v:
389 data = ssl.RAND_bytes(16)
390 self.assertEqual(len(data), 16)
391 else:
392 self.assertRaises(ssl.SSLError, ssl.RAND_bytes, 16)
393
394 # negative num is invalid
395 self.assertRaises(ValueError, ssl.RAND_bytes, -5)
396
397 ssl.RAND_add("this is a random string", 75.0)
398 ssl.RAND_add(b"this is a random bytes object", 75.0)
399 ssl.RAND_add(bytearray(b"this is a random bytearray object"), 75.0)
400
401 def test_parse_cert(self):
402 self.maxDiff = None

Callers

nothing calls this directly

Calls 4

lenFunction · 0.85
writeMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected