def extreme(): return VisibleString('a' * 0xFF)
def test_byte_string_min_value(): assert VisibleString(b'a').value == 'a'
def test_byte_string_max_value(): assert VisibleString(b'a' * 0xFF).value == 'a' * 0xFF
def empty(): return VisibleString('')
def test_byte_string_min_raw_value(): assert VisibleString(b'a').raw_value == b'a'
def test_none_byte(): assert VisibleString(b'').value is None
def test_none_none(): assert VisibleString(None).value is None
def test_none_empty(): assert VisibleString().value is None
def test_none_string(): assert VisibleString('').value is None
def string(): return VisibleString('string')
def test_decode_above(): with raises(ValueError): VisibleString(b'a' * 0x1FF)
def test_encode_decode(): with raises(TypeError): VisibleString(1)
def none(): return VisibleString(None)
'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