summaryrefslogtreecommitdiff
path: root/tests/micropython/const_math.py
blob: 7ee5edc6d3240e1948e957a473f05e9c5fadbd31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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))