123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import unittest
- import time
- from device.fubo_pneumatic_finger import FuboPneumaticFingerClient, get_serial_ports
- PORT = "COM3"
- init_params = {"port": PORT}
- class TestPeripheralHand(unittest.TestCase):
- def test_get_ports_from_computer_success(self):
- ports = get_serial_ports()
- self.assertTrue(len(ports) > 0)
- def test_client_init_success(self):
- client = FuboPneumaticFingerClient(init_params)
- self.assertTrue(client.is_connected)
- client.close()
- def test_client_close_success(self):
- client = FuboPneumaticFingerClient(init_params)
- client.close()
- self.assertFalse(client.is_connected)
- def test_start_flex_and_extend_success(self):
- client = FuboPneumaticFingerClient(init_params)
- client.start_round(time_interval=7)
- time.sleep(3)
- client.close()
- def test_start_extend_success(self):
- client = FuboPneumaticFingerClient(init_params)
- client.extend()
- time.sleep(3)
- client.close()
- def test_start_operate_success(self):
- client = FuboPneumaticFingerClient(init_params)
- client.start('flex')
- time.sleep(3)
- client.close()
|