diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2022-08-18 16:57:45 +1000 |
---|---|---|
committer | Jim Mussared <jim.mussared@gmail.com> | 2023-06-08 17:54:24 +1000 |
commit | 4216bc7d1351feb8199e4ebbff1a9598aa1c5b02 (patch) | |
tree | 5085738ef65ab377c221f290c7fa90ec2acd4d29 /tests/extmod/random_extra_float.py | |
parent | 5e50975a6dd9466afafbcd012c00078093fe1f57 (diff) | |
download | micropython-4216bc7d1351feb8199e4ebbff1a9598aa1c5b02.tar.gz micropython-4216bc7d1351feb8199e4ebbff1a9598aa1c5b02.zip |
tests: Replace umodule with module everywhere.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'tests/extmod/random_extra_float.py')
-rw-r--r-- | tests/extmod/random_extra_float.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/extmod/random_extra_float.py b/tests/extmod/random_extra_float.py new file mode 100644 index 0000000000..3b37ed8dce --- /dev/null +++ b/tests/extmod/random_extra_float.py @@ -0,0 +1,21 @@ +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 |