summaryrefslogtreecommitdiff
path: root/tests/wipy/adc.py
diff options
context:
space:
mode:
authorDavid Lechner <david@lechnology.com>2020-03-22 21:26:08 -0500
committerDamien George <damien.p.george@gmail.com>2020-03-30 13:21:58 +1100
commit3dc324d3f1312e40d3a8ed87e7244966bb756f26 (patch)
tree94ff44f8eabba0039582c245b901173597edd11e /tests/wipy/adc.py
parent488613bca6c460340ed2995ae5cafafe22d0bfff (diff)
tests: Format all Python code with black, except tests in basics subdir.
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.
Diffstat (limited to 'tests/wipy/adc.py')
-rw-r--r--tests/wipy/adc.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/tests/wipy/adc.py b/tests/wipy/adc.py
index 6fd4373db..73264113f 100644
--- a/tests/wipy/adc.py
+++ b/tests/wipy/adc.py
@@ -1,19 +1,19 @@
-'''
+"""
ADC test for the CC3200 based boards.
-'''
+"""
from machine import ADC
import os
mch = os.uname().machine
-if 'LaunchPad' in mch:
- adc_pin = 'GP5'
+if "LaunchPad" in mch:
+ adc_pin = "GP5"
adc_channel = 3
-elif 'WiPy' in mch:
- adc_pin = 'GP3'
+elif "WiPy" in mch:
+ adc_pin = "GP3"
adc_channel = 1
else:
- raise Exception('Board not supported!')
+ raise Exception("Board not supported!")
adc = ADC(0)
print(adc)
@@ -49,7 +49,7 @@ print(apin)
print(apin() > 3000)
# check for memory leaks...
-for i in range (0, 1000):
+for i in range(0, 1000):
adc = ADC()
apin = adc.channel(adc_channel)
@@ -57,56 +57,56 @@ for i in range (0, 1000):
try:
adc = ADC(bits=17)
except:
- print('Exception')
+ print("Exception")
try:
adc = ADC(id=1)
except:
- print('Exception')
+ print("Exception")
try:
adc = ADC(0, 16)
except:
- print('Exception')
+ print("Exception")
adc = ADC()
try:
apin = adc.channel(4)
except:
- print('Exception')
+ print("Exception")
try:
apin = adc.channel(-1)
except:
- print('Exception')
+ print("Exception")
try:
- apin = adc.channel(0, pin='GP3')
+ apin = adc.channel(0, pin="GP3")
except:
- print('Exception')
+ print("Exception")
apin = adc.channel(1)
apin.deinit()
try:
apin()
except:
- print('Exception')
+ print("Exception")
try:
apin.value()
except:
- print('Exception')
+ print("Exception")
adc.deinit()
try:
apin.value()
except:
- print('Exception')
+ print("Exception")
try:
apin = adc.channel(1)
except:
- print('Exception')
+ print("Exception")
# re-init must work
adc.init()