Exemplo n.º 1
0
def test_stellarium_star_names():
    f = BytesIO(star_text)
    star_names = stellarium.parse_star_names(f)
    assert star_names[0].hip == 677
    assert star_names[0].name == 'Alpheratz'
    assert star_names[4].hip == 9640
    assert star_names[4].name == 'Almaak'
Exemplo n.º 2
0
def test_extra_lines_in_tle_are_ignored():
    f = BytesIO(b'Sample line\n' + sample_celestrak_text + b'Another line\n')
    s = list(parse_tle(f))
    assert len(s) == 2
    assert s[0][0] == ['ISS (ZARYA)', 'ISS', 'ZARYA']
    assert s[0][1].name == 'ISS (ZARYA)'
    assert s[1][0] == ['FLOCK 2E-1']
    assert s[1][1].name == 'FLOCK 2E-1'
Exemplo n.º 3
0
def test_hipparcos():
    b = BytesIO()
    g = gzip.GzipFile(mode='wb', fileobj=b)
    g.write(sample_hipparcos_line)
    g.close()
    b.seek(0)
    try:
        df = load_dataframe(b)
    except ImportError:
        # raise SkipTest('pandas not available')
        # Assay doesn't understand skipping tests yet; just pass
        # for now if Pandas cannot be imported.
        return
    assert len(df) == 1
    row = df.iloc[0]
    assert abs(row.ra_degrees - 000.00091185) < 1e-30
    assert abs(row.dec_degrees - +01.08901332) < 1e-30
def test_hipparcos():
    b = BytesIO()
    g = gzip.GzipFile(mode='wb', fileobj=b)
    g.write(sample_hipparcos_line)
    g.close()
    b.seek(0)
    try:
        df = load_dataframe(b)
    except ImportError:
        # raise SkipTest('pandas not available')
        # Assay doesn't understand skipping tests yet; just pass
        # for now if Pandas cannot be imported.
        return
    assert len(df) == 1
    row = df.iloc[0]
    assert abs(row.ra_degrees - 000.00091185) < 1e-30
    assert abs(row.dec_degrees - +01.08901332) < 1e-30
Exemplo n.º 5
0
def test_spacetrack_three_line():
    f = BytesIO(sample_spacetrack_three_line_text)
    s = list(parse_tle(f))
    assert len(s) == 2
    print(s)
    assert s[0][0] == ['First']
    assert s[0][1].name == 'First'
    assert s[1][0] == ['Second']
    assert s[1][1].name == 'Second'
Exemplo n.º 6
0
def test_spacetrack_two_line():
    f = BytesIO(sample_spacetrack_two_line_text)
    s = list(parse_tle(f))
    assert len(s) == 2
    print(s)
    assert s[0][0] == ()
    assert s[0][1].name is None
    assert s[1][0] == ()
    assert s[1][1].name is None
Exemplo n.º 7
0
def test_celestrak():
    f = BytesIO(sample_celestrak_text)
    s = list(parse_tle(f))
    print(s)
    assert len(s) == 2
    assert s[0][0] == ['ISS (ZARYA)', 'ISS', 'ZARYA']
    assert s[0][1].name == 'ISS (ZARYA)'
    assert s[1][0] == ['FLOCK 2E-1']
    assert s[1][1].name == 'FLOCK 2E-1'
Exemplo n.º 8
0
def test_hipparcos():
    try:
        df = load_dataframe(BytesIO(gzip.compress(sample_hipparcos_line)))
    except ImportError:
        raise SkipTest('pandas not available')
    assert len(df) == 1
    row = df.iloc[0]
    assert abs(row.ra_degrees - 000.00091185) < 1e-30
    assert abs(row.ra_hours == 000.00091185 / 15.0) < 1e-30