-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
ndeflib version 0.3.3, some tests are failing.
python version 3.13.0
pytest version 8.3.1
/usr/bin/pytest tests/
============================= test session starts ==============================
platform linux -- Python 3.13.0rc1, pytest-8.3.1, pluggy-1.5.0
rootdir: /builddir/build/BUILD/python-ndeflib-0.3.3-build/ndeflib-0.3.3
configfile: setup.cfg
collected 1608 items
tests/test_bluetooth.py ................................................ [ 2%]
......F................................................................. [ 7%]
.................................................F...................... [ 11%]
................................. [ 13%]
tests/test_deviceinfo.py ..................................... [ 16%]
tests/test_handover.py ......................F..F....................... [ 19%]
.............................................................F.......... [ 23%]
........................................................................ [ 28%]
........................................................................ [ 32%]
................................................................... [ 36%]
tests/test_message.py .................................................. [ 40%]
............. [ 40%]
tests/test_record.py ................................................... [ 44%]
........................................................................ [ 48%]
................................................. [ 51%]
tests/test_signature.py ............................................. [ 54%]
tests/test_smartposter.py .............................................. [ 57%]
........................................................................ [ 61%]
.......................... [ 63%]
tests/test_text.py .............................F.F..................... [ 66%]
[ 66%]
tests/test_uri.py ...................................................... [ 69%]
........................................................................ [ 74%]
........................................................................ [ 78%]
...... [ 79%]
tests/test_wifi.py ..................................................... [ 82%]
........................................................................ [ 87%]
........................................................................ [ 91%]
........................................................................ [ 96%]
................................................................ [100%]
=================================== FAILURES ===================================
_____________________ TestDeviceClass.test_decode[octets1] _____________________
self = <test_bluetooth.TestDeviceClass object at 0x3ffb626e580>
octets = bytearray(b'V4\x12')
@pytest.mark.parametrize("octets", [HEX('000000'), HEX('563412')])
def test_decode(self, octets):
obj = ndef.bluetooth.DeviceClass.decode(octets)
> assert obj.encode() == octets
tests/test_bluetooth.py:160:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ndef.bluetooth.DeviceClass(0x56341200)
def encode(self):
"""Return the encoded representation suitable for transmission.
In absence of encoding errors the return value is exactly
three bytes.
"""
if 0 <= self.cod <= 0xFFFFFF:
return struct.pack('<I', self.cod)[0:3]
else:
errstr = "can't encode {!r} into class of device octets"
> raise encode_error(self, errstr, self.cod)
E ndef.record.EncodeError: ndef.bluetooth.DeviceClass can't encode 1446253056 into class of device octets
../BUILDROOT/usr/lib/python3.13/site-packages/ndef/bluetooth.py:358: EncodeError
____________ TestBluetoothEasyPairingRecord.test_attr_device_class _____________
self = <test_bluetooth.TestBluetoothEasyPairingRecord object at 0x3ffb6232db0>
def test_attr_device_class(self):
obj = ndef.BluetoothEasyPairingRecord('01:02:03:04:05:06')
assert isinstance(obj.device_class, ndef.bluetooth.DeviceClass)
assert obj.device_class.major_device_class == 'Miscellaneous'
assert obj.device_class.minor_device_class == 'Uncategorized'
assert obj.device_class.major_service_class == ()
obj.device_class = 0x20041C
> assert obj.device_class.major_device_class == 'Audio / Video'
E AssertionError: assert 'Miscellaneous' == 'Audio / Video'
E
E - Audio / Video
E + Miscellaneous
tests/test_bluetooth.py:396: AssertionError
_ TestAlternativeCarrierRecord.test_decode_error[0001-unpack_from requires a buffer of at least 1 bytes] _
self = <test_handover.TestAlternativeCarrierRecord object at 0x3ffb645f2d0>
payload = '0001', errstr = 'unpack_from requires a buffer of at least 1 bytes'
def test_decode_error(self, payload, errstr):
RECORD = self.RECORD
CLNAME = RECORD.__module__ + '.' + RECORD.__name__
OCTETS = bytes(bytearray.fromhex(payload))
ERRSTR = CLNAME + ' ' + errstr
ASSERT = "assert {0}.decode_payload(hex'{1}', 'strict') ==> {2}"
print('\n' + ASSERT.format(CLNAME, payload, ERRSTR))
with pytest.raises(ndef.DecodeError) as excinfo:
RECORD._decode_payload(OCTETS, 'strict')
> assert str(excinfo.value) == ERRSTR
E AssertionError
tests/_test_record_base.py:89: AssertionError
----------------------------- Captured stdout call -----------------------------
assert ndef.handover.AlternativeCarrierRecord.decode_payload(hex'0001', 'strict') ==> ndef.handover.AlternativeCarrierRecord unpack_from requires a buffer of at least 1 bytes
_ TestAlternativeCarrierRecord.test_decode_error[00000101-unpack_from requires a buffer of at least 1 bytes] _
self = <test_handover.TestAlternativeCarrierRecord object at 0x3ffb63bd790>
payload = '00000101'
errstr = 'unpack_from requires a buffer of at least 1 bytes'
def test_decode_error(self, payload, errstr):
RECORD = self.RECORD
CLNAME = RECORD.__module__ + '.' + RECORD.__name__
OCTETS = bytes(bytearray.fromhex(payload))
ERRSTR = CLNAME + ' ' + errstr
ASSERT = "assert {0}.decode_payload(hex'{1}', 'strict') ==> {2}"
print('\n' + ASSERT.format(CLNAME, payload, ERRSTR))
with pytest.raises(ndef.DecodeError) as excinfo:
RECORD._decode_payload(OCTETS, 'strict')
> assert str(excinfo.value) == ERRSTR
E AssertionError
tests/_test_record_base.py:89: AssertionError
----------------------------- Captured stdout call -----------------------------
assert ndef.handover.AlternativeCarrierRecord.decode_payload(hex'00000101', 'strict') ==> ndef.handover.AlternativeCarrierRecord unpack_from requires a buffer of at least 1 bytes
_ TestErrorRecord.test_encode_error[args1-ubyte format requires 0 <= number <= 255] _
self = <test_handover.TestErrorRecord object at 0x3ffb63bce90>, args = (1, 256)
errstr = 'ubyte format requires 0 <= number <= 255'
def test_encode_error(self, args, errstr):
RECORD = self.RECORD
CLNAME = RECORD.__module__ + '.' + RECORD.__name__
ERRSTR = CLNAME + ' ' + errstr
ASSERT = "assert {0}{1} ==> {2}"
print('\n' + ASSERT.format(CLNAME, args, errstr))
with pytest.raises(ndef.EncodeError) as excinfo:
record = RECORD(*args)
record = record._encode_payload()
> assert str(excinfo.value) == ERRSTR
E AssertionError
tests/_test_record_base.py:118: AssertionError
----------------------------- Captured stdout call -----------------------------
assert ndef.handover.ErrorRecord(1, 256) ==> ubyte format requires 0 <= number <= 255
____ TestTextRecord.test_encode_valid[args3-82656efffe480065006c006c006f00] ____
self = <test_text.TestTextRecord object at 0x3ffb6834730>
args = ('Hello', 'en', 'UTF-16'), payload = '82656efffe480065006c006c006f00'
def test_encode_valid(self, args, payload):
RECORD = self.RECORD
CLNAME = RECORD.__module__ + '.' + RECORD.__name__
OCTETS = bytes(bytearray.fromhex(payload))
ASSERT = "assert {0}({1}).encode_payload() == hex'{2}'"
print('\n' + ASSERT.format(CLNAME, args, payload))
record = RECORD(*args)
> assert record._encode_payload() == OCTETS
E AssertionError
tests/_test_record_base.py:107: AssertionError
----------------------------- Captured stdout call -----------------------------
assert ndef.text.TextRecord(('Hello', 'en', 'UTF-16')).encode_payload() == hex'82656efffe480065006c006c006f00'
____________ TestTextRecord.test_encode_valid[args5-82656cfffe9403] ____________
self = <test_text.TestTextRecord object at 0x3ffb6834af0>
args = ('Δ', 'el', 'UTF-16'), payload = '82656cfffe9403'
def test_encode_valid(self, args, payload):
RECORD = self.RECORD
CLNAME = RECORD.__module__ + '.' + RECORD.__name__
OCTETS = bytes(bytearray.fromhex(payload))
ASSERT = "assert {0}({1}).encode_payload() == hex'{2}'"
print('\n' + ASSERT.format(CLNAME, args, payload))
record = RECORD(*args)
> assert record._encode_payload() == OCTETS
E AssertionError
tests/_test_record_base.py:107: AssertionError
----------------------------- Captured stdout call -----------------------------
assert ndef.text.TextRecord(('Δ', 'el', 'UTF-16')).encode_payload() == hex'82656cfffe9403'
=============================== warnings summary ===============================
../../../../../usr/lib/python3.13/site-packages/_pytest/config/__init__.py:1437
/usr/lib/python3.13/site-packages/_pytest/config/__init__.py:1437: PytestConfigWarning: Unknown config option: strict
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_bluetooth.py::TestDeviceClass::test_decode[octets1] - ndef....
FAILED tests/test_bluetooth.py::TestBluetoothEasyPairingRecord::test_attr_device_class
FAILED tests/test_handover.py::TestAlternativeCarrierRecord::test_decode_error[0001-unpack_from requires a buffer of at least 1 bytes]
FAILED tests/test_handover.py::TestAlternativeCarrierRecord::test_decode_error[00000101-unpack_from requires a buffer of at least 1 bytes]
FAILED tests/test_handover.py::TestErrorRecord::test_encode_error[args1-ubyte format requires 0 <= number <= 255]
FAILED tests/test_text.py::TestTextRecord::test_encode_valid[args3-82656efffe480065006c006c006f00]
FAILED tests/test_text.py::TestTextRecord::test_encode_valid[args5-82656cfffe9403]
================== 7 failed, 1601 passed, 1 warning in 1.95s ===================
Metadata
Metadata
Assignees
Labels
No labels