Skip to content

Commit d45a253

Browse files
author
Guillaume V.
committed
Fix [Tests] : Update tests and fix Girder cases
1 parent 633eaf6 commit d45a253

4 files changed

Lines changed: 35 additions & 26 deletions

File tree

src/vip_client/classes/VipGirder.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ def parse_value(input):
738738
# ------------------------------------------------
739739

740740
# Get the input settings after files are parsed as PathLib objects
741-
def _get_input_settings(self, location="girder") -> dict:
741+
def _get_input_settings(self, location="girder") -> list[dict]:
742742
"""
743743
Returns the input settings with filenames adapted to `location`.
744744
- if `location` = "girder", returns Girder paths string format.
@@ -768,10 +768,10 @@ def get_input(value, location) -> str:
768768
if location not in ("girder", "vip-girder"):
769769
return super()._get_input_settings(location)
770770
# Browse input settings
771-
return {
772-
key: get_input(value, location)
773-
for key, value in self._input_settings.items()
774-
}
771+
return [
772+
{key: get_input(value, location) if isinstance(value, list) else str(value) for key, value in input_dict.items()}
773+
for input_dict in self._input_settings
774+
]
775775
# ------------------------------------------------
776776

777777
######################################################

tests/test_VipGirder.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,14 @@ def test_properties_interface(mocker):
163163
# Backup the inputs
164164
backup = s.input_settings
165165
# Run a subtest for each property
166-
for prop in s.input_settings:
167-
setattr(s, prop, None) # Calls deleter
168-
assert getattr(s, prop) is None # Public attribute must be None
169-
assert not s._is_defined("_" + prop) # Private attribute must be unset
170-
setattr(s, prop, backup[prop]) # Reset
166+
for i, map in enumerate(s.input_settings):
167+
for key, value in map.items():
168+
setattr(s, key, None) # Calls deleter
169+
assert getattr(s, key) is None # Public attribute must be None
170+
assert not s._is_defined("_" + key) # Private attribute must be unset
171+
setattr(s, key, backup[i][key]) # Reset
172+
171173
# Test correct reset
172-
for key, value in s.input_settings.items():
173-
assert getattr(s, key) == value
174+
for map in s.input_settings:
175+
for key, value in map.items():
176+
assert getattr(s, key) == value

tests/test_VipLauncher.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,14 @@ def test_properties_interface(mocker):
202202
# Backup the inputs
203203
backup = s.input_settings
204204
# Run a subtest for each property
205-
for prop in s.input_settings:
206-
setattr(s, prop, None) # Calls deleter
207-
assert getattr(s, prop) is None # Public attribute must be None
208-
assert not s._is_defined("_" + prop) # Private attribute must be unset
209-
setattr(s, prop, backup[prop]) # Reset
205+
for i, map in enumerate(s.input_settings):
206+
for key, value in map.items():
207+
setattr(s, key, None) # Calls deleter
208+
assert getattr(s, key) is None # Public attribute must be None
209+
assert not s._is_defined("_" + key) # Private attribute must be unset
210+
setattr(s, key, backup[i][key]) # Reset
211+
210212
# Test correct reset
211-
for key, value in s.input_settings.items():
212-
assert getattr(s, key) == value
213+
for map in s.input_settings:
214+
for key, value in map.items():
215+
assert getattr(s, key) == value

tests/test_VipSession.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,14 @@ def test_properties_interface(mocker):
189189
# Backup the inputs
190190
backup = s.input_settings
191191
# Run a subtest for each property
192-
for prop in s.input_settings:
193-
setattr(s, prop, None) # Calls deleter
194-
assert getattr(s, prop) is None # Public attribute must be None
195-
assert not s._is_defined("_" + prop) # Private attribute must be unset
196-
setattr(s, prop, backup[prop]) # Reset
192+
for i, map in enumerate(s.input_settings):
193+
for key, value in map.items():
194+
setattr(s, key, None) # Calls deleter
195+
assert getattr(s, key) is None # Public attribute must be None
196+
assert not s._is_defined("_" + key) # Private attribute must be unset
197+
setattr(s, key, backup[i][key]) # Reset
198+
197199
# Test correct reset
198-
for key, value in s.input_settings.items():
199-
assert getattr(s, key) == value
200+
for map in s.input_settings:
201+
for key, value in map.items():
202+
assert getattr(s, key) == value

0 commit comments

Comments
 (0)