def test__parse_header():
    """iaga2002_test.IAGA2002Parser_test.test_parse_header()

    Call the _parse_header method with a header.
    Verify the header name and value are split at the correct column.
    """
    parser = IAGA2002Parser()
    parser._parse_header(' Format                 ' +
                         'IAGA-2002                                    |')
    assert_equals(parser.headers['Format'], 'IAGA-2002')
def test_parse_decbas():
    """iaga2002_test.IAGA2002Parser_test.test_parse_decbas()

    Call the parse method with a portion of an IAGA 2002 File,
    which contains a DECBAS header comment.
    Verify DECBAS appears in the headers dict, with the expected value.
    """
    parser = IAGA2002Parser()
    parser.parse(IAGA2002_EXAMPLE)
    assert_equals(parser.metadata['declination_base'], 5527)
def test__merge_comments():
    """iaga2002_test.IAGA2002Parser_test.test_merge_comments()

    Call the _merge_comments method with 3 lines,
    only the middle line ending in a period.
    Verify, the first and second line are merged.
    """
    comments = ['line 1', 'line 2.', 'line 3']
    assert_equals(IAGA2002Parser()._merge_comments(comments),
                  ['line 1 line 2.', 'line 3'])
Beispiel #4
0
def test__parse_header():
    """iaga2002_test.IAGA2002Parser_test.test_parse_header()

    Call the _parse_header method with a header.
    Verify the header name and value are split at the correct column.
    """
    parser = IAGA2002Parser()
    parser._parse_header(" Format                 " +
                         "IAGA-2002                                    |")
    assert_equal(parser.headers["Format"], "IAGA-2002")
def test__parse_comment():
    """iaga2002_test.IAGA2002Parser_test.test_parse_header()

    Call the _parse_comment method with a comment.
    Verify the comment delimiters are removed.
    """
    parser = IAGA2002Parser()
    parser._parse_comment(' # Go to www.intermagnet.org for details on' +
                          ' obtaining this product.  |')
    assert_equals(
        parser.comments[-1], 'Go to www.intermagnet.org for details on' +
        ' obtaining this product.')
def test__parse_channels():
    """iaga2002_test.IAGA2002Parser_test.test_parse_channels()

    Call the _parse_header method with an IAGA CODE header, then call
    the _parse_channels method with a channels header line.
    Verify the IAGA CODE value is removed from parsed channel names.
    """
    parser = IAGA2002Parser()
    parser._parse_header(' IAGA CODE              ' +
                         'BDT                                          |')
    parser._parse_channels('DATE       TIME         DOY     ' +
                           'BDTH      BDTD      BDTZ      BDTF   |')
    assert_equals(parser.channels, ['H', 'D', 'Z', 'F'])
Beispiel #7
0
def test__parse_channels():
    """iaga2002_test.IAGA2002Parser_test.test_parse_channels()

    Call the _parse_header method with an IAGA CODE header, then call
    the _parse_channels method with a channels header line.
    Verify the IAGA CODE value is removed from parsed channel names.
    """
    parser = IAGA2002Parser()
    parser._parse_header(" IAGA CODE              " +
                         "BDT                                          |")
    parser._parse_channels("DATE       TIME         DOY     " +
                           "BDTH      BDTD      BDTZ      BDTF   |")
    assert_equal(parser.channels, ["H", "D", "Z", "F"])