Skip to content

Add get_keyword_types to support argument conversion #83

Open
@martinezlc99

Description

@martinezlc99

Issue
When using a custom Python library via RobotRemoteServer, automatic type conversion seems to fail. All arguments are passed as str. When using the same library nominally, automatic type conversion occurs as expected.

Actual Behavior
Multiply.py

import robot.api.deco
import robotremoteserver

class Multiply:
    @robot.api.deco.keyword(name="Multiply Two Numbers", types={"x": float, "y": float})
    def multiply(self, x: float, y: float):
        """multiply 'em"""
        return x * y


if __name__ == "__main__":
    robotremoteserver.RobotRemoteServer(Multiply())

multiply.robot

*** Settings ***
Documentation    Test automatic type conversions
# Library    Multiply
Library    Remote    127.0.0.1:8270


*** Test Cases ***
Multiply Them With Type Conversion
    [Documentation]    Automatic type Conversion should occur
    ${product} =    Multiply Two Numbers    1.5    2.5
    Log    ${sum}

Executing the test with fails with TypeError: can't multiply sequence by non-int of type 'str'. Passing the arguments as named also fails.

Expected Behavior
Running the test as a normal Python library works as expected:

multiply.robot

*** Settings ***
Documentation    Test automatic type conversions
Library    Multiply
# Library    Remote    127.0.0.1:8270

*** Test Cases ***
Multiply Them With Type Conversion
    [Documentation]    Automatic Type Conversion should occur
    ${product} =    Multiply Two Numbers    1.5    2.5
    Log    ${sum}

Is this a known limitation? I could not find any relevant documentaion. If not, then this is probably a bug in the Remote library I suspect. I am glad to open an issue there and look into a PR.

System info:
python -m robot --version -> Robot Framework 6.0.2 (Python 3.10.6 on win32)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions