Add tests for random.randbytes
@@ -23,6 +23,15 @@ assert expected == result
sampled = [0, 2, 1]
assert random.sample(list(range(3)), 3) == sampled
+# random.randbytes
+random.seed(1234)
+zero_size_buf = random.randbytes(0)
+assert type(zero_size_buf) is bytes
+assert len(zero_size_buf) == 0
+non_zero_buf = random.randbytes(4)
+assert type(non_zero_buf) is bytes
+assert list(non_zero_buf) == list(b'\xb9\x7fi\xf7')
+
# TODO : random.random(), random.uniform(), random.triangular(),
# random.betavariate, random.expovariate, random.gammavariate,
# random.gauss, random.lognormvariate, random.normalvariate,
