コード例 #1
0
def test_record():
    data = {"ist_nodes": [{
        "id": "b9614d55a6c3462e",
        "input_type": "Record",
        "name": "Region",
        "full_name": "Region",
        "keys": [
            {
                "key": "name",
                "default": {
                    "type": "obligatory",
                    "value": "OBLIGATORY"
                },
                "type": "b9614d55a6c3462e"
            }
        ]
    }]}
    root_format = parse_format(data)

    assert root_format['id'] == "b9614d55a6c3462e"
    assert root_format['base_type'] == "Record"
    assert root_format['name'] == "Region"
    assert root_format['full_name'] == "Region"
    assert root_format['keys']['name']['default']['type'] == 'obligatory'
    assert root_format['keys']['name']['default']['value'] == 'OBLIGATORY'
    assert root_format['keys']['name']['type'] == root_format
コード例 #2
0
def test_string():
    data = {"ist_nodes": [{
        "id": "29b5533100b6f60f",
        "input_type": "String"
    }]}
    root_format = parse_format(data)

    assert root_format['id'] == "29b5533100b6f60f"
    assert root_format['base_type'] == "String"
コード例 #3
0
def test_bool():
    data = {"ist_nodes": [{
        "id": "282546d52edd4",
        "input_type": "Bool"
    }]}
    root_format = parse_format(data)

    assert root_format['id'] == "282546d52edd4"
    assert root_format['base_type'] == "Bool"
コード例 #4
0
def test_filename():
    data = {"ist_nodes": [{
        "id": "89a808b8e9515bf8",
        "input_type": "FileName",
        "file_mode": "input"
    }]}
    root_format = parse_format(data)

    assert root_format['id'] == "89a808b8e9515bf8"
    assert root_format['base_type'] == "FileName"
    assert root_format['file_mode'] == "input"
コード例 #5
0
def test_root():
    data = {"ist_nodes":[
        {
            "id": "cde734cca8c6d536",
            "input_type": "Bool",
        },
        {
            "id": "282546d52edd4",
            "input_type": "Bool"
        }
    ]}
    root_format = parse_format(data)

    assert root_format['id'] == 'cde734cca8c6d536'
コード例 #6
0
def test_double():
    data = {"ist_nodes": [{
        "id": "6b1c4ede475775aa",
        "input_type": "Double",
        "range": [
            0,
            1.79769E+308
        ]
    }]}
    root_format = parse_format(data)

    assert root_format['id'] == "6b1c4ede475775aa"
    assert root_format['base_type'] == "Double"
    assert root_format['min'] == 0
    assert root_format['max'] == 1.79769e+308
コード例 #7
0
def test_integer():
    data = {"ist_nodes":[{
        "id": "151ce92dd201d44b",
        "input_type": "Integer",
        "range": [
            0,
            3
        ]
    }]}
    root_format = parse_format(data)

    assert root_format['id'] == "151ce92dd201d44b"
    assert root_format['base_type'] == "Integer"
    assert root_format['min'] == 0
    assert root_format['max'] == 3
コード例 #8
0
def test_optional_params():
    data = {"ist_nodes":[{
        "id": "151ce92dd201d44b",
        "input_type": "",
        "name": "Integer",
        "full_name": "Integer",
        "description": "description"
    }]}
    root_format = parse_format(data)

    assert root_format['id'] == "151ce92dd201d44b"
    assert root_format['base_type'] == ""
    assert root_format['name'] == "Integer"
    assert root_format['full_name'] == "Integer"
    assert root_format['description'] == "description"
コード例 #9
0
def test_abstract_record():
    data = {"ist_nodes": [{
        "id": "89b3f44e8ecaec1b",
        "input_type": "Abstract",
        "default_descendant": "59d2b27373f5effe",
        "implementations": [
            "59d2b27373f5effe"
        ]
    }, {
        "id": "59d2b27373f5effe",
        "input_type": "Record",
        "name": "Descendant",
        "keys": []
    }]}
    root_format = parse_format(data)

    assert root_format['id'] == "89b3f44e8ecaec1b"
    assert root_format['base_type'] == "Abstract"
    assert root_format['default_descendant']['base_type'] == 'Record'
    assert "Descendant" in root_format['implementations']
コード例 #10
0
def test_array():
    data = {"ist_nodes": [{
        "id": "eee3033466b9ffa2",
        "input_type": "Array",
        "range": [
            0,
            4294967295
        ],
        "subtype": "6b1c4ede475775aa"
    }, {
        "id": "6b1c4ede475775aa",
        "input_type": "String"
    }]}
    root_format = parse_format(data)

    assert root_format['id'] == "eee3033466b9ffa2"
    assert root_format['base_type'] == "Array"
    assert root_format['min'] == 0
    assert root_format['max'] == 4294967295
    assert root_format['subtype']['base_type'] == "String"
コード例 #11
0
def test_selection():
    data = {"ist_nodes": [{
        "id": "f9756fb2f66076a1",
        "input_type": "Selection",
        "values": [
            {
                "name": "PETSc",
                "description": "PETSc description"
            },
            {
                "name": "METIS",
                "description": "METIS description"
            }
        ]
    }]}
    root_format = parse_format(data)

    assert root_format['id'] == "f9756fb2f66076a1"
    assert root_format['base_type'] == "Selection"
    assert root_format['values']['PETSc']['description'] == "PETSc description"
    assert root_format['values']['METIS']['description'] == "METIS description"