Exemplo n.º 1
0
def test_as_dict():
    time = time_interval("2085-01-01T12:00:00Z/2120-12-30T12:00:00Z")
    parameter = TimeParameter(time)
    assert parameter.asdict() == {
        "start_time": "2085-01-01T12:00:00",
        "end_time": "2120-12-30T12:00:00",
    }
Exemplo n.º 2
0
def test_time_series_input():
    value = [
        "2085-01-01T12:00:00Z", "2095-03-03T03:03:03", "2120-12-30T12:00:00Z"
    ]
    expected_value = [i.replace("Z", "") for i in value]
    vstring = ",".join([str(i) for i in value])

    for tm in (vstring, value, tuple(value)):

        times = time_series(tm)
        parameter = TimeParameter(times)
        assert parameter.type == "series"
        assert parameter.value == expected_value
        assert parameter.asdict() == {"time_values": expected_value}

    times = time_series("2085-01-01T12:00:00Z", "2095-03-03T03:03:03",
                        "2120-12-30T12:00:00Z")
    parameter = TimeParameter(times)
    assert parameter.type == "series"
    assert parameter.value == expected_value
    assert parameter.asdict() == {"time_values": expected_value}
Exemplo n.º 3
0
def test_slash_none():
    time = "/"
    parameter = TimeParameter(time)
    assert parameter.tuple == (None, None)
    assert parameter.asdict() == {"start_time": None, "end_time": None}
Exemplo n.º 4
0
def test_as_dict():
    time = "2085-01-01T12:00:00Z/2120-12-30T12:00:00Z"
    parameter = TimeParameter(time)
    assert parameter.asdict() == {"start_time": "2085", "end_time": "2120"}
Exemplo n.º 5
0
def test_slash_none():
    time = time_interval("/")
    parameter = TimeParameter(time)
    assert parameter.value is None
    assert parameter.asdict() == {"start_time": None, "end_time": None}