Python : Make sure an empty list will be received as empty list

See https://github.com/OPM/ResInsight/issues/8508
Python code linting changes detected by black
This commit is contained in:
Magne Sjaastad committed 2022-03-28 08:46:10 +02:00
1 parent ef842e7f27
commit 751bf22a6b
2 files changed
+4

No files matched your search

+3
View File
@@ -223,6 +223,9 @@ class PdmObjectBase:
def __makelist(self, list_string):
list_string = list_string.lstrip("[")
list_string = list_string.rstrip("]")
if not list_string:
# Return empty list if empty string. Otherwise, the split function will return ['']
return []
strings = list_string.split(", ")
values = []
for string in strings:
@@ -109,6 +109,7 @@ def test_summary_no_unsmry(rips_instance, initialize_test):
summary_case = rips_instance.project.import_summary_case(temp_path)
assert summary_case is None
def test_summary_set_values(rips_instance, initialize_test):
casePath = dataroot.PATH + "/flow_diagnostics_test/SIMPLE_SUMMARY2.SMSPEC"
summary_case = rips_instance.project.import_summary_case(casePath)