Example #1
0
 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])
Example #2
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])
Example #3
0
 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])
Example #4
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])
Example #5
0
 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])
Example #6
0
 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])
Example #7
0
    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))
Example #8
0
    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))
Example #9
0
 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))
Example #10
0
 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])
Example #11
0
 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))
Example #12
0
 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])