Skip to content

Commit e12539e

Browse files
committed
temp.
1 parent 95a8fc4 commit e12539e

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

pymodbus/datastore/simulator.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,9 +534,7 @@ def action_reset(cls, inx):
534534
# Internal helper methods
535535
# --------------------------------------------
536536

537-
def validate_type(
538-
self, func_code, real_address, count
539-
):
537+
def validate_type(self, func_code, real_address, count):
540538
"""Check if request is done against correct type
541539
542540
:meta private:

test/test_datastore_simulator.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ class TestSimulator:
6262
[3, 4],
6363
],
6464
"write": [
65-
6,
66-
[8, 10],
65+
5,
66+
[7, 8],
67+
[16, 17],
6768
],
6869
"bits": [
6970
5,
@@ -95,19 +96,19 @@ class TestSimulator:
9596
Cell(CELL_TYPE_ILLEGAL, False, 0, None),
9697
Cell(CELL_TYPE_ILLEGAL, False, 0, None),
9798
Cell(CELL_TYPE_ILLEGAL, False, 0, None),
98-
Cell(CELL_TYPE_BIT, False, 1800, None),
99-
Cell(CELL_TYPE_ILLEGAL, True, 0, None),
100-
Cell(CELL_TYPE_BIT, False, 1800, None),
10199
Cell(CELL_TYPE_BIT, True, 1800, None),
102-
Cell(CELL_TYPE_ILLEGAL, True, 0, None),
103-
Cell(CELL_TYPE_BIT, True, 0x81, None), # 10
100+
Cell(CELL_TYPE_ILLEGAL, False, 0, None),
101+
Cell(CELL_TYPE_BIT, True, 1800, None),
102+
Cell(CELL_TYPE_BIT, True, 1800, None),
103+
Cell(CELL_TYPE_ILLEGAL, False, 0, None),
104+
Cell(CELL_TYPE_BIT, False, 0x81, None), # 10
104105
Cell(CELL_TYPE_BIT, False, 0x42, None),
105106
Cell(CELL_TYPE_BIT, False, 0x42, None),
106107
Cell(CELL_TYPE_BIT, False, 1800, True),
107108
Cell(CELL_TYPE_BIT, False, 15, True),
108109
Cell(CELL_TYPE_ILLEGAL, False, 0, None),
109-
Cell(CELL_TYPE_UINT16, False, 14661, True),
110-
Cell(CELL_TYPE_UINT16, False, 14661, True),
110+
Cell(CELL_TYPE_UINT16, True, 14661, True),
111+
Cell(CELL_TYPE_UINT16, True, 14661, True),
111112
Cell(CELL_TYPE_UINT32, False, 17320, True),
112113
Cell(CELL_TYPE_NEXT, False, 5, None),
113114
Cell(CELL_TYPE_UINT32, False, 17320, True), # 20
@@ -187,7 +188,7 @@ def test_simulator_validate_illegal(self):
187188
exp2 = self.simulator.validate(func_code, addr, count)
188189
if addr in {0, 1, 2, 3, 4, 6, 9, 15} or (
189190
func_code in (FX_WRITE_BIT, FX_WRITE_REG)
190-
and addr not in {6, 8, 9, 10}
191+
and addr not in {5, 7, 8, 16, 17}
191192
):
192193
assert not exp1, f"at index {addr}"
193194
else:
@@ -196,7 +197,7 @@ def test_simulator_validate_illegal(self):
196197
if addr in {8, 14} or (
197198
func_code in (FX_WRITE_BIT, FX_WRITE_REG) and addr in {6, 9, 10}
198199
):
199-
assert not exp2, f"at index {addr}"
200+
assert not exp2, f"at yy index {addr}"
200201

201202
def test_simulator_type_validate(self):
202203
"""Test validate call."""

0 commit comments

Comments
 (0)