Coverage for src/test/python/test_motor.py : 96%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import unittest
3from src.main.python.motor import Motor
6class TestMotor(unittest.TestCase):
8 motor = Motor(99)
10 def test_create(self):
11 m2 = Motor(88)
12 self.assertEqual(self.motor.is_running(), m2.is_running())
13 m3 = Motor(77, running=True)
14 self.assertTrue(m3.is_running())
15 m3 = Motor(77, running=False)
16 self.assertFalse(m3.is_running())
18 def test_start(self):
19 self.motor.on()
20 self.assertTrue(self.motor.is_running())
21 self.motor.off()
22 self.assertFalse(self.motor.is_running())
23 self.motor.on()
24 self.assertTrue(self.motor.is_running())
26 def test_print(self):
27 m3 = Motor(66, running=True)
28 m3.on()
29 m3.off()
30 print(m3)
31 print(self.motor)
34if __name__ == '__main__':
35 unittest.main()