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.
24 lines
348 B
Python
24 lines
348 B
Python
# test standard Python subscr using viper types
|
|
|
|
|
|
@micropython.viper
|
|
def get(dest, i: int):
|
|
i += 1
|
|
return dest[i]
|
|
|
|
|
|
@micropython.viper
|
|
def set(dest, i: int, val: int):
|
|
i += 1
|
|
dest[i] = val + 1
|
|
|
|
|
|
ar = [i for i in range(3)]
|
|
|
|
for i in range(len(ar)):
|
|
set(ar, i - 1, i)
|
|
print(ar)
|
|
|
|
for i in range(len(ar)):
|
|
print(get(ar, i - 1))
|