@@ -72,39 +72,30 @@ def test_next_state_indirect_from_all_known_states(self):
7272 # All states except OPERATION ENABLED should have a path
7373 if state != 'OPERATION ENABLED' :
7474 self .assertIsNotNone (result , f"No indirect path from { state } " )
75- self .assertIn (result , State402 .SW_MASK ,
76- f"Indirect state { result } is not a known state" )
75+ self .assertIn (
76+ result , State402 .SW_MASK , f"Indirect state { result } is not a known state"
77+ )
7778
7879 def test_next_state_indirect_specific_paths (self ):
7980 self .assertEqual (
80- State402 .next_state_indirect ('SWITCH ON DISABLED' ),
81- 'READY TO SWITCH ON' )
81+ State402 .next_state_indirect ('SWITCH ON DISABLED' ), 'READY TO SWITCH ON'
82+ )
83+ self .assertEqual (State402 .next_state_indirect ('READY TO SWITCH ON' ), 'SWITCHED ON' )
84+ self .assertEqual (State402 .next_state_indirect ('SWITCHED ON' ), 'OPERATION ENABLED' )
85+ self .assertEqual (State402 .next_state_indirect ('FAULT' ), 'SWITCH ON DISABLED' )
86+ self .assertEqual (State402 .next_state_indirect ('FAULT REACTION ACTIVE' ), 'FAULT' )
8287 self .assertEqual (
83- State402 .next_state_indirect ('READY TO SWITCH ON' ),
84- 'SWITCHED ON' )
85- self .assertEqual (
86- State402 .next_state_indirect ('SWITCHED ON' ),
87- 'OPERATION ENABLED' )
88- self .assertEqual (
89- State402 .next_state_indirect ('FAULT' ),
90- 'SWITCH ON DISABLED' )
91- self .assertEqual (
92- State402 .next_state_indirect ('FAULT REACTION ACTIVE' ),
93- 'FAULT' )
94- self .assertEqual (
95- State402 .next_state_indirect ('QUICK STOP ACTIVE' ),
96- 'SWITCH ON DISABLED' )
88+ State402 .next_state_indirect ('QUICK STOP ACTIVE' ), 'SWITCH ON DISABLED'
89+ )
9790
9891 def test_next_state_indirect_unknown_state (self ):
9992 self .assertIsNone (State402 .next_state_indirect ('NONEXISTENT' ))
10093
10194 def test_transition_table_keys_are_valid_states (self ):
10295 known = set (State402 .SW_MASK .keys ()) | {'START' , 'DISABLE VOLTAGE' }
10396 for from_state , to_state in State402 .TRANSITIONTABLE :
104- self .assertIn (from_state , known ,
105- f"Unknown from-state: { from_state } " )
106- self .assertIn (to_state , known ,
107- f"Unknown to-state: { to_state } " )
97+ self .assertIn (from_state , known , f"Unknown from-state: { from_state } " )
98+ self .assertIn (to_state , known , f"Unknown to-state: { to_state } " )
10899
109100
110101class TestBaseNode402State (unittest .TestCase ):
@@ -161,9 +152,7 @@ def _set_state(self, state_name):
161152 def test_direct_transition (self ):
162153 """When a direct transition exists, _next_state returns the target."""
163154 self ._set_state ('SWITCH ON DISABLED' )
164- self .assertEqual (
165- self .node ._next_state ('READY TO SWITCH ON' ),
166- 'READY TO SWITCH ON' )
155+ self .assertEqual (self .node ._next_state ('READY TO SWITCH ON' ), 'READY TO SWITCH ON' )
167156
168157 def test_indirect_transition (self ):
169158 """When no direct path, _next_state returns the indirect next step."""
@@ -198,11 +187,14 @@ def test_full_path_to_operation_enabled(self):
198187 path .append (next_s )
199188 self ._set_state (next_s )
200189 current = self .node .state
201- self .assertEqual (path , [
202- 'READY TO SWITCH ON' ,
203- 'SWITCHED ON' ,
204- 'OPERATION ENABLED' ,
205- ])
190+ self .assertEqual (
191+ path ,
192+ [
193+ 'READY TO SWITCH ON' ,
194+ 'SWITCHED ON' ,
195+ 'OPERATION ENABLED' ,
196+ ],
197+ )
206198
207199 def test_path_from_fault_to_operation_enabled (self ):
208200 """Walk from FAULT to OPERATION ENABLED."""
@@ -215,12 +207,15 @@ def test_path_from_fault_to_operation_enabled(self):
215207 path .append (next_s )
216208 self ._set_state (next_s )
217209 current = self .node .state
218- self .assertEqual (path , [
219- 'SWITCH ON DISABLED' ,
220- 'READY TO SWITCH ON' ,
221- 'SWITCHED ON' ,
222- 'OPERATION ENABLED' ,
223- ])
210+ self .assertEqual (
211+ path ,
212+ [
213+ 'SWITCH ON DISABLED' ,
214+ 'READY TO SWITCH ON' ,
215+ 'SWITCHED ON' ,
216+ 'OPERATION ENABLED' ,
217+ ],
218+ )
224219
225220
226221class TestBaseNode402HomingStatus (unittest .TestCase ):
0 commit comments