there is something strange happening with Python 3.11 and type hints and auto conversion.
When you have a Type Hint Any and default Value is None in 3.11 'none' is always converted to None while in 3.10. it stays a string.
Given that Test:
*** Settings ***
Library mylib.py
*** Test Cases ***
Test
Myfunc none none
Test 2
Myfunc Hello Hello
And That Library
from typing import Any, Optional, Union
def myfunc(value, assertion_expected: Any = None):
assert value == assertion_expected, (
"Assertion failed: "
f"{value} ({type(value)}) != {assertion_expected} ({type(assertion_expected)})"
)
It fails in Python 3.11 and passes in 3.10
def myfunc(value, assertion_expected: Optional[Any] = None):
The Optional[Any] fixes it.
Also Libdoc behaves differently and only shows as Type hint.