def test_then_returns_motor_state(self, mock_port_adapter):
        dxl_id = 4
        adapter = DynamixelAdapter(mock_port_adapter)

        actual = adapter.read_state(dxl_id)

        assert type(actual) == MotorState
    def test_given_read_present_vel_int_1__then_returns_0_024(
            self, mock_port_adapter):
        dxl_id = 4
        mock_port_adapter.read = MagicMock(return_value=1)
        adapter = DynamixelAdapter(mock_port_adapter)

        actual = adapter.read_state(dxl_id).velocity

        assert 0.024 - actual < 0.01
    def test_given_read_present_vel_int_1__then_returns_1(
            self, mock_port_adapter):
        dxl_id = 4
        mock_port_adapter.read = MagicMock(return_value=1)
        adapter = DynamixelAdapter(mock_port_adapter)

        actual = adapter.read_state(dxl_id).velocity

        assert actual == 1.0 * 0.229 * tau / 60.0  # converted to rad/s
    def test_given_read_present_pos_int_2048_then_returns_radians_0(
            self, mock_port_adapter):
        dxl_id = 4
        mock_port_adapter.read = MagicMock(return_value=2048)
        adapter = DynamixelAdapter(mock_port_adapter)

        actual = adapter.read_state(dxl_id).position

        assert actual == 0.0