# Example RF keyword library to generate sub-dictionary
def create_sub_dict(data_dict, keys_list):
sub_dict = {k: data_dict[k] for k in keys_list}
return sub_dict
${my_dict}= create_sub_dict ${data_dict} ${keys_list}
# Example Python function to get dictionary
def get_dictionary():
my_dict = {'a': 1, 'b': 2, 'c': 3}
return my_dict
${dict_from_func} Get Dictionary
# Example test case comparing sub-dictionary and dictionary obtained from function
*** Test Cases ***
Compare Dictionaries
${my_dict}= create sub dictionary ${data_dict} ${keys_list}
${dict_from_func} Get Dictionary
Assert Dict Equal ${my_dict} ${dict_from_func}
这样,我们就可以比较从RF生成的子字典与从Python函数获取的字典,确保它们在内容上是相等的。