示例#1
0
 def test_tunerlist_releaseTuner_invalid(self):
     tunerList = TunerList(tunerList=[self.tunerB, self.tunerC])
     self.assertEqual(tunerList.tuners, [self.tunerB, self.tunerC])
     self.assertFalse(tunerList.lockedTuners)
     tunerList.releaseTuner(self.tunerA)  # not managed by tunerList
     self.assertEqual(tunerList.tuners, [self.tunerB, self.tunerC])
     self.assertFalse(tunerList.lockedTuners)
示例#2
0
 def test_tunerlist_releaseTuner_invalid(self):
     tunerList = TunerList(tunerList=[self.tunerB, self.tunerC])
     self.assertEqual(tunerList.tuners, [self.tunerB, self.tunerC])
     self.assertFalse(tunerList.lockedTuners)
     tunerList.releaseTuner(self.tunerA) # not managed by tunerList
     self.assertEqual(tunerList.tuners, [self.tunerB, self.tunerC])
     self.assertFalse(tunerList.lockedTuners)
示例#3
0
 def test_tunerlist_releaseTuner_notLocked(self):
     tunerList = TunerList(tunerList=[self.tunerA, self.tunerB, self.tunerC])
     self.assertEqual(self.tunerA, tunerList.lockTuner())
     self.assertEqual(self.tunerB, tunerList.lockTuner())
     self.assertEqual(tunerList.tuners, [self.tunerC])
     self.assertEqual(tunerList.lockedTuners, [self.tunerA, self.tunerB])
     tunerList.releaseTuner(self.tunerC) # tunerC is not locked!
     self.assertEqual(tunerList.tuners, [self.tunerC])
     self.assertEqual(tunerList.lockedTuners, [self.tunerA, self.tunerB])
示例#4
0
 def test_tunerlist_lockTuner(self):
     tuners = [ self.tunerA, self.tunerB, self.tunerC]
     tunerList = TunerList(tuners)
     lockedTuner = tunerList.lockTuner()
     self.assertEqual(self.tunerA, lockedTuner)
     self.assertEqual(2, len(tunerList.tuners))
     self.assertEqual(self.tunerB, tunerList.tuners[0])
     self.assertEqual(self.tunerC, tunerList.tuners[1])
     self.assertEqual(1, len(tunerList.lockedTuners))
     self.assertEqual(self.tunerA, tunerList.lockedTuners[0])
示例#5
0
 def test_tunerlist_releaseTuner_notLocked(self):
     tunerList = TunerList(
         tunerList=[self.tunerA, self.tunerB, self.tunerC])
     self.assertEqual(self.tunerA, tunerList.lockTuner())
     self.assertEqual(self.tunerB, tunerList.lockTuner())
     self.assertEqual(tunerList.tuners, [self.tunerC])
     self.assertEqual(tunerList.lockedTuners, [self.tunerA, self.tunerB])
     tunerList.releaseTuner(self.tunerC)  # tunerC is not locked!
     self.assertEqual(tunerList.tuners, [self.tunerC])
     self.assertEqual(tunerList.lockedTuners, [self.tunerA, self.tunerB])
示例#6
0
 def test_tunerlist_lockTuner(self):
     tuners = [self.tunerA, self.tunerB, self.tunerC]
     tunerList = TunerList(tuners)
     lockedTuner = tunerList.lockTuner()
     self.assertEqual(self.tunerA, lockedTuner)
     self.assertEqual(2, len(tunerList.tuners))
     self.assertEqual(self.tunerB, tunerList.tuners[0])
     self.assertEqual(self.tunerC, tunerList.tuners[1])
     self.assertEqual(1, len(tunerList.lockedTuners))
     self.assertEqual(self.tunerA, tunerList.lockedTuners[0])
示例#7
0
 def test_tunerlist_releaseTuner(self):
     tunerList = TunerList([])
     tunerList.tuners = [self.tunerB, self.tunerA]
     tunerList.lockedTuners = [self.tunerE, self.tunerC, self.tunerD]
     tunerList.releaseTuner(self.tunerC)
     self.assertEqual(3, len(tunerList.tuners))
     self.assertEqual(self.tunerB, tunerList.tuners[0])
     self.assertEqual(self.tunerA, tunerList.tuners[1])
     self.assertEqual(self.tunerC, tunerList.tuners[2])
     self.assertEqual(2, len(tunerList.lockedTuners))
     self.assertEqual(self.tunerE, tunerList.lockedTuners[0])
     self.assertEqual(self.tunerD, tunerList.lockedTuners[1])
示例#8
0
 def test_tunerlist_releaseTuner(self):
     tunerList = TunerList([])
     tunerList.tuners = [self.tunerB, self.tunerA]
     tunerList.lockedTuners = [self.tunerE, self.tunerC, self.tunerD]
     tunerList.releaseTuner(self.tunerC)
     self.assertEqual(3, len(tunerList.tuners))
     self.assertEqual(self.tunerB, tunerList.tuners[0])
     self.assertEqual(self.tunerA, tunerList.tuners[1])
     self.assertEqual(self.tunerC, tunerList.tuners[2])
     self.assertEqual(2, len(tunerList.lockedTuners))
     self.assertEqual(self.tunerE, tunerList.lockedTuners[0])
     self.assertEqual(self.tunerD, tunerList.lockedTuners[1])
示例#9
0
 def test_tunerlist_complexTest(self):
     tunerList = TunerList(tunerList=[self.tunerA, self.tunerB, self.tunerC, self.tunerD])
     self.assertEqual(self.tunerA, tunerList.lockTuner())
     self.assertEqual(self.tunerB, tunerList.lockTuner())
     self.assertEqual(self.tunerC, tunerList.lockTuner())
     self.assertEqual(self.tunerD, tunerList.lockTuner())
     self.assertIsNone(tunerList.lockTuner())
     self.assertEqual(tunerList.lockedTuners, [self.tunerA, self.tunerB, self.tunerC, self.tunerD])
     tunerList.releaseTuner(self.tunerE) # not managed by tunerList
     tunerList.releaseTuner(self.tunerC)
     tunerList.releaseTuner(self.tunerB)
     self.assertEqual(tunerList.tuners, [self.tunerC, self.tunerB])
     self.assertEqual(self.tunerC, tunerList.lockTuner())
     tunerList.releaseTuner(self.tunerA)
     tunerList.releaseTuner(self.tunerD)
     tunerList.releaseTuner(self.tunerC)
     self.assertFalse(tunerList.lockedTuners)
     self.assertEqual(tunerList.tuners, [self.tunerB, self.tunerA, self.tunerD, self.tunerC])
示例#10
0
 def test_tunerlist_complexTest(self):
     tunerList = TunerList(
         tunerList=[self.tunerA, self.tunerB, self.tunerC, self.tunerD])
     self.assertEqual(self.tunerA, tunerList.lockTuner())
     self.assertEqual(self.tunerB, tunerList.lockTuner())
     self.assertEqual(self.tunerC, tunerList.lockTuner())
     self.assertEqual(self.tunerD, tunerList.lockTuner())
     self.assertIsNone(tunerList.lockTuner())
     self.assertEqual(tunerList.lockedTuners,
                      [self.tunerA, self.tunerB, self.tunerC, self.tunerD])
     tunerList.releaseTuner(self.tunerE)  # not managed by tunerList
     tunerList.releaseTuner(self.tunerC)
     tunerList.releaseTuner(self.tunerB)
     self.assertEqual(tunerList.tuners, [self.tunerC, self.tunerB])
     self.assertEqual(self.tunerC, tunerList.lockTuner())
     tunerList.releaseTuner(self.tunerA)
     tunerList.releaseTuner(self.tunerD)
     tunerList.releaseTuner(self.tunerC)
     self.assertFalse(tunerList.lockedTuners)
     self.assertEqual(tunerList.tuners,
                      [self.tunerB, self.tunerA, self.tunerD, self.tunerC])