Beispiel #1
0
 def test_state_smoke_full(self):
     state_smoke_test(
         Device(name=u'x',
                rx_driver=StubRXDriver(),
                tx_driver=StubTXDriver(),
                vfo_cell=_ConstantVFOCell(1),
                components={'c': StubComponent()}))
Beispiel #2
0
 def test_tx_mode_noop(self):
     """
     With no TX driver, set_transmitting is a noop.
     
     This was chosen as the most robust handling of the erroneous operation.
     """
     d = Device(rx_driver=StubRXDriver())
     d.set_transmitting(True)
     d.set_transmitting(False)
Beispiel #3
0
 def test_tx_mode_actual(self):
     log = []
     txd = _TestTXDriver(log)
     d = Device(rx_driver=StubRXDriver(), tx_driver=txd)
     
     def midpoint_hook():
         log.append('H')
     
     # Either TX driver receives the hook (!= case) or the hook is called directly (== case)
     d.set_transmitting(True, midpoint_hook)
     self.assertEqual(log, [(True, midpoint_hook)])
     d.set_transmitting(True, midpoint_hook)
     self.assertEqual(log, [(True, midpoint_hook), 'H'])
     d.set_transmitting(False, midpoint_hook)
     self.assertEqual(log, [(True, midpoint_hook), 'H', (False, midpoint_hook)])
     d.set_transmitting(False, midpoint_hook)
     self.assertEqual(log, [(True, midpoint_hook), 'H', (False, midpoint_hook), 'H'])
Beispiel #4
0
 def test_rx_present(self):
     rxd = StubRXDriver()
     d = Device(rx_driver=rxd)
     self.assertEqual(True, d.can_receive())
     self.assertEqual(rxd, d.get_rx_driver())