(self)
| 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. |
nothing calls this directly
no test coverage detected