Exemplo n.º 1
0
def test_radio_init_default():
    """
    Ensure a Radio object is initialised in the expected way:

    * It has a BLERadio instance.
    * The self.uid counter is set to 0.
    * The self.msg_pool is initialised as an empty set.
    * The channel is set to the default 42.
    """
    r = adafruit_ble_radio.Radio()
    assert r.ble == adafruit_ble_radio.BLERadio()
    assert r.uid == 0
    assert r.msg_pool == set()
    assert r._channel == 42
Exemplo n.º 2
0
def test_radio_init_channel():
    """
    If a channel argument is passed to initialisation, this is correctly set.
    """
    r = adafruit_ble_radio.Radio(channel=7)
    assert r._channel == 7
Exemplo n.º 3
0
def radio():
    """
    A fixture to recreate a new Radio instance for each test that needs it.
    """
    return adafruit_ble_radio.Radio()