Skip to content

Commit

Permalink
fmt: fix formatting not handled when using Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jls5177 committed Nov 19, 2024
1 parent 67f9b23 commit edafda2
Showing 1 changed file with 59 additions and 44 deletions.
103 changes: 59 additions & 44 deletions tests/layers/mctp/control/test_get_eid.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

from pymctp.layers import EndpointContext
from pymctp.layers.mctp.control import (
GetEndpointID, GetEndpointIDResponse, EndpointType, EndpointIDType, CompletionCodes
GetEndpointID,
GetEndpointIDResponse,
EndpointType,
EndpointIDType,
CompletionCodes,
)
from pymctp.utils import str_to_bytes

Expand Down Expand Up @@ -39,55 +43,66 @@ def test_response_with_bytes_is_decoded():
assert pkt.medium_specific == 0


@pytest.mark.parametrize(("expected_summary", "pkt_kwargs"), [
("GetEndpointID (eid: 44, type: simple, eid_type: dynamic)", {}),
("GetEndpointID (eid: 44, type: busowner, eid_type: dynamic)",
dict(endpoint_type=EndpointType.BUS_OWNER)),
("GetEndpointID (eid: 44, type: simple, eid_type: static_eid_supported)",
dict(endpoint_id_type=EndpointIDType.STATIC_EID_SUPPORTED)),
("GetEndpointID (eid: 44, type: simple, eid_type: static_eid_match)",
dict(endpoint_id_type=EndpointIDType.STATIC_EID_MATCH)),
("GetEndpointID (eid: 44, type: simple, eid_type: static_eid_mismatch)",
dict(endpoint_id_type=EndpointIDType.STATIC_EID_MISMATCH)),
])
@pytest.mark.parametrize(
("expected_summary", "pkt_kwargs"),
[
("GetEndpointID (eid: 44, type: simple, eid_type: dynamic)", {}),
("GetEndpointID (eid: 44, type: busowner, eid_type: dynamic)", dict(endpoint_type=EndpointType.BUS_OWNER)),
(
"GetEndpointID (eid: 44, type: simple, eid_type: static_eid_supported)",
dict(endpoint_id_type=EndpointIDType.STATIC_EID_SUPPORTED),
),
(
"GetEndpointID (eid: 44, type: simple, eid_type: static_eid_match)",
dict(endpoint_id_type=EndpointIDType.STATIC_EID_MATCH),
),
(
"GetEndpointID (eid: 44, type: simple, eid_type: static_eid_mismatch)",
dict(endpoint_id_type=EndpointIDType.STATIC_EID_MISMATCH),
),
],
)
def test_pkt_summary(expected_summary, pkt_kwargs):
default_kwargs = dict(eid=0x44, endpoint_type=EndpointType.SIMPLE, endpoint_id_type=EndpointIDType.DYNAMIC)
kwargs = dict(default_kwargs, **pkt_kwargs)
assert GetEndpointIDResponse(**kwargs).summary() == expected_summary


@pytest.mark.parametrize(("ctx_args", "expected_eid", "expected_endpoint_type", "expected_endpoint_id_type"), [
(
dict(), # use default values
0x44,
EndpointType.SIMPLE,
EndpointIDType.STATIC_EID_MATCH,
),
(
dict(assigned_eid=0x80),
0x80,
EndpointType.SIMPLE,
EndpointIDType.STATIC_EID_MISMATCH,
),
(
dict(static_eid=0x44, assigned_eid=None),
0x44,
EndpointType.SIMPLE,
EndpointIDType.STATIC_EID_SUPPORTED,
),
(
dict(static_eid=None, assigned_eid=0x44),
0x44,
EndpointType.SIMPLE,
EndpointIDType.DYNAMIC,
),
(
dict(static_eid=None, assigned_eid=0x44, is_bus_owner=True),
0x44,
EndpointType.BUS_OWNER,
EndpointIDType.DYNAMIC,
),
])
@pytest.mark.parametrize(
("ctx_args", "expected_eid", "expected_endpoint_type", "expected_endpoint_id_type"),
[
(
dict(), # use default values
0x44,
EndpointType.SIMPLE,
EndpointIDType.STATIC_EID_MATCH,
),
(
dict(assigned_eid=0x80),
0x80,
EndpointType.SIMPLE,
EndpointIDType.STATIC_EID_MISMATCH,
),
(
dict(static_eid=0x44, assigned_eid=None),
0x44,
EndpointType.SIMPLE,
EndpointIDType.STATIC_EID_SUPPORTED,
),
(
dict(static_eid=None, assigned_eid=0x44),
0x44,
EndpointType.SIMPLE,
EndpointIDType.DYNAMIC,
),
(
dict(static_eid=None, assigned_eid=0x44, is_bus_owner=True),
0x44,
EndpointType.BUS_OWNER,
EndpointIDType.DYNAMIC,
),
],
)
def test_reply_with_various_eid_types(ctx_args, expected_eid, expected_endpoint_type, expected_endpoint_id_type):
default_kwargs = dict(physical_address=0x20, static_eid=0x44, assigned_eid=0x44)
kwargs = dict(default_kwargs, **ctx_args)
Expand Down

0 comments on commit edafda2

Please sign in to comment.