Exemplo n.º 1
0
 def test_run(self):        
     ar = Arduino()        
     ar.stop = False
     ar.no_serial = False
     cb = MagicMock()
     ar.ser = MagicMock()
     
     def fake_readline(val):
         return b"l"
     ar.ser.readline = fake_readline
     ar.subscribers = [cb]
     ar.start()
     ar.stop = True
     ar.join()
     cb.assert_called_with("l")
Exemplo n.º 2
0
 def test_subscribe(self):
     ar = Arduino()
     ar.subscribers = []        
     cb = MagicMock()       
     ar.subscribe(cb)        
     self.assertEqual(ar.subscribers[0], cb)