3dc324d3f1
This adds the Python files in the tests/ directory to be formatted with ./tools/codeformat.py. The basics/ subdirectory is excluded for now so we aren't changing too much at once. In a few places `# fmt: off`/`# fmt: on` was used where the code had special formatting for readability or where the test was actually testing the specific formatting.
25 lines
482 B
Python
25 lines
482 B
Python
try:
|
|
import urandom as random
|
|
except ImportError:
|
|
try:
|
|
import random
|
|
except ImportError:
|
|
print("SKIP")
|
|
raise SystemExit
|
|
|
|
try:
|
|
random.randint
|
|
except AttributeError:
|
|
print("SKIP")
|
|
raise SystemExit
|
|
|
|
print("random")
|
|
for i in range(50):
|
|
assert 0 <= random.random() < 1
|
|
|
|
print("uniform")
|
|
for i in range(50):
|
|
assert 0 <= random.uniform(0, 4) <= 4
|
|
assert 2 <= random.uniform(2, 6) <= 6
|
|
assert -2 <= random.uniform(-2, 2) <= 2
|