コード例 #1
0
ファイル: test_packet.py プロジェクト: nhz2/czml3
def test_packet_custom_properties():
    expected_result = """{
    "id": "id_00",
    "properties": {
        "a": false,
        "b": 1,
        "c": "C",
        "ellipsoid": {
            "radii": {
                "cartesian": [
                    6378137,
                    6378137,
                    6356752.31414
                ]
            }
        }
    }
}"""
    prop_dict = {
        "a": False,
        "b": 1,
        "c": "C",
        "ellipsoid": Ellipsoid(
            radii=EllipsoidRadii(
                cartesian=Cartesian3Value(values=[6378137, 6378137, 6356752.314140])
            )
        ),
    }

    packet = Packet(id="id_00", properties=prop_dict)

    assert repr(packet) == expected_result
コード例 #2
0
ファイル: test_properties.py プロジェクト: nhz2/czml3
def test_position_with_delete_has_nothing_else():
    expected_result = """{
    "delete": true
}"""
    pos_list = Position(delete=True, cartesian=[1, 2, 3])
    pos_val = Position(delete=True, cartesian=Cartesian3Value(values=[1, 2, 3]))

    assert repr(pos_list) == repr(pos_val) == expected_result
コード例 #3
0
ファイル: test_properties.py プロジェクト: comxtohr/czml3
def test_eyeOffset():
    expected_result = """{
    "cartesian": [
        1,
        2,
        3
    ]
}"""

    eyeOffset = EyeOffset(cartesian=Cartesian3Value(values=[1, 2, 3]))
    assert repr(eyeOffset) == expected_result
コード例 #4
0
def test_viewfrom_cartesian():
    expected_result = """{
    "cartesian": [
        -1000,
        0,
        300
    ]
}"""
    v = ViewFrom(cartesian=Cartesian3Value(values=[-1000, 0, 300]))

    assert repr(v) == expected_result
コード例 #5
0
ファイル: test_properties.py プロジェクト: comxtohr/czml3
def test_box():
    expected_result = """{
    "show": true,
    "dimensions": {
        "cartesian": [
            5,
            6,
            3
        ]
    }
}"""

    box = Box(
        show=True,
        dimensions=BoxDimensions(cartesian=Cartesian3Value(values=[5, 6, 3])))
    assert repr(box) == expected_result
コード例 #6
0
ファイル: test_types.py プロジェクト: talos-gis/czml3
def test_bad_cartesian_raises_error(values):
    with pytest.raises(ValueError) as excinfo:
        Cartesian3Value(values=values)

    assert "Input values must have either 3 or N * 4 values" in excinfo.exconly(
    )