Ejemplo n.º 1
0
def test_QueryResponse_build_table_defaults():
    records = (MockQRRecord(), )

    qr = vso.QueryResponse(records)
    table = qr.build_table()

    start_time_ = table['Start Time']
    assert len(start_time_) == 1
    assert start_time_[0] == 'None'

    end_time_ = table['End Time']
    assert len(end_time_) == 1
    assert end_time_[0] == 'None'

    type_ = table['Type'].data
    assert len(type_) == 1
    assert type_[0] == 'N/A'

    # Check values we did set by default in 'MockQRRecord'
    source_ = table['Source'].data
    assert len(source_) == 1
    assert source_[0] == str(va.Source('SOHO'))

    instrument_ = table['Instrument'].data
    assert len(instrument_) == 1
    assert instrument_[0] == str(va.Instrument('aia'))
Ejemplo n.º 2
0
def test_QueryResponse_build_table_with_extent_type(mock_build_client):
    """
    When explicitly suppling an 'Extent' only the 'type' is stored
    in the built table.
    """
    e_type = va.Extent(x=1.0, y=2.5, width=37, length=129.2, atype='CORONA')
    qr = vso.QueryResponse((MockQRRecord(extent_type=e_type),))
    table = qr.build_table()
    extent = table['Extent Type'].data
    assert len(extent) == 1
    assert extent[0] == e_type.type
Ejemplo n.º 3
0
def test_QueryResponse_build_table_with_no_end_time(mock_build_client):
    """
    Only the 'start' time is set, no 'end' time
    """
    a_st = parse_time((2016, 2, 14, 8, 8, 12))

    records = (MockQRRecord(start_time=a_st.strftime(va._TIMEFORMAT)),)

    qr = vso.QueryResponse(records)
    table = qr.build_table()
    start_time_ = table['Start Time']
    assert len(start_time_) == 1
    assert start_time_[0].value == '2016-02-14 08:08:12.000'
Ejemplo n.º 4
0
def test_QueryResponse_build_table_with_no_start_time(mock_build_client):
    """
    Only the 'end' time set, no 'start' time
    """
    a_st = parse_time((2016, 2, 14, 8, 8, 12))

    records = (MockQRRecord(end_time=a_st.strftime(va._TIMEFORMAT)),)

    qr = vso.QueryResponse(records)
    table = qr.build_table()

    # 'End Time' is valid, there is no 'Start Time' in the table
    assert 'Start Time' not in table.columns
    end_time_ = table['End Time']
    assert len(end_time_) == 1
    assert end_time_[0].value == '2016-02-14 08:08:12.000'
Ejemplo n.º 5
0
def test_QueryResponse_build_table_with_no_end_time():
    """
    Only the 'start' time is set, no 'end' time
    """
    a_st = datetime.datetime(2016, 2, 14, 8, 8, 12)

    records = (MockQRRecord(start_time=a_st.strftime(va.TIMEFORMAT)), )

    qr = vso.QueryResponse(records)
    table = qr.build_table()

    start_time_ = table['Start Time']
    assert len(start_time_) == 1
    assert start_time_[0] == '2016-02-14 08:08:12'

    end_time_ = table['End Time']
    assert len(end_time_) == 1
    assert end_time_[0] == 'None'
Ejemplo n.º 6
0
def test_QueryResponse_build_table_defaults(mock_build_client):
    records = (MockQRRecord(),)

    qr = vso.QueryResponse(records)
    table = qr.build_table()

    # These are the only None values in the table.
    source_ = table['Source'].data
    assert len(source_) == 1
    assert source_[0].value == 'SOHO'

    instrument_ = table['Instrument'].data
    assert len(instrument_) == 1
    assert instrument_[0].value == 'aia'

    size_ = table['Size'].data
    assert len(size_) == 1
    assert size_[0] == 0.0
Ejemplo n.º 7
0
def test_QueryResponse_build_table_with_no_start_time():
    """
    Only the 'end' time set, no 'start' time
    """
    a_st = parse_time((2016, 2, 14, 8, 8, 12))

    records = (MockQRRecord(end_time=a_st.strftime(va.TIMEFORMAT)), )

    qr = vso.QueryResponse(records)
    table = qr.build_table()

    start_time_ = table['Start Time']
    assert len(start_time_) == 1
    assert start_time_[0] == 'None'

    # Even though 'End Time' is valid, there is no 'Start Time'
    # marks as 'N/A'
    end_time_ = table['End Time']
    assert len(end_time_) == 1
    assert end_time_[0] == 'N/A'