Example #1
0
def extreme():
    return VisibleString('a' * 0xFF)
Example #2
0
def test_byte_string_min_value():
    assert VisibleString(b'a').value == 'a'
Example #3
0
def test_byte_string_max_value():
    assert VisibleString(b'a' * 0xFF).value == 'a' * 0xFF
Example #4
0
def empty():
    return VisibleString('')
Example #5
0
def test_byte_string_min_raw_value():
    assert VisibleString(b'a').raw_value == b'a'
Example #6
0
def test_none_byte():
    assert VisibleString(b'').value is None
Example #7
0
def test_none_none():
    assert VisibleString(None).value is None
Example #8
0
def test_none_empty():
    assert VisibleString().value is None
Example #9
0
def test_none_string():
    assert VisibleString('').value is None
Example #10
0
def string():
    return VisibleString('string')
Example #11
0
def test_decode_above():
    with raises(ValueError):
        VisibleString(b'a' * 0x1FF)
Example #12
0
def test_encode_decode():
    with raises(TypeError):
        VisibleString(1)
Example #13
0
def none():
    return VisibleString(None)
Example #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