mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-30 02:31:40 +00:00
Add photonlibpy (#1040)
* Added a pure-python implementation of photonlib, named photonlibpy and hosted on pypi --------- Co-authored-by: Matt <matthew.morley.ca@gmail.com>
This commit is contained in:
46
photon-lib/py/test/photonlibpy_test.py
Normal file
46
photon-lib/py/test/photonlibpy_test.py
Normal file
@@ -0,0 +1,46 @@
|
||||
from photonlibpy.packet import Packet
|
||||
from photonlibpy.photonPipelineResult import PhotonPipelineResult
|
||||
from data import rawBytes1
|
||||
from data import rawBytes2
|
||||
from data import rawBytes3
|
||||
from data import rawBytes4
|
||||
from data import rawBytes5
|
||||
from data import rawBytes6
|
||||
|
||||
|
||||
def setupCommon(bytesIn):
|
||||
res = PhotonPipelineResult()
|
||||
packet = Packet(bytesIn)
|
||||
res.populateFromPacket(packet)
|
||||
assert packet.outOfBytes is False
|
||||
return res
|
||||
|
||||
|
||||
def test_byteParse1():
|
||||
res = setupCommon(rawBytes1)
|
||||
assert len(res.getTargets()) == 0
|
||||
|
||||
|
||||
def test_byteParse2():
|
||||
res = setupCommon(rawBytes2)
|
||||
assert len(res.getTargets()) == 0
|
||||
|
||||
|
||||
def test_byteParse3():
|
||||
res = setupCommon(rawBytes3)
|
||||
assert len(res.getTargets()) == 0
|
||||
|
||||
|
||||
def test_byteParse4():
|
||||
res = setupCommon(rawBytes4)
|
||||
assert len(res.getTargets()) == 1
|
||||
|
||||
|
||||
def test_byteParse5():
|
||||
res = setupCommon(rawBytes5)
|
||||
assert len(res.getTargets()) == 1
|
||||
|
||||
|
||||
def test_byteParse6():
|
||||
res = setupCommon(rawBytes6)
|
||||
assert len(res.getTargets()) > 6
|
||||
Reference in New Issue
Block a user