Skip to content

Commit d32d495

Browse files
committed
cov.
1 parent 13cd2da commit d32d495

5 files changed

Lines changed: 22 additions & 4 deletions

File tree

test/client/test_client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,12 @@ def test_client_mixin_convert_datatype_fail(self):
307307
with pytest.raises(TypeError):
308308
ModbusClientMixin.convert_from_registers([123], ("d", 4)) # type: ignore[arg-type]
309309

310+
def test_client_mixin_execute(self):
311+
"""Test mixin execute."""
312+
a = ModbusClientMixin()
313+
a.execute(False, cast(ModbusPDU, None))
314+
315+
310316

311317
class TestClientBase:
312318
"""Test client code."""

test/datastore/test_sequential.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ def test_datastore_Sequential_set(self):
2828
def test_datastore_Sequential_iter(self):
2929
"""Test check frame."""
3030
block = ModbusSequentialDataBlock(0x01, [17])
31+
str(block)
3132
_ = list(block)

test/pdu/test_pdu.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ def test_pdu_instance(self, pdutype):
164164
pdu = pdutype()
165165
assert pdu
166166

167+
def test_pdu_base_instance(self):
168+
"""Test that all PDU types can be created."""
169+
pdu = ModbusPDU(4)
170+
str(pdu)
171+
assert pdu
172+
assert pdu.encode() == b''
173+
167174
@pytest.mark.parametrize(("pdutype", "args", "kwargs", "frame"), requests + responses)
168175
@pytest.mark.usefixtures("frame", "args")
169176
def test_pdu_instance_args(self, pdutype, kwargs):

test/server/test_server_asyncio.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ def connection_made(self, transport):
5454
if BasicClient.data is not None:
5555
_logger.debug("TEST Client write data")
5656
self.transport.write(BasicClient.data) # type: ignore[union-attr]
57-
if BasicClient.dataTo is not None:
58-
_logger.debug("TEST Client sendTo data")
59-
self.transport.sendto(BasicClient.dataTo) # type: ignore[union-attr]
57+
_logger.debug("TEST Client sendTo data")
58+
self.transport.sendto(BasicClient.dataTo) # type: ignore[union-attr]
6059

6160
def data_received(self, data):
6261
"""Get Data received."""

test/server/test_simulator.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from pymodbus.client import AsyncModbusTcpClient
1111
from pymodbus.datastore.simulator import Cell, CellType
1212
from pymodbus.server import ModbusSimulatorServer
13-
from pymodbus.server.simulator.main import run_main
13+
from pymodbus.server.simulator.main import get_commandline, run_main
1414
from pymodbus.transport import NULLMODEM_HOST
1515

1616

@@ -235,6 +235,11 @@ async def setup_simulator_server(self, server, device, unused_tcp_port, only_obj
235235
await task.stop()
236236
await task_future
237237

238+
def test_simulator_commandline(self):
239+
"""Test commandline."""
240+
assert get_commandline()
241+
assert get_commandline(["--json_file", "got it"])
242+
238243
async def test_simulator_server_tcp(self, simulator_server):
239244
"""Test init simulator server."""
240245

0 commit comments

Comments
 (0)