Esempio n. 1
0
def extreme():
    return VisibleString('a' * 0xFF)
Esempio n. 2
0
def test_byte_string_min_value():
    assert VisibleString(b'a').value == 'a'
Esempio n. 3
0
def test_byte_string_max_value():
    assert VisibleString(b'a' * 0xFF).value == 'a' * 0xFF
Esempio n. 4
0
def empty():
    return VisibleString('')
Esempio n. 5
0
def test_byte_string_min_raw_value():
    assert VisibleString(b'a').raw_value == b'a'
Esempio n. 6
0
def test_none_byte():
    assert VisibleString(b'').value is None
Esempio n. 7
0
def test_none_none():
    assert VisibleString(None).value is None
Esempio n. 8
0
def test_none_empty():
    assert VisibleString().value is None
Esempio n. 9
0
def test_none_string():
    assert VisibleString('').value is None
Esempio n. 10
0
def string():
    return VisibleString('string')
Esempio n. 11
0
def test_decode_above():
    with raises(ValueError):
        VisibleString(b'a' * 0x1FF)
Esempio n. 12
0
def test_encode_decode():
    with raises(TypeError):
        VisibleString(1)
Esempio n. 13
0
def none():
    return VisibleString(None)
Esempio n. 14
0
    'goose_identifier':
    'ASD',
    'goose_timestamp':
    time(),
    'status_number':
    1,
    'sequence_number':
    0,
    'test':
    True,
    'configuration_revision':
    13,
    'needs_commissioning':
    True,
    # ALL DATA
    'all_data': (Boolean(True), VisibleString('Content'), DoublePrecision(1.2),
                 SinglePrecision(3.4), Signed(-5), Unsigned(6),
                 Timestamp(705762855.123456789,
                           Quality(False, False, True, 13)))
}

publisher = Publisher(**data)

goose = bytes(publisher)
nic.send(goose)

for index, goose in enumerate(publisher):
    nic.send(bytes(goose))
    if index == 0xF:
        break