Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/azure-cli-core/azure/cli/core/aaz/_arg_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ def format_data(cls, data):
if isinstance(data, cls._schema.DataType):
return data

if isinstance(data, int) and cls._schema.DataType == float:
return data

raise AAZInvalidValueError(f"{cls._schema.DataType} type value expected, got '{data}'({type(data)})")


Expand Down
13 changes: 13 additions & 0 deletions src/azure-cli-core/azure/cli/core/tests/test_aaz_arg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,19 @@ def test_aaz_object_arg(self):
"new_i_pv6": '00:00:00'
})

# test assign the int value to the float field, it should be converted to float
action.setup_operations(dest_ops, ["{enable:True,tags:null,vnets:null,pt:12,newIPv6:'00:00:00'}"])
self.assertEqual(len(dest_ops._ops), 13)
dest_ops.apply(v, "properties")
self.assertEqual(v.properties, {
"enable": True,
"tags": None,
"vnets": None,
"pt": 12.0,
"new_i_pv6": '00:00:00'
})


def test_aaz_has_value_for_buildin(self):
from azure.cli.core.aaz import has_value, AAZUndefined
self.assertTrue(has_value(0))
Expand Down