def test_conversion_works(self): assert cmd_utils.str_to_python_type("none") is None assert cmd_utils.str_to_python_type("True") is True assert cmd_utils.str_to_python_type("42") == 42. assert cmd_utils.str_to_python_type("Geronimo!") == "Geronimo!"
def test_throws_error_if_input_is_not_string(self): assert cmd_utils.str_to_python_type(True) is True assert cmd_utils.str_to_python_type(None) is None assert cmd_utils.str_to_python_type(42) is 42
def __setitem__(self, key, val): if key not in self.cmds: warnings.warn("{} not in self.keys. Ignoring.".format(key)) return None self.cmds[key] = cutils.str_to_python_type(val)