def test04_canPutDataInQueue(self): getter = BioDataGetter(self.dataSource, self.queue) input = getter._getData() data = getter._transformData(input) getter._putData(data) out = getter.dst.get(True, 3) self.assertEquals(PORT_NUMBER, out[0]) self.assertEquals(P3_OUTPUT, out[1])
def test03_canParseP38channelFast(self): getter = BioDataGetter(self.dataSource, self.queue) input = getter._getData() start = time.time() for i in range(1000): output = getter._transformData(input) end = time.time() dur = (end - start)/1000.0 self.assertTrue(dur < 0.0002)
class Dsu(object): def __init__(self, dst, serial, noise=None): self.serial = serial self.getter = BioDataGetter(self.serial, dst, noise=noise) def pump(self): self.serial.open() self.getter.pump() self.serial.close() def start(self): self.serial.open() self.getter.start() def stop(self): self.getter.stop() self.serial.close()
def test02_canParseP38channel(self): getter = BioDataGetter(self.dataSource, self.queue) input = getter._getData() output = getter._transformData(input) self.assertEquals(P3_OUTPUT, output[2])
def test01_canGetData(self): getter = BioDataGetter(self.dataSource, self.queue) inputArray = getter._getData() for a, b in zip(inputArray, P3_INPUT): self.assertEquals(a, b)
def __init__(self, dst, serial, noise=None): self.serial = serial self.getter = BioDataGetter(self.serial, dst, noise=noise)