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

Method test_token_hex

Lib/test/test_secrets.py:104–111  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

102 self.assertEqual(len(secrets.token_bytes(n)), n)
103
104 def test_token_hex(self):
105 # Test token_hex.
106 for n in (1, 12, 25, 90):
107 with self.subTest(n=n):
108 s = secrets.token_hex(n)
109 self.assertIsInstance(s, str)
110 self.assertEqual(len(s), 2*n)
111 self.assertTrue(all(c in string.hexdigits for c in s))
112
113 def test_token_urlsafe(self):
114 # Test token_urlsafe.

Callers

nothing calls this directly

Calls 6

lenFunction · 0.85
allFunction · 0.85
subTestMethod · 0.80
assertIsInstanceMethod · 0.80
assertTrueMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected