[英]How to check if the dictionary is empty or not in robot framework using python
我試圖檢查給定的詞典在機器人框架中是否為空,但給出語法錯誤。 以下是我進行比較的以下示例:
運行關鍵字如果'$ {source_list_data}'=='[]'失敗,我得到的錯誤是:
評估表達式“ [[{'data':'value'}]'=='[]”失敗:SyntaxError:語法無效(第1行)
您的語法對我有用。 奇怪,它對您不起作用。
這是使用Get Length實現它的另一種方法:
*** Settings ***
Library Collections
*** Test Cases ***
dict_empty
${source_list_data} = create dictionary
${length} = Get Length ${source_list_data}
Run Keyword If ${length} == 0 log to console Empty Dict
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.