def testParseBool(self): """ see ticket:7003 """ params = JobParams() params.inputs = {"a": Bool("a", default=True)} rv = parse_inputs(["a=False"], params) assert False == rv["a"].val rv = parse_inputs(["a=false"], params) assert False == rv["a"].val rv = parse_inputs(["a=0"], params) assert False == rv["a"].val rv = parse_inputs(["a="], params) assert False == rv["a"].val rv = parse_inputs(["a=True"], params) assert True == rv["a"].val rv = parse_inputs(["a=true"], params) assert True == rv["a"].val rv = parse_inputs(["a=1"], params) assert True == rv["a"].val rv = parse_inputs(["a=xxxanytextxxx"], params) assert True == rv["a"].val
def testParseInputsSimple(self): params = JobParams() params.inputs = {"a": Long("a", optional=False)} rv = parse_inputs(["a=1"], params) assert isinstance(rv["a"], omero.RLong) assert 1 == rv["a"].val try: parse_inputs(["b=1"], params) except MissingInputs, mi: assert ["a"] == mi.keys
def testParseInputsLongList(self): params = JobParams() params.inputs = {"a": List("a", optional=False).ofType(rlong(0))} # List of one rv = parse_inputs(["a=1"], params) assert isinstance(rv["a"], omero.RList) assert 1 == rv["a"].val[0].val # List of two rv = parse_inputs(["a=1,2"], params) assert isinstance(rv["a"], omero.RList) assert 1 == rv["a"].val[0].val assert 2 == rv["a"].val[1].val
def testParseIntSet(self): """ see ticket:7003 """ params = JobParams() a = Set("Channels").ofType(rint(0)) params.inputs = {"a": a} rv = parse_inputs(["a=1,2"], params)["a"].val for x in rv: assert isinstance(x, omero.RInt) assert 1 == rv[0].val assert 2 == rv[1].val
def testParseIntList(self): """ see ticket:7003 """ params = JobParams() a = List("Channels").ofType(rint(0)) params.inputs = {"a": a} rv = parse_inputs(["a=1,2"], params)["a"].val for x in rv: assert isinstance(x, omero.RInt) assert 1 == rv[0].val assert 2 == rv[1].val
def testParseInputsStringListIsDefault(self): params = JobParams() params.inputs = {"a": List("a", optional=False)} rv = parse_inputs(["a=1"], params) assert isinstance(rv["a"], omero.RList) assert "1" == rv["a"].val[0].val