Exemple #1
0
def test_download():
    directory = mkdtemp()
    try:
        result = query(datetime(2011, 9, 22, 5), datetime(2011, 9, 22, 6), set([("BIR", 1)]))
        RESULTS = ["BIR_20110922_050000_01.fit.gz", "BIR_20110922_051500_01.fit.gz", "BIR_20110922_053000_01.fit.gz"]
        download(result, directory)
        assert sorted(os.listdir(directory)) == RESULTS
    finally:
        shutil.rmtree(directory)
Exemple #2
0
def test_query_number():
    URL = "http://soleil.i4ds.ch/solarradio/data/2002-20yy_Callisto/2011/09/22/"

    result = list(query(datetime(2011, 9, 22, 5), datetime(2011, 9, 22, 6), set([("BIR", 1)])))
    RESULTS = ["BIR_20110922_050000_01.fit.gz", "BIR_20110922_051500_01.fit.gz", "BIR_20110922_053000_01.fit.gz"]

    RESULTS.sort()
    # Should be sorted anyway, but better to assume as little as possible.
    result.sort()

    assert len(result) == len(RESULTS)
Exemple #3
0
def test_download():
    directory = mkdtemp()
    try:
        result = query(datetime(2011, 9, 22, 5), datetime(2011, 9, 22, 6),
                       set([("BIR", 1)]))
        RESULTS = [
            "BIR_20110922_050000_01.fit.gz",
            "BIR_20110922_051500_01.fit.gz",
            "BIR_20110922_053000_01.fit.gz",
        ]
        download(result, directory)
        assert sorted(os.listdir(directory)) == RESULTS
    finally:
        shutil.rmtree(directory)
Exemple #4
0
def test_query_number():
    URL = "http://soleil.i4ds.ch/solarradio/data/2002-20yy_Callisto/2011/09/22/"

    result = list(query(datetime(2011, 9, 22, 5), datetime(2011, 9, 22, 6), set([("BIR", 1)])))
    RESULTS = [
        "BIR_20110922_050000_01.fit.gz",
        "BIR_20110922_051500_01.fit.gz",
        "BIR_20110922_053000_01.fit.gz",
        "BIR_20110922_060000_01.fit.gz",
    ]

    RESULTS.sort()

    assert result == [URL + res for res in RESULTS]
Exemple #5
0
def test_query_number():
    URL = 'http://soleil.i4ds.ch/solarradio/data/2002-20yy_Callisto/2011/09/22/'

    result = list(
        query(datetime(2011, 9, 22, 5), datetime(2011, 9, 22, 6),
              set([("BIR", 1)])))
    RESULTS = [
        "BIR_20110922_050000_01.fit.gz",
        "BIR_20110922_051500_01.fit.gz",
        "BIR_20110922_053000_01.fit.gz",
    ]

    RESULTS.sort()
    # Should be sorted anyway, but better to assume as little as possible.
    result.sort()

    assert result == [URL + res for res in RESULTS]
Exemple #6
0
def test_query():
    URL = "http://soleil.i4ds.ch/solarradio/data/2002-20yy_Callisto/2011/09/22/"

    result = list(query(datetime(2011, 9, 22, 5), datetime(2011, 9, 22, 6), set(["BIR"])))
    RESULTS = [
        "BIR_20110922_050000_01.fit.gz",
        "BIR_20110922_051500_01.fit.gz",
        "BIR_20110922_053000_01.fit.gz",
        "BIR_20110922_050000_03.fit.gz",
        "BIR_20110922_051500_03.fit.gz",
        "BIR_20110922_053000_03.fit.gz",
        "BIR_20110922_054500_03.fit.gz",
    ]

    RESULTS.sort()
    # Should be sorted anyway, but better to assume as little as possible.
    result.sort()
    for item in RESULTS:
        assert URL + item in result