File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -86,10 +86,10 @@ def state(self) -> str:
86
86
- 'RESET'
87
87
- 'RESET COMMUNICATION'
88
88
"""
89
- if self . _state in NMT_STATES :
89
+ try :
90
90
return NMT_STATES [self ._state ]
91
- else :
92
- return self ._state
91
+ except KeyError :
92
+ return f"UNKNOWN STATE ' { self ._state } '"
93
93
94
94
@state .setter
95
95
def state (self , new_state : str ):
Original file line number Diff line number Diff line change @@ -88,12 +88,11 @@ def test_nmt_master_on_heartbeat_initialising(self):
88
88
state = self .node .nmt .wait_for_heartbeat (self .TIMEOUT )
89
89
self .assertEqual (state , "PRE-OPERATIONAL" )
90
90
91
- @unittest .expectedFailure
92
91
def test_nmt_master_on_heartbeat_unknown_state (self ):
93
92
task = self .net .send_periodic (self .COB_ID , [0xcb ], self .PERIOD )
94
93
self .addCleanup (task .stop )
95
94
state = self .node .nmt .wait_for_heartbeat (self .TIMEOUT )
96
- # Expect the high bit to be masked out, and and unknown state string to
95
+ # Expect the high bit to be masked out, and a formatted string to
97
96
# be returned.
98
97
self .assertEqual (state , "UNKNOWN STATE '75'" )
99
98
You can’t perform that action at this time.
0 commit comments