def test_register_duplicate_signal(self): """Creates empty SH, tries registering dupe signal.""" SH = SignalHolder() SH.register(self.test_signal) SH.register(self.test_signal) self.assertEqual(1, len(SH)) self._assert_same_signal(self.test_signal, SH[0])
def test_register_signal_list(self): """Creates empty SH, registers signal list, checks for presence.""" SH = SignalHolder() SH.register([self.test_signal, self.test_signal2]) self.assertEqual(2, len(SH)) self._assert_same_signal(self.test_signal, SH[0]) self._assert_same_signal(self.test_signal2, SH[1])
def test_register_SH(self): """Creates empty SH, registers SH w/ signals, checks for presence.""" SH = SignalHolder([self.test_signal, self.test_signal2]) SH2 = SignalHolder() SH2.register(SH) self.assertEqual(2, len(SH2)) self._assert_same_signal(self.test_signal, SH2[0]) self._assert_same_signal(self.test_signal2, SH2[1])
def test_SH_repr(self): """Creates a SH with signal, checks __repr__ value.""" SH = SignalHolder(self.test_signal) self.assertEqual(1, len(SH)) self.assertEqual('["TEST_SIGNAL"]', str(SH)) SH.register(self.test_signal2) self.assertEqual(2, len(SH)) self.assertEqual('["TEST_SIGNAL", "TEST_SIGNAL2"]', str(SH))
def test_register_0_strength_signal(self): """Attempts to register a signal w/ strength = 0.""" SH = SignalHolder() SH.register(self.test_signal_0_strength) self.assertEqual(0, len(SH))
def test_register_one_signal(self): """Creates empty SH, registers 1 signal, checks for presence.""" SH = SignalHolder() SH.register(self.test_signal) self.assertEqual(1, len(SH)) self._assert_same_signal(self.test_signal, SH[0])