diff options
Diffstat (limited to 'tests/micropython/const_math.py')
-rw-r--r-- | tests/micropython/const_math.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/micropython/const_math.py b/tests/micropython/const_math.py new file mode 100644 index 000000000..7ee5edc6d --- /dev/null +++ b/tests/micropython/const_math.py @@ -0,0 +1,18 @@ +# Test expressions based on math module constants +try: + import math +except ImportError: + print("SKIP") + raise SystemExit + +from micropython import const + +# check that we can make consts from math constants +# (skip if the target has MICROPY_COMP_MODULE_CONST disabled) +try: + exec("two_pi = const(2.0 * math.pi)") +except SyntaxError: + print("SKIP") + raise SystemExit + +print(math.cos(two_pi)) |