You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently when using TypedDict as a type hint, Robot simply converts the value to a dictionary but doesn't convert or validated individual items. We are planning to add conversion and validation for generics in RF 5.1 (#4433) and it would be both convenient and consistent to also handle TypedDict objects better.
This change will cause backwards incompatibility problems if someone has used TypedDict as a type hint and used arguments do not actually match it. I don't think that's a desired situation and explicitly preventing it can be considered a bug fix.
This is pretty easy to implement, I got a prototype ready but it needs adequate tests, and I hope we can still squeeze this into RF 5.1. To avoid conflicts, it probably is a good idea to get #4433 done first.
It turned out that the Browser library, probably the biggest user of TypedDicts with Robot, has internally handled TypedDicts so that keys are case-insensitive. That means that if you have a TypedDict like
classSize(TypedDict):
width: intheight: int
it has been possible to use it like {'WIDTH: 1600, 'HEIGHT': 900}.
The current TypedDict conversion logic on Robot side doesn't support case-insensitive keys, so the above example won't work anymore. Browser library developers didn't consider this to be an important feature and we agreed Robot being more strict is fine. The change will, however, affect Browser users that have used this functionality on purpose or accidentally. If there turn out to be lot of users who are affected, or users have good uses cases for case-insensitivity, we can consider changing Robot's behavior later.
Activity
pekkaklarck commentedon Sep 25, 2022
This is pretty easy to implement, I got a prototype ready but it needs adequate tests, and I hope we can still squeeze this into RF 5.1. To avoid conflicts, it probably is a good idea to get #4433 done first.
Add missing TypedDict conversion documentation. #4477
pekkaklarck commentedon Sep 29, 2022
It turned out that the Browser library, probably the biggest user of TypedDicts with Robot, has internally handled TypedDicts so that keys are case-insensitive. That means that if you have a TypedDict like
it has been possible to use it like
{'WIDTH: 1600, 'HEIGHT': 900}.The current TypedDict conversion logic on Robot side doesn't support case-insensitive keys, so the above example won't work anymore. Browser library developers didn't consider this to be an important feature and we agreed Robot being more strict is fine. The change will, however, affect Browser users that have used this functionality on purpose or accidentally. If there turn out to be lot of users who are affected, or users have good uses cases for case-insensitivity, we can consider changing Robot's behavior later.