1import micropython as micropython
2
3# check we can get and set the level
4micropython.opt_level(0)
5print(micropython.opt_level())
6micropython.opt_level(1)
7print(micropython.opt_level())
8
9# check that the optimisation levels actually differ
10micropython.opt_level(0)
11exec("print(__debug__)")
12micropython.opt_level(1)
13exec("print(__debug__)")
14exec("assert 0")
15