66from linodecli .baked import operation
77from linodecli .baked .operation import (
88 TYPES ,
9- ExplicitEmptyDictValue ,
109 ExplicitEmptyListValue ,
10+ ExplicitJsonValue ,
1111 ExplicitNullValue ,
1212 OpenAPIOperation ,
1313)
@@ -195,7 +195,7 @@ def test_parse_args_object_list(self, create_operation):
195195 "field_string" : "test1" ,
196196 "field_int" : 123 ,
197197 "field_dict" : {"nested_string" : "test2" , "nested_int" : 789 },
198- "field_array" : ["foo" , "bar" ],
198+ "field_array" : ExplicitJsonValue ( json_value = ["foo" , "bar" ]) ,
199199 "nullable_string" : None , # We expect this to be filtered out later
200200 },
201201 {"field_int" : 456 , "field_dict" : {"nested_string" : "test3" }},
@@ -216,7 +216,7 @@ def test_parse_args_object_list_json(self, create_operation):
216216 ["--object_list" , json .dumps (expected )]
217217 )
218218
219- assert result .object_list == expected
219+ assert result .object_list . json_value == expected
220220
221221 def test_parse_args_conflicting_parent_child (self , create_operation ):
222222 stderr_buf = io .StringIO ()
@@ -296,19 +296,27 @@ def test_object_arg_action_basic(self):
296296
297297 # User specifies a normal object (dict)
298298 result = parser .parse_args (["--foo" , '{"test-key": "test-value"}' ])
299- assert getattr (result , "foo" ) == {"test-key" : "test-value" }
299+ foo = getattr (result , "foo" )
300+ assert isinstance (foo , ExplicitJsonValue )
301+ assert foo .json_value == {"test-key" : "test-value" }
300302
301303 # User specifies a normal object (list)
302304 result = parser .parse_args (["--foo" , '[{"test-key": "test-value"}]' ])
303- assert getattr (result , "foo" ) == [{"test-key" : "test-value" }]
305+ foo = getattr (result , "foo" )
306+ assert isinstance (foo , ExplicitJsonValue )
307+ assert foo .json_value == [{"test-key" : "test-value" }]
304308
305309 # User wants an explicitly empty object (dict)
306310 result = parser .parse_args (["--foo" , "{}" ])
307- assert isinstance (getattr (result , "foo" ), ExplicitEmptyDictValue )
311+ foo = getattr (result , "foo" )
312+ assert isinstance (foo , ExplicitJsonValue )
313+ assert foo .json_value == {}
308314
309315 # User wants an explicitly empty object (list)
310316 result = parser .parse_args (["--foo" , "[]" ])
311- assert isinstance (getattr (result , "foo" ), ExplicitEmptyListValue )
317+ foo = getattr (result , "foo" )
318+ assert isinstance (foo , ExplicitJsonValue )
319+ assert foo .json_value == []
312320
313321 # User doesn't specify the list
314322 result = parser .parse_args ([])
0 commit comments