#NEWLINE# def test_state_none( self ) : #NEWLINE# #INDENT# 'Test with none state.' #NEWLINE# with tempfile . TemporaryDirectory ( ) as tempdirname : #NEWLINE# #INDENT# path = os . path . join ( tempdirname , 'switch_status' ) #NEWLINE# test_switch = { #NEWLINE# #INDENT# 'oncmd' : 'echo 1 > {}' . format ( path ) , #NEWLINE# 'offcmd' : 'echo 0 > {}' . format ( path ) , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertTrue ( switch . setup ( self . hass , { #NEWLINE# #INDENT# 'switch' : { #NEWLINE# #INDENT# 'platform' : 'command_line' , #NEWLINE# 'switches' : { #NEWLINE# #INDENT# 'test' : test_switch , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# state = self . hass . states . get ( 'switch.test' ) #NEWLINE# self . assertEqual ( STATE_OFF , state . state ) #NEWLINE# switch . turn_on ( self . hass , 'switch.test' ) #NEWLINE# self . hass . pool . block_till_done ( ) #NEWLINE# state = self . hass . states . get ( 'switch.test' ) #NEWLINE# self . assertEqual ( STATE_ON , state . state ) #NEWLINE# switch . turn_off ( self . hass , 'switch.test' ) #NEWLINE# self . hass . pool . block_till_done ( ) #NEWLINE# state = self . hass . states . get ( 'switch.test' ) #NEWLINE# self . assertEqual ( STATE_OFF , state . state )