fix profile logic for configfile generation

some follow up fixes to

https://github.com/galaxyproject/galaxy/pull/9279/files
https://github.com/galaxyproject/galaxy/pull/9776/files

- wrong profile for the profile test tool (it used 20.01, but should
have used 20.05)
- the non-profile test tool used wrong assumptions. now fixed
  and also tested against 19.09
- in the profile version `value_wrapper.value` needs to be casted
  for `multiple==False` otherwise we gat `"None"` (which I do not
  understand 100%)
This commit is contained in:
Matthias Bernt
2021-02-18 12:33:07 +01:00
parent e2076fbb9d
commit bd5e8f326c
3 changed files with 13 additions and 10 deletions
+6 -3
View File
@@ -94,10 +94,13 @@ def _json_wrap_input(input, value_wrapper, profile, handle_files="skip"):
elif input_type == "boolean":
json_value = _cast_if_not_none(value_wrapper, bool)
elif input_type == "select":
if input.multiple and packaging.version.parse(str(profile)) >= packaging.version.parse('20.05'):
json_value = [_ for _ in _cast_if_not_none(value_wrapper.value, list)]
if packaging.version.parse(str(profile)) < packaging.version.parse('20.05'):
json_value = _cast_if_not_none(value_wrapper, str)
else:
json_value = _cast_if_not_none(value_wrapper.value, str)
if input.multiple:
json_value = [str(_) for _ in _cast_if_not_none(value_wrapper.value, list)]
else:
json_value = _cast_if_not_none(value_wrapper.value, str)
elif input_type == "data_column":
# value is a SelectToolParameterWrapper()
if input.multiple:
+3 -3
View File
@@ -27,8 +27,8 @@ if test_case == "1":
assert_equals(as_dict["inttest"], 12456)
assert_equals(as_dict["floattest"], 6.789)
assert_equals(as_dict["radio_select"], "a_radio")
assert_equals(as_dict["optional_select"], None)
assert_equals(as_dict["optional_multiple_select"], [])
assert_equals(as_dict["optional_select"], "None")
assert_equals(as_dict["optional_multiple_select"], "None")
assert_equals(as_dict["repeat"][0]["r"], "000000")
assert_equals(as_dict["repeat"][1]["r"], "FFFFFF")
assert_equals(as_dict["cond"]["more_text"], "fdefault")
@@ -43,7 +43,7 @@ elif test_case == "2":
assert_equals(as_dict["floattest"], 1.0)
assert_equals(as_dict["radio_select"], "a_radio")
assert_equals(as_dict["optional_select"], "a")
assert_equals(as_dict["optional_multiple_select"], ['a', 'b'])
assert_equals(as_dict["optional_multiple_select"], 'a,b')
assert_equals(as_dict["repeat"][0]["r"], "000000")
assert_equals(as_dict["cond"]["cond_test"], "second")
assert_equals(as_dict["cond"]["more_text"], "sdefault")
@@ -1,7 +1,7 @@
<!-- test if profile version of inputs json generation works, i.e.
- multiple selects get comma separated string (lists >= 20.05)
- empty optional selects get "None" ([] >= 20.05) -->
<tool id="inputs_as_json" name="inputs_as_json" profile="20.01" version="1.0.0">
<tool id="inputs_as_json_profile" name="inputs_as_json_profile" profile="20.05" version="1.0.0">
<command detect_errors="exit_code"><![CDATA[
cat inputs.json &&
python $check_inputs inputs.json $test_case
@@ -30,8 +30,8 @@ if test_case == "1":
assert_equals(as_dict["inttest"], 12456)
assert_equals(as_dict["floattest"], 6.789)
assert_equals(as_dict["radio_select"], "a_radio")
assert_equals(as_dict["optional_select"], "None")
assert_equals(as_dict["optional_multiple_select"], "None")
assert_equals(as_dict["optional_select"], None)
assert_equals(as_dict["optional_multiple_select"], [])
assert_equals(as_dict["repeat"][0]["r"], "000000")
assert_equals(as_dict["repeat"][1]["r"], "FFFFFF")
assert_equals(as_dict["cond"]["more_text"], "fdefault")
@@ -46,7 +46,7 @@ elif test_case == "2":
assert_equals(as_dict["floattest"], 1.0)
assert_equals(as_dict["radio_select"], "a_radio")
assert_equals(as_dict["optional_select"], "a")
assert_equals(as_dict["optional_multiple_select"], 'a,b')
assert_equals(as_dict["optional_multiple_select"], ['a', 'b'])
assert_equals(as_dict["repeat"][0]["r"], "000000")
assert_equals(as_dict["cond"]["cond_test"], "second")
assert_equals(as_dict["cond"]["more_text"], "sdefault")