Exemplo n.º 1
0
 def test_spO2_invalid(self):
     package_type = 0x01
     package = [0x00] * 7
     for value in [0, 127]:
         package[4] = 0x00 | value
         dp = RealtimeDataPoint(package_type, package)
         self.assertEqual(dp.spO2_invalid, bool(value))
         self.assertEqual(dp.get_package(), package)
         self.assertEqual(dp.__repr__(), eval(dp.__repr__()).__repr__())
Exemplo n.º 2
0
 def test_pulse_rate_invalid(self):
     package_type = 0x01
     package = [0x00] * 7
     for value in [0, 255]:
         package[3] = 0x00 | value
         dp = RealtimeDataPoint(package_type, package)
         self.assertEqual(dp.pulse_rate_invalid, bool(value))
         self.assertEqual(dp.get_package(), package)
         self.assertEqual(dp.__repr__(), eval(dp.__repr__()).__repr__())
Exemplo n.º 3
0
 def test_spO2(self):
     package_type = 0x01
     package = [0x00] * 7
     for value in range(0, 256):
         package[4] = 0x00 | value
         dp = RealtimeDataPoint(package_type, package)
         self.assertEqual(dp.spO2, value)
         self.assertEqual(dp.get_package(), package)
         self.assertEqual(dp.__repr__(), eval(dp.__repr__()).__repr__())
Exemplo n.º 4
0
 def test_pi_valid(self):
     package_type = 0x01
     package = [0x00] * 7
     for value in [False, True]:
         package[2] = 0x00 | value << 4
         dp = RealtimeDataPoint(package_type, package)
         self.assertEqual(dp.pi_valid, value)
         self.assertEqual(dp.get_package(), package)
         self.assertEqual(dp.__repr__(), eval(dp.__repr__()).__repr__())
Exemplo n.º 5
0
 def test_reserved(self):
     package_type = 0x01
     package = [0x00] * 7
     for value in range(0, 8):
         package[2] = 0x00 | value << 5
         dp = RealtimeDataPoint(package_type, package)
         self.assertEqual(dp.reserved, value)
         self.assertEqual(dp.get_package(), package)
         self.assertEqual(dp.__repr__(), eval(dp.__repr__()).__repr__())
Exemplo n.º 6
0
 def test_searching_pulse(self):
     package_type = 0x01
     package = [0x00] * 7
     for value in [False, True]:
         package[1] = 0x00 | value << 7
         dp = RealtimeDataPoint(package_type, package)
         self.assertEqual(dp.searching_pulse, value)
         self.assertEqual(dp.get_package(), package)
         self.assertEqual(dp.__repr__(), eval(dp.__repr__()).__repr__())
Exemplo n.º 7
0
 def test_bar_graph(self):
     package_type = 0x01
     package = [0x00] * 7
     for value in range(0, 16):
         package[2] = 0x00 | value
         dp = RealtimeDataPoint(package_type, package)
         self.assertEqual(dp.bar_graph, value)
         self.assertEqual(dp.get_package(), package)
         self.assertEqual(dp.__repr__(), eval(dp.__repr__()).__repr__())
Exemplo n.º 8
0
 def test_pulse_waveform(self):
     package_type = 0x01
     package = [0x00] * 7
     for value in range(0, 127):
         package[1] = 0x00 | value
         dp = RealtimeDataPoint(package_type, package)
         self.assertEqual(dp.pulse_waveform, value)
         self.assertEqual(dp.get_package(), package)
         self.assertEqual(dp.__repr__(), eval(dp.__repr__()).__repr__())
Exemplo n.º 9
0
 def test_probe_error(self):
     package_type = 0x01
     package = [0x00] * 7
     for value in [False, True]:
         package[0] = 0x00 | value << 7
         dp = RealtimeDataPoint(package_type, package)
         self.assertEqual(dp.probe_error, value)
         self.assertEqual(dp.get_package(), package)
         self.assertEqual(dp.__repr__(), eval(dp.__repr__()).__repr__())
Exemplo n.º 10
0
 def test_low_spO2(self):
     package_type = 0x01
     package = [0x00] * 7
     for value in [False, True]:
         package[0] = 0x00 | value << 5
         dp = RealtimeDataPoint(package_type, package)
         self.assertEqual(dp.low_spO2, value)
         self.assertEqual(dp.get_package(), package)
         self.assertEqual(dp.__repr__(), eval(dp.__repr__()).__repr__())
Exemplo n.º 11
0
 def test_signal_strength(self):
     package_type = 0x01
     package = [0x00] * 7
     for value in range(0, 16):
         package[0] = 0x00 | value
         dp = RealtimeDataPoint(package_type, package)
         self.assertEqual(dp.signal_strength, value)
         self.assertEqual(dp.get_package(), package)
         self.assertEqual(dp.__repr__(), eval(dp.__repr__()).__repr__())
Exemplo n.º 12
0
 def test_pi_invalid(self):
     package_type = 0x01
     package = [0x00] * 7
     for value in [0, 65535]:
         package[5] = 0x00 | value & 0x00ff
         package[6] = 0x00 | (value & 0xff00) >> 8
         dp = RealtimeDataPoint(package_type, package)
         self.assertEqual(dp.pi_invalid, bool(value))
         self.assertEqual(dp.get_package(), package)
         self.assertEqual(dp.__repr__(), eval(dp.__repr__()).__repr__())
Exemplo n.º 13
0
 def test_get_package(self):
     package_type = 0x01
     package = test_package(7)
     dp = RealtimeDataPoint(package_type, package)
     self.assertEqual(package, dp.get_package())