Skip to content

Commit 347e6dd

Browse files
committed
fix: black and pylint
1 parent 8e90890 commit 347e6dd

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

gpio_expander.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,12 @@ def __new__(mcs, clsname, bases, dct, *args, **kwargs): # pylint: disable=unuse
8989
# entire registries
9090
_result_dct['input_ports'] = ROBits(8 * _width, _INPUT_PORT * _width, 0, register_width=_width)
9191
_result_dct['output_ports'] = RWBits(8 * _width, _OUTPUT_PORT * _width, 0, register_width=_width)
92-
_result_dct['polarity_inversions'] = RWBits(8 * _width, _POLARITY_REGISTER * _width, 0, register_width=_width)
93-
_result_dct['configuration_ports'] = RWBits(8 * _width, _CONFIG_REGISTER * _width, 0, register_width=_width)
92+
_result_dct['polarity_inversions'] = RWBits(
93+
8 * _width, _POLARITY_REGISTER * _width, 0, register_width=_width
94+
)
95+
_result_dct['configuration_ports'] = RWBits(
96+
8 * _width, _CONFIG_REGISTER * _width, 0, register_width=_width
97+
)
9498

9599
# create single bit registries
96100
for x in range(value):

tests/test_registry_params.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
from gpio_expander import _get_registry_params
2-
import pytest
3-
4-
5-
def test_value_16():
6-
_, _w, _, _ = _get_registry_params(16, 1)
7-
assert _w == 2
1+
"""Common method pytest module file."""
82

3+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
4+
# SPDX-FileCopyrightText: Copyright (c) 2022 Gabriele Pongelli
5+
#
6+
# SPDX-License-Identifier: MIT
97

10-
def test_value_8():
11-
_, _w, _, _ = _get_registry_params(8, 1)
12-
assert _w == 1
8+
import pytest
9+
from gpio_expander import _get_registry_params
1310

1411

1512
@pytest.mark.parametrize(
@@ -23,18 +20,18 @@ def test_value_8():
2320
pytest.param(5, "0_", 2, 0, 5, id="input 5"),
2421
pytest.param(6, "0_", 2, 0, 6, id="input 6"),
2522
pytest.param(7, "0_", 2, 0, 7, id="input 7"),
26-
2723
pytest.param(8, "1_", 2, 1, 0, id="input 8"),
2824
pytest.param(9, "1_", 2, 1, 1, id="input 9"),
2925
pytest.param(10, "1_", 2, 1, 2, id="input 10"),
3026
pytest.param(11, "1_", 2, 1, 3, id="input 11"),
3127
pytest.param(12, "1_", 2, 1, 4, id="input 12"),
3228
pytest.param(13, "1_", 2, 1, 5, id="input 13"),
3329
pytest.param(14, "1_", 2, 1, 6, id="input 14"),
34-
pytest.param(15, "1_", 2, 1, 7, id="input 15")
35-
]
30+
pytest.param(15, "1_", 2, 1, 7, id="input 15"),
31+
],
3632
)
3733
def test_loop_16(x_input, exp_name, exp_addr_mul, exp_adder, exp_idx):
34+
"""Test common method for 16 GPIO expander."""
3835
_name, _reg_address_multiplier, _adder, _idx = _get_registry_params(16, x_input)
3936
print(_name)
4037
print(_reg_address_multiplier)
@@ -57,9 +54,10 @@ def test_loop_16(x_input, exp_name, exp_addr_mul, exp_adder, exp_idx):
5754
pytest.param(5, "", 1, 0, 5, id="input 5"),
5855
pytest.param(6, "", 1, 0, 6, id="input 6"),
5956
pytest.param(7, "", 1, 0, 7, id="input 7"),
60-
]
57+
],
6158
)
6259
def test_loop_8(x_input, exp_name, exp_addr_mul, exp_adder, exp_idx):
60+
"""Test common method for 8 GPIO expander."""
6361
_name, _reg_address_multiplier, _adder, _idx = _get_registry_params(8, x_input)
6462
print(_name)
6563
print(_reg_address_multiplier)

0 commit comments

Comments
 (0)