()
| 9 | |
| 10 | |
| 11 | def test_osargument_value_as_json(): |
| 12 | boolArgument = openstudio.measure.OSArgument.makeBoolArgument("bool") |
| 13 | valNotAssigned = boolArgument.valueAsJSON() |
| 14 | assert valNotAssigned is None |
| 15 | boolArgument.setValue(True) |
| 16 | val = boolArgument.valueAsJSON() |
| 17 | assert isinstance(val, bool) |
| 18 | assert val |
| 19 | |
| 20 | doubleArgument = openstudio.measure.OSArgument.makeDoubleArgument("double") |
| 21 | valNotAssigned = doubleArgument.valueAsJSON() |
| 22 | assert valNotAssigned is None |
| 23 | doubleArgument.setValue(10.0) |
| 24 | val = doubleArgument.valueAsJSON() |
| 25 | assert isinstance(val, float) |
| 26 | assert val == 10.0 |
| 27 | |
| 28 | integerArgument = openstudio.measure.OSArgument.makeIntegerArgument("integer") |
| 29 | valNotAssigned = integerArgument.valueAsJSON() |
| 30 | assert valNotAssigned is None |
| 31 | integerArgument.setValue(10) |
| 32 | val = integerArgument.valueAsJSON() |
| 33 | assert isinstance(val, int) |
| 34 | assert val == 10 |
| 35 | |
| 36 | stringArgument = openstudio.measure.OSArgument.makeStringArgument("string") |
| 37 | valNotAssigned = stringArgument.valueAsJSON() |
| 38 | assert valNotAssigned is None |
| 39 | stringArgument.setValue("hello") |
| 40 | val = stringArgument.valueAsJSON() |
| 41 | assert isinstance(val, str) |
| 42 | assert val == "hello" |
| 43 | |
| 44 | choices_to_display_values_map = { |
| 45 | "handle1": "choice1", |
| 46 | "handle2": "choice2", |
| 47 | } |
| 48 | choiceArgument = openstudio.measure.OSArgument.makeChoiceArgument("choice", choices_to_display_values_map) |
| 49 | valNotAssigned = choiceArgument.valueAsJSON() |
| 50 | assert valNotAssigned is None |
| 51 | choiceArgument.setValue("handle1") |
| 52 | val = choiceArgument.valueAsJSON() |
| 53 | assert isinstance(val, str) |
| 54 | assert val == "handle1" |
| 55 | |
| 56 | |
| 57 | def test_swig_json_special_chars(): |
nothing calls this directly
no test coverage detected