Skip to content

Commit b843cf5

Browse files
committed
Fixed PEP8 lint errors in TC_EVSE_2_3.py and TC_EEVSE_Utils.py taking advantage of new TestStep 3rd arg
1 parent c903bc7 commit b843cf5

File tree

2 files changed

+101
-51
lines changed

2 files changed

+101
-51
lines changed

src/python_testing/TC_EEVSE_2_3.py

+84-43
Original file line numberDiff line numberDiff line change
@@ -39,40 +39,66 @@ def pics_TC_EEVSE_2_3(self):
3939

4040
def steps_TC_EEVSE_2_3(self) -> list[TestStep]:
4141
steps = [
42-
TestStep("1", "Commissioning, already done", is_commissioning=True),
43-
TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"),
42+
TestStep("1", "Commissioning, already done",
43+
is_commissioning=True),
44+
TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.",
45+
"Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"),
4446
TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event"),
45-
TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event. Verify Event EEVSE.S.E00(EVConnected) sent"),
47+
TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event.",
48+
"Verify Event EEVSE.S.E00(EVConnected) sent"),
4649
TestStep("5", "TH sends command ClearTargets"),
47-
TestStep("5a", "TH reads from the DUT the NextChargeStartTime attribute. Verify value is null"),
48-
TestStep("5b", "TH reads from the DUT the NextChargeTargetTime attribute. Verify value is null"),
49-
TestStep("5c", "TH reads from the DUT the NextChargeRequiredEnergy attribute. Verify value is null"),
50-
TestStep("5d", "TH reads from the DUT the NextChargeTargetSoC attribute. Verify value is null"),
51-
TestStep("6", "TH sends command GetTargets. Verify that the GetTargetsResponse is sent with no targets defined"),
50+
TestStep("5a", "TH reads from the DUT the NextChargeStartTime attribute.",
51+
"Verify value is null"),
52+
TestStep("5b", "TH reads from the DUT the NextChargeTargetTime attribute.",
53+
"Verify value is null"),
54+
TestStep("5c", "TH reads from the DUT the NextChargeRequiredEnergy attribute.",
55+
"Verify value is null"),
56+
TestStep("5d", "TH reads from the DUT the NextChargeTargetSoC attribute.",
57+
"Verify value is null"),
58+
TestStep("6", "TH sends command GetTargets.",
59+
"Verify that the GetTargetsResponse is sent with no targets defined"),
5260
TestStep(
5361
"7", "TH sends command SetTargets with DayOfWeekForSequence=0x7F (i.e. having all days set) and a single ChargingTargets={TargetTime=1439,TargetSoC=null,AddedEnergy=25000000}. Assumes testing is carried out enough time before 11:59pm to attempt charging"),
54-
TestStep("7a", "TH reads from the DUT the NextChargeStartTime attribute. Verify value is before the next TargetTime above"),
55-
TestStep("7b", "TH reads from the DUT the NextChargeTargetTime attribute. Verify value is next TargetTime above"),
56-
TestStep("7c", "TH reads from the DUT the NextChargeRequiredEnergy attribute. Verify value is AddedEnergy above"),
57-
TestStep("7d", "TH reads from the DUT the NextChargeTargetSoC attribute. Verify value is null"),
58-
TestStep("8", "TH sends command GetTargets. Verify that the GetTargetsResponse is sent with targets equivalent to the above (Note 1)"),
62+
TestStep("7a", "TH reads from the DUT the NextChargeStartTime attribute.",
63+
"Verify value is before the next TargetTime above"),
64+
TestStep("7b", "TH reads from the DUT the NextChargeTargetTime attribute.",
65+
"Verify value is next TargetTime above"),
66+
TestStep("7c", "TH reads from the DUT the NextChargeRequiredEnergy attribute.",
67+
"Verify value is AddedEnergy above"),
68+
TestStep("7d", "TH reads from the DUT the NextChargeTargetSoC attribute.",
69+
"Verify value is null"),
70+
TestStep("8", "TH sends command GetTargets.",
71+
"Verify that the GetTargetsResponse is sent with targets equivalent to the above (Note 1)"),
5972
TestStep(
6073
"9", "TH sends command SetTargets with DayOfWeekForSequence=0x7F (i.e. having all days set) and a single ChargingTargets={TargetTime=1,TargetSoC=100,AddedEnergy=null}. Assumes testing is carried out enough time before 11:59pm to attempt charging"),
61-
TestStep("9a", "TH reads from the DUT the NextChargeStartTime attribute. Verify value is before the next TargetTime above"),
62-
TestStep("9b", "TH reads from the DUT the NextChargeTargetTime attribute. Verify value is TargetTime above"),
63-
TestStep("9c", "TH reads from the DUT the NextChargeRequiredEnergy attribute. Verify value is null"),
64-
TestStep("9d", "TH reads from the DUT the NextChargeTargetSoC attribute. Verify value is 100"),
65-
TestStep("10", "TH sends command GetTargets. Verify that the GetTargetsResponse is sent with targets equivalent to the above (Note 1)"),
74+
TestStep("9a", "TH reads from the DUT the NextChargeStartTime attribute.",
75+
"Verify value is before the next TargetTime above"),
76+
TestStep("9b", "TH reads from the DUT the NextChargeTargetTime attribute.",
77+
"Verify value is TargetTime above"),
78+
TestStep("9c", "TH reads from the DUT the NextChargeRequiredEnergy attribute.",
79+
"Verify value is null"),
80+
TestStep("9d", "TH reads from the DUT the NextChargeTargetSoC attribute.",
81+
"Verify value is 100"),
82+
TestStep("10", "TH sends command GetTargets.",
83+
"Verify that the GetTargetsResponse is sent with targets equivalent to the above (Note 1)"),
6684
TestStep("11", "TH sends command SetTargets with DayOfWeekForSequence=0x40 (i.e. having Saturday set) and 10 ChargingTargets with TargetTimes=60,180,300,420,540,660,780,900,1020,1140 and all with TargetSoC=null, AddedEnergy=25000000}."),
67-
TestStep("12", "TH sends command SetTargets with DayOfWeekForSequence=0x01 (i.e. having Sunday set) and no ChargingTargets"),
68-
TestStep("13", "TH sends command GetTargets. Verify that the GetTargetsResponse is sent with 1 targets for each day Monday to Friday equivalent to step 9 (Note 1), 10 targets for Saturday as step 11, and no targets for Sunday."),
85+
TestStep(
86+
"12", "TH sends command SetTargets with DayOfWeekForSequence=0x01 (i.e. having Sunday set) and no ChargingTargets"),
87+
TestStep("13", "TH sends command GetTargets.",
88+
"Verify that the GetTargetsResponse is sent with 1 targets for each day Monday to Friday equivalent to step 9 (Note 1), 10 targets for Saturday as step 11, and no targets for Sunday."),
6989
TestStep("14", "TH sends command ClearTargets"),
70-
TestStep("14a", "TH reads from the DUT the NextChargeStartTime attribute. Verify value is null"),
71-
TestStep("14b", "TH reads from the DUT the NextChargeTargetTime attribute. Verify value is null"),
72-
TestStep("14c", "TH reads from the DUT the NextChargeRequiredEnergy attribute. Verify value is null"),
73-
TestStep("14d", "TH reads from the DUT the NextChargeTargetSoC attribute. Verify value is null"),
74-
TestStep("15", "TH sends command GetTargets. Verify that the GetTargetsResponse is sent with no targets defined"),
75-
TestStep("16", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event Clear. Verify Event EEVSE.S.E01(EVNotDetected) sent"),
90+
TestStep("14a", "TH reads from the DUT the NextChargeStartTime attribute.",
91+
"Verify value is null"),
92+
TestStep("14b", "TH reads from the DUT the NextChargeTargetTime attribute.",
93+
"Verify value is null"),
94+
TestStep("14c", "TH reads from the DUT the NextChargeRequiredEnergy attribute.",
95+
"Verify value is null"),
96+
TestStep("14d", "TH reads from the DUT the NextChargeTargetSoC attribute.",
97+
"Verify value is null"),
98+
TestStep("15", "TH sends command GetTargets.",
99+
"Verify that the GetTargetsResponse is sent with no targets defined"),
100+
TestStep("16", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event Clear.",
101+
"Verify Event EEVSE.S.E01(EVNotDetected) sent"),
76102
TestStep("17", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event Clear."),
77103
]
78104

@@ -81,7 +107,8 @@ def steps_TC_EEVSE_2_3(self) -> list[TestStep]:
81107
def log_get_targets_response(self, get_targets_response):
82108
logger.info(f" Rx'd: {get_targets_response}")
83109
for index, entry in enumerate(get_targets_response.chargingTargetSchedules):
84-
logger.info(f" [{index}] DayOfWeekForSequence: {entry.dayOfWeekForSequence:02x}")
110+
logger.info(
111+
f" [{index}] DayOfWeekForSequence: {entry.dayOfWeekForSequence:02x}")
85112
for sub_index, sub_entry in enumerate(entry.chargingTargets):
86113
logger.info(
87114
f" - [{sub_index}] TargetTime: {sub_entry.targetTimeMinutesPastMidnight} TargetSoC: {sub_entry.targetSoC} AddedEnergy: {sub_entry.addedEnergy}")
@@ -106,7 +133,8 @@ async def test_TC_EEVSE_2_3(self):
106133

107134
self.step("4")
108135
await self.send_test_event_trigger_pluggedin()
109-
event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EVConnected)
136+
event_data = events_callback.wait_for_event_report(
137+
Clusters.EnergyEvse.Events.EVConnected)
110138
session_id = event_data.sessionID
111139

112140
self.step("5")
@@ -127,7 +155,8 @@ async def test_TC_EEVSE_2_3(self):
127155
self.step("6")
128156
get_targets_response = await self.send_get_targets_command()
129157
self.log_get_targets_response(get_targets_response)
130-
empty_targets_response = Clusters.EnergyEvse.Commands.GetTargetsResponse(chargingTargetSchedules=[])
158+
empty_targets_response = Clusters.EnergyEvse.Commands.GetTargetsResponse(
159+
chargingTargetSchedules=[])
131160
asserts.assert_equal(get_targets_response, empty_targets_response,
132161
f"Unexpected 'GetTargets' response value - expected {empty_targets_response}, was {get_targets_response}")
133162

@@ -190,16 +219,26 @@ async def test_TC_EEVSE_2_3(self):
190219
self.step("11")
191220
# This should modify Sat (0x40) with 10 targets throughout the day
192221
daily_targets_step_11 = [
193-
Clusters.EnergyEvse.Structs.ChargingTargetStruct(targetTimeMinutesPastMidnight=60, addedEnergy=25000000),
194-
Clusters.EnergyEvse.Structs.ChargingTargetStruct(targetTimeMinutesPastMidnight=180, addedEnergy=25000000),
195-
Clusters.EnergyEvse.Structs.ChargingTargetStruct(targetTimeMinutesPastMidnight=300, addedEnergy=25000000),
196-
Clusters.EnergyEvse.Structs.ChargingTargetStruct(targetTimeMinutesPastMidnight=420, addedEnergy=25000000),
197-
Clusters.EnergyEvse.Structs.ChargingTargetStruct(targetTimeMinutesPastMidnight=540, addedEnergy=25000000),
198-
Clusters.EnergyEvse.Structs.ChargingTargetStruct(targetTimeMinutesPastMidnight=660, addedEnergy=25000000),
199-
Clusters.EnergyEvse.Structs.ChargingTargetStruct(targetTimeMinutesPastMidnight=780, addedEnergy=25000000),
200-
Clusters.EnergyEvse.Structs.ChargingTargetStruct(targetTimeMinutesPastMidnight=900, addedEnergy=25000000),
201-
Clusters.EnergyEvse.Structs.ChargingTargetStruct(targetTimeMinutesPastMidnight=1020, addedEnergy=25000000),
202-
Clusters.EnergyEvse.Structs.ChargingTargetStruct(targetTimeMinutesPastMidnight=1140, addedEnergy=25000000),
222+
Clusters.EnergyEvse.Structs.ChargingTargetStruct(
223+
targetTimeMinutesPastMidnight=60, addedEnergy=25000000),
224+
Clusters.EnergyEvse.Structs.ChargingTargetStruct(
225+
targetTimeMinutesPastMidnight=180, addedEnergy=25000000),
226+
Clusters.EnergyEvse.Structs.ChargingTargetStruct(
227+
targetTimeMinutesPastMidnight=300, addedEnergy=25000000),
228+
Clusters.EnergyEvse.Structs.ChargingTargetStruct(
229+
targetTimeMinutesPastMidnight=420, addedEnergy=25000000),
230+
Clusters.EnergyEvse.Structs.ChargingTargetStruct(
231+
targetTimeMinutesPastMidnight=540, addedEnergy=25000000),
232+
Clusters.EnergyEvse.Structs.ChargingTargetStruct(
233+
targetTimeMinutesPastMidnight=660, addedEnergy=25000000),
234+
Clusters.EnergyEvse.Structs.ChargingTargetStruct(
235+
targetTimeMinutesPastMidnight=780, addedEnergy=25000000),
236+
Clusters.EnergyEvse.Structs.ChargingTargetStruct(
237+
targetTimeMinutesPastMidnight=900, addedEnergy=25000000),
238+
Clusters.EnergyEvse.Structs.ChargingTargetStruct(
239+
targetTimeMinutesPastMidnight=1020, addedEnergy=25000000),
240+
Clusters.EnergyEvse.Structs.ChargingTargetStruct(
241+
targetTimeMinutesPastMidnight=1140, addedEnergy=25000000),
203242
]
204243
targets_step_11 = [Clusters.EnergyEvse.Structs.ChargingTargetScheduleStruct(
205244
dayOfWeekForSequence=0x40, chargingTargets=daily_targets_step_11)]
@@ -220,9 +259,9 @@ async def test_TC_EEVSE_2_3(self):
220259
# [1] This should be (Sat) = 0x40 with 10 TargetTimes and added Energy 25kWh (from step 11)
221260
# [2] This should be (Sun) = 0x01 with NO Targets (from step 12)
222261
asserts.assert_equal(len(get_targets_response.chargingTargetSchedules), 3,
223-
f"'GetTargets' response should have 3 entries")
262+
"'GetTargets' response should have 3 entries")
224263
asserts.assert_equal(get_targets_response.chargingTargetSchedules[0].dayOfWeekForSequence, 0x3e,
225-
f"'GetTargets' response entry 0 should have DayOfWeekForSequence = 0x3e (62)")
264+
"'GetTargets' response entry 0 should have DayOfWeekForSequence = 0x3e (62)")
226265
asserts.assert_equal(get_targets_response.chargingTargetSchedules[0].chargingTargets, daily_targets_step_9,
227266
f"'GetTargets' response entry 0 should have chargingTargets = {daily_targets_step_9})")
228267
asserts.assert_equal(get_targets_response.chargingTargetSchedules[1], targets_step_11[0],
@@ -253,9 +292,11 @@ async def test_TC_EEVSE_2_3(self):
253292

254293
self.step("16")
255294
await self.send_test_event_trigger_pluggedin_clear()
256-
event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EVNotDetected)
295+
event_data = events_callback.wait_for_event_report(
296+
Clusters.EnergyEvse.Events.EVNotDetected)
257297
expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand
258-
self.validate_ev_not_detected_event(event_data, session_id, expected_state, expected_duration=0, expected_charged=0)
298+
self.validate_ev_not_detected_event(
299+
event_data, session_id, expected_state, expected_duration=0, expected_charged=0)
259300

260301
self.step("17")
261302
await self.send_test_event_trigger_basic_clear()

0 commit comments

Comments
 (0)