question

nanthil avatar image
nanthil asked alexorr answered

Multiline Dictionary or JSON

I would like to be able to define data structures more directly. Is it possible to define dictionary literals / json literals that occupy more than a single line as in the following example?

my_dict = {
	'prop1': 'val',
	'prop2': {
		'innerprop1': 123,
		'innerprop2': [1,2,3,4,5]
	},
	'prop3': ['a','b','c']
}

What about multiline function definitions?

def my_func(arg1, arg2):
	something      = do_something(arg1)
	something_else = do_something_else(arg2)<br>	return arg1 + arg2
pythonjsondictionary
1 comment
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

nanthil avatar image nanthil commented ·

Not sure why there is a 5. in the output, its not there in my post. Please ignore the 5. in the my_dict example.

0 Likes 0 ·
alexorr avatar image
alexorr answered nanthil commented

Is this in reference to iTest? If so, you can do multi-line steps by going to step properties and clicking the Details button on the Command field. For a function definition, however, I'd recommend creating a new procedure either in your test case or in a separate procedure library.

1 comment
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

nanthil avatar image nanthil commented ·

I do not see a "Details" button anywhere within the Step Properties pane. Can you tell me where to find it?

0 Likes 0 ·
alexorr avatar image
alexorr answered

Make sure you have the step you want to change highlighted.


10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.