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.
31 lines
498 B
Python
31 lines
498 B
Python
try:
|
|
try:
|
|
import umachine as machine
|
|
except ImportError:
|
|
import machine
|
|
machine.PinBase
|
|
except:
|
|
print("SKIP")
|
|
raise SystemExit
|
|
|
|
|
|
class MyPin(machine.PinBase):
|
|
def __init__(self):
|
|
print("__init__")
|
|
self.v = False
|
|
|
|
def value(self, v=None):
|
|
print("value:", v)
|
|
if v is None:
|
|
self.v = not self.v
|
|
return int(self.v)
|
|
|
|
|
|
p = MyPin()
|
|
|
|
print(p.value())
|
|
print(p.value())
|
|
print(p.value())
|
|
p.value(1)
|
|
p.value(0)
|