diff options
author | David Lechner <david@lechnology.com> | 2020-03-22 21:26:08 -0500 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-03-30 13:21:58 +1100 |
commit | 3dc324d3f1312e40d3a8ed87e7244966bb756f26 (patch) | |
tree | 94ff44f8eabba0039582c245b901173597edd11e /tests/pyb/i2c_error.py | |
parent | 488613bca6c460340ed2995ae5cafafe22d0bfff (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/pyb/i2c_error.py')
-rw-r--r-- | tests/pyb/i2c_error.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/pyb/i2c_error.py b/tests/pyb/i2c_error.py index e0f721179..b17a26325 100644 --- a/tests/pyb/i2c_error.py +++ b/tests/pyb/i2c_error.py @@ -3,8 +3,8 @@ import pyb from pyb import I2C -if not hasattr(pyb, 'Accel'): - print('SKIP') +if not hasattr(pyb, "Accel"): + print("SKIP") raise SystemExit # init accelerometer @@ -15,40 +15,40 @@ i2c = I2C(1, I2C.MASTER, dma=True) # test polling mem_read pyb.disable_irq() -i2c.mem_read(1, 76, 0x0a) # should succeed +i2c.mem_read(1, 76, 0x0A) # should succeed pyb.enable_irq() try: pyb.disable_irq() - i2c.mem_read(1, 77, 0x0a) # should fail + i2c.mem_read(1, 77, 0x0A) # should fail except OSError as e: pyb.enable_irq() print(repr(e)) -i2c.mem_read(1, 76, 0x0a) # should succeed +i2c.mem_read(1, 76, 0x0A) # should succeed # test polling mem_write pyb.disable_irq() -i2c.mem_write(1, 76, 0x0a) # should succeed +i2c.mem_write(1, 76, 0x0A) # should succeed pyb.enable_irq() try: pyb.disable_irq() - i2c.mem_write(1, 77, 0x0a) # should fail + i2c.mem_write(1, 77, 0x0A) # should fail except OSError as e: pyb.enable_irq() print(repr(e)) -i2c.mem_write(1, 76, 0x0a) # should succeed +i2c.mem_write(1, 76, 0x0A) # should succeed # test DMA mem_read -i2c.mem_read(1, 76, 0x0a) # should succeed +i2c.mem_read(1, 76, 0x0A) # should succeed try: - i2c.mem_read(1, 77, 0x0a) # should fail + i2c.mem_read(1, 77, 0x0A) # should fail except OSError as e: print(repr(e)) -i2c.mem_read(1, 76, 0x0a) # should succeed +i2c.mem_read(1, 76, 0x0A) # should succeed # test DMA mem_write -i2c.mem_write(1, 76, 0x0a) # should succeed +i2c.mem_write(1, 76, 0x0A) # should succeed try: - i2c.mem_write(1, 77, 0x0a) # should fail + i2c.mem_write(1, 77, 0x0A) # should fail except OSError as e: print(repr(e)) -i2c.mem_write(1, 76, 0x0a) # should succeed +i2c.mem_write(1, 76, 0x0A) # should succeed |