Skip to content

Commit 9ad5f51

Browse files
committed
Roll version to 1.7.0
Reformat
1 parent c82aaed commit 9ad5f51

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

doipclient/client.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def __init__(
166166
client_ip_address=None,
167167
use_secure=False,
168168
auto_reconnect_tcp=False,
169-
vm_specific=None
169+
vm_specific=None,
170170
):
171171
self._ecu_logical_address = ecu_logical_address
172172
self._client_logical_address = client_logical_address
@@ -594,7 +594,11 @@ def request_activation(
594594
message = RoutingActivationRequest(
595595
self._client_logical_address,
596596
activation_type,
597-
vm_specific=self._validate_vm_specific_value(vm_specific) if vm_specific else self.vm_specific,
597+
vm_specific=(
598+
self._validate_vm_specific_value(vm_specific)
599+
if vm_specific
600+
else self.vm_specific
601+
),
598602
)
599603
self.send_doip_message(message, disable_retry=disable_retry)
600604
while True:
@@ -843,7 +847,7 @@ def _validate_vm_specific_value(value):
843847
"""
844848
if not isinstance(value, int) and value is not None:
845849
raise ValueError("Invalid vm_specific type must be int or None")
846-
if isinstance(value, int) and (value < 0 or value > 0xffffffff):
850+
if isinstance(value, int) and (value < 0 or value > 0xFFFFFFFF):
847851
raise ValueError("Invalid vm_specific value must be > 0 and <= 0xffffffff")
848852
return value
849853

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
setuptools.setup(
99
name="doipclient",
10-
version="1.1.7.dev1",
10+
version="1.1.7",
1111
description="A Diagnostic over IP (DoIP) client implementing ISO-13400-2.",
1212
long_description=long_description,
1313
long_description_content_type="text/x-rst",

tests/test_client.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,16 @@ def test_use_secure_with_external_ssl_context(mock_socket, mocker):
754754

755755
@pytest.mark.parametrize(
756756
"vm_specific, exc",
757-
((None, False), (0, False), (-1, True), (0xFFFFFFFF, False), (0x100000000, True), ("0x1", True), (10.0, True)))
757+
(
758+
(None, False),
759+
(0, False),
760+
(-1, True),
761+
(0xFFFFFFFF, False),
762+
(0x100000000, True),
763+
("0x1", True),
764+
(10.0, True),
765+
),
766+
)
758767
def test_vm_specific_setter(mock_socket, mocker, vm_specific, exc):
759768
sut = DoIPClient(test_ip, test_logical_address, auto_reconnect_tcp=True)
760769
if exc:
@@ -776,7 +785,9 @@ def test_vm_specific_static_value(mock_socket, mocker):
776785
activation_type=None,
777786
vm_specific=0x01020304,
778787
)
779-
sut.request_activation(activation_type=RoutingActivationRequest.ActivationType.Default)
788+
sut.request_activation(
789+
activation_type=RoutingActivationRequest.ActivationType.Default
790+
)
780791
assert mock_socket.tx_queue[-1] == activation_request_with_vm
781792
assert request_activation_spy.call_count == 1
782793

@@ -793,7 +804,10 @@ def test_vm_specific_request_activation_bad_value(mock_socket, mocker):
793804
vm_specific=0x01020304,
794805
)
795806
with pytest.raises(ValueError):
796-
sut.request_activation(activation_type=RoutingActivationRequest.ActivationType.Default, vm_specific=-1)
807+
sut.request_activation(
808+
activation_type=RoutingActivationRequest.ActivationType.Default,
809+
vm_specific=-1,
810+
)
797811

798812

799813
def test_vm_specific_verification_in_init(mock_socket, mocker):
@@ -806,4 +820,4 @@ def test_vm_specific_verification_in_init(mock_socket, mocker):
806820
auto_reconnect_tcp=True,
807821
activation_type=None,
808822
vm_specific=-1,
809-
)
823+
)

0 commit comments

Comments
 (0)