Exemplo n.º 1
0
def test101_should_get_args_converter_works_with_enum():
    from schema_sugar.client.parser import _get_arg_converter as gac
    assert gac({"type": "string", "enum": [1]}) is unicode
    assert gac({"type": "integer", "enum": [1]}) is int
    assert gac({"enum": [1]}) is int
    assert gac({"enum": ["he"]}) is str
    assert gac({"enum": [u"he"]}) is unicode
Exemplo n.º 2
0
def test100_should_get_args_converter_works():
    import json

    from schema_sugar.client.parser import _get_arg_converter as gac
    from schema_sugar.client.arg_conv import conv2bool

    def mk_desc(type):
        return {
            "type": type,
        }

    assert gac(mk_desc("string")) is unicode
    assert gac(mk_desc("integer")) is int
    assert gac(mk_desc("number")) is float
    assert gac(mk_desc("boolean")) is conv2bool
    assert gac(mk_desc("object")) is json.loads