Exemple #1
0
def test_init():
    packet = PositionPacket()
    point = Point(51, -114, 1000)

    packet.point = point
    packet.power = 50
    packet.height = 50
    packet.gain = 3
    packet.directivity = 90
    packet.radio_range = 10
    packet.strength = 9
    packet.bearing = 180
    packet.number = 12.5
    packet.df_range = 20
    packet.quality = 1

    assert packet.point == point
    assert packet.power == 50
    assert packet.height == 50
    assert packet.gain == 3
    assert packet.directivity == 90
    assert packet.radio_range == 10
    assert packet.strength == 9
    assert packet.bearing == 180
    assert packet.number == 12.5
    assert packet.df_range == 20
    assert packet.quality == 1
Exemple #2
0
def generated_packet() -> PositionPacket:
    p = PositionPacket()

    p.source = "XX1XX"
    p.destination = "APRS"
    p.path = "TCPIP"

    p.symbol_table = "/"
    p.symbol_id = "k"

    p.latitude = 51.5
    p.longitude = -100

    p.comment = "Test comment"

    return p
Exemple #3
0
def test_generate(latitude, longitude, timestamp, timestamp_type, messaging, expected_output):
    p = PositionPacket()

    p.source = "XX1XX"
    p.destination = "APRS"
    p.path = "TCPIP"

    p.symbol_table = "/"
    p.symbol_id = "k"

    p.latitude = latitude
    p.longitude = longitude

    p.timestamp = timestamp
    p.timestamp_type = timestamp_type

    p.messaging = messaging

    output = p.generate()

    assert output == expected_output
Exemple #4
0
def test_invalid_compressed_type():
    p = PositionPacket()

    with pytest.raises(TypeError):
        p.compressed = None
Exemple #5
0
def test_invalid_messaging_type():
    p = PositionPacket()

    with pytest.raises(TypeError):
        p.messaging = None
Exemple #6
0
def test_empty():
    packet = PositionPacket()

    assert str(packet) == "<PositionPacket>"