Esempio n. 1
0
 def from_info(info, handler):
     api = ClientAPI(info["name"], info["description"], [], handler)
     api.args = [ArgParameter.from_info(x) for x in info.get("args", [])]
     api.kwargs = [
         KeywordParameter.from_info(x)
         for x in info.get("kwargs", {}).values()
     ]
     return api
Esempio n. 2
0
    def test_arg_from_bad_info(self):
        with pytest.raises(ValueError):
            KeywordParameter.from_info({})

        with pytest.raises(ValueError):
            ArgParameter.from_info({})
Esempio n. 3
0
 def test_arg_parameter_from_info(self):
     obj = {"name": "a", "description": "b", "type": "text"}
     assert ArgParameter.from_info(obj).info == obj