Skip to content

Commit

Permalink
[matter_yamltests] Try to not convert strings that represent a variab…
Browse files Browse the repository at this point in the history
…le in try_apply_yaml_unrepresentable_integer_for_javascript_fixes (#24751)
  • Loading branch information
vivien-apple authored and pull[bot] committed Nov 15, 2023
1 parent c4a8a7e commit 67594d3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/py_matter_yamltests/matter_yamltests/fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,15 @@ def try_apply_yaml_unrepresentable_integer_for_javascript_fixes(value):
JavaScript can not represent integers bigger than 9007199254740991. But some of the test may
uses values that are bigger than this. The current way to workaround this limitation has
been to write those numbers as strings by encapsulating them in "".
Conversion happens on a best effort basis. For example, the type of value can be a string
because a variable has been used, in which case, it would not convert to a proper int
and we would fail at runtime.
'''
if type(value) is str:
value = int(value)
try:
value = int(value)
except:
pass
return value


Expand Down

0 comments on commit 67594d3

Please sign in to comment.