Пример #1
0
 def setUp(self):
     FitTestCase.setUp(self)
     self.holder1 = Mock(spec_set=())
     self.holder2 = Mock(spec_set=())
     self.holder3 = Mock(spec_set=())
     self.holder4 = Mock(spec_set=())
     self.holder5 = Mock(spec_set=())
     self.holder6 = Mock(spec_set=())
     self.highRack = [self.holder1, None, None, self.holder2]
     self.medRack = [None, self.holder3, None, None, self.holder4]
     self.lowRack = [self.holder5, None, None, None, self.holder6]
     self.modules = ModuleRacks(high=self.highRack,
                                med=self.medRack,
                                low=self.lowRack)
Пример #2
0
 def setUp(self):
     super().setUp()
     self.holder1 = Mock(spec_set=())
     self.holder2 = Mock(spec_set=())
     self.holder3 = Mock(spec_set=())
     self.holder4 = Mock(spec_set=())
     self.holder5 = Mock(spec_set=())
     self.holder6 = Mock(spec_set=())
     self.high_rack = [self.holder1, None, None, self.holder2]
     self.med_rack = [None, self.holder3, None, None, self.holder4]
     self.low_rack = [self.holder5, None, None, None, self.holder6]
     self.modules = ModuleRacks(high=self.high_rack, med=self.med_rack, low=self.low_rack)
Пример #3
0
 def setUp(self):
     FitTestCase.setUp(self)
     self.holder1 = Mock(spec_set=())
     self.holder2 = Mock(spec_set=())
     self.holder3 = Mock(spec_set=())
     self.holder4 = Mock(spec_set=())
     self.holder5 = Mock(spec_set=())
     self.holder6 = Mock(spec_set=())
     self.highRack = [self.holder1, None, None, self.holder2]
     self.medRack = [None, self.holder3, None, None, self.holder4]
     self.lowRack = [self.holder5, None, None, None, self.holder6]
     self.modules = ModuleRacks(high=self.highRack, med=self.medRack, low=self.lowRack)
Пример #4
0
 def setUp(self):
     ContainerTestCase.setUp(self)
     self.holder1 = Holder()
     self.holder2 = Holder()
     self.holder3 = Holder()
     self.holder4 = Holder()
     self.holder5 = Holder()
     self.holder6 = Holder()
     self.highRack = [self.holder1, None, None, self.holder2]
     self.medRack = [None, self.holder3, None, None, self.holder4]
     self.lowRack = [self.holder5, None, None, None, self.holder6]
     self.modules = ModuleRacks(high=self.highRack, med=self.medRack, low=self.lowRack)
Пример #5
0
class TestContainerModuleRacks(FitTestCase):
    def setUp(self):
        super().setUp()
        self.holder1 = Mock(spec_set=())
        self.holder2 = Mock(spec_set=())
        self.holder3 = Mock(spec_set=())
        self.holder4 = Mock(spec_set=())
        self.holder5 = Mock(spec_set=())
        self.holder6 = Mock(spec_set=())
        self.high_rack = [self.holder1, None, None, self.holder2]
        self.med_rack = [None, self.holder3, None, None, self.holder4]
        self.low_rack = [self.holder5, None, None, None, self.holder6]
        self.modules = ModuleRacks(high=self.high_rack,
                                   med=self.med_rack,
                                   low=self.low_rack)

    def test_rack_accessibility(self):
        self.assertIs(self.modules.high, self.high_rack)
        self.assertIs(self.modules.med, self.med_rack)
        self.assertIs(self.modules.low, self.low_rack)

    def test_holders_len(self):
        module_holders = self.modules.holders()
        self.assertEqual(len(module_holders), 6)
        self.high_rack.remove(self.holder1)
        self.assertEqual(len(module_holders), 5)
        self.med_rack.remove(self.holder3)
        self.assertEqual(len(module_holders), 4)
        self.low_rack.append(self.holder1)
        self.assertEqual(len(module_holders), 5)

    def test_holders_iter(self):
        module_holders = self.modules.holders()
        expected = [
            self.holder1, self.holder2, self.holder3, self.holder4,
            self.holder5, self.holder6
        ]
        self.assertEqual(list(module_holders), expected)
        self.high_rack.remove(self.holder1)
        expected = [
            self.holder2, self.holder3, self.holder4, self.holder5,
            self.holder6
        ]
        self.assertEqual(list(module_holders), expected)
        self.med_rack.remove(self.holder3)
        expected = [self.holder2, self.holder4, self.holder5, self.holder6]
        self.assertEqual(list(module_holders), expected)
        self.low_rack.append(self.holder1)
        expected = [
            self.holder2, self.holder4, self.holder5, self.holder6,
            self.holder1
        ]
        self.assertEqual(list(module_holders), expected)

    def test_holder_contains(self):
        module_holders = self.modules.holders()
        self.assertFalse(None in module_holders)
        self.assertTrue(self.holder1 in module_holders)
        self.assertTrue(self.holder2 in module_holders)
        self.high_rack.remove(self.holder1)
        self.assertFalse(self.holder1 in module_holders)
        self.assertTrue(self.holder2 in module_holders)
        self.assertTrue(self.holder3 in module_holders)
        self.assertTrue(self.holder4 in module_holders)
        self.med_rack.remove(self.holder3)
        self.assertFalse(self.holder3 in module_holders)
        self.assertTrue(self.holder4 in module_holders)
        self.assertTrue(self.holder5 in module_holders)
        self.assertTrue(self.holder6 in module_holders)
        self.assertFalse(self.holder1 in module_holders)
        self.low_rack.append(self.holder1)
        self.assertTrue(self.holder5 in module_holders)
        self.assertTrue(self.holder6 in module_holders)
        self.assertTrue(self.holder1 in module_holders)
        self.assertFalse(None in module_holders)
Пример #6
0
class TestContainerModuleRacks(FitTestCase):

    def setUp(self):
        super().setUp()
        self.holder1 = Mock(spec_set=())
        self.holder2 = Mock(spec_set=())
        self.holder3 = Mock(spec_set=())
        self.holder4 = Mock(spec_set=())
        self.holder5 = Mock(spec_set=())
        self.holder6 = Mock(spec_set=())
        self.high_rack = [self.holder1, None, None, self.holder2]
        self.med_rack = [None, self.holder3, None, None, self.holder4]
        self.low_rack = [self.holder5, None, None, None, self.holder6]
        self.modules = ModuleRacks(high=self.high_rack, med=self.med_rack, low=self.low_rack)

    def test_rack_accessibility(self):
        self.assertIs(self.modules.high, self.high_rack)
        self.assertIs(self.modules.med, self.med_rack)
        self.assertIs(self.modules.low, self.low_rack)

    def test_holders_len(self):
        module_holders = self.modules.holders()
        self.assertEqual(len(module_holders), 6)
        self.high_rack.remove(self.holder1)
        self.assertEqual(len(module_holders), 5)
        self.med_rack.remove(self.holder3)
        self.assertEqual(len(module_holders), 4)
        self.low_rack.append(self.holder1)
        self.assertEqual(len(module_holders), 5)

    def test_holders_iter(self):
        module_holders = self.modules.holders()
        expected = [
            self.holder1, self.holder2, self.holder3,
            self.holder4, self.holder5, self.holder6
        ]
        self.assertEqual(list(module_holders), expected)
        self.high_rack.remove(self.holder1)
        expected = [
            self.holder2, self.holder3, self.holder4,
            self.holder5, self.holder6
        ]
        self.assertEqual(list(module_holders), expected)
        self.med_rack.remove(self.holder3)
        expected = [
            self.holder2, self.holder4, self.holder5,
            self.holder6
        ]
        self.assertEqual(list(module_holders), expected)
        self.low_rack.append(self.holder1)
        expected = [
            self.holder2, self.holder4, self.holder5,
            self.holder6, self.holder1
        ]
        self.assertEqual(list(module_holders), expected)

    def test_holder_contains(self):
        module_holders = self.modules.holders()
        self.assertFalse(None in module_holders)
        self.assertTrue(self.holder1 in module_holders)
        self.assertTrue(self.holder2 in module_holders)
        self.high_rack.remove(self.holder1)
        self.assertFalse(self.holder1 in module_holders)
        self.assertTrue(self.holder2 in module_holders)
        self.assertTrue(self.holder3 in module_holders)
        self.assertTrue(self.holder4 in module_holders)
        self.med_rack.remove(self.holder3)
        self.assertFalse(self.holder3 in module_holders)
        self.assertTrue(self.holder4 in module_holders)
        self.assertTrue(self.holder5 in module_holders)
        self.assertTrue(self.holder6 in module_holders)
        self.assertFalse(self.holder1 in module_holders)
        self.low_rack.append(self.holder1)
        self.assertTrue(self.holder5 in module_holders)
        self.assertTrue(self.holder6 in module_holders)
        self.assertTrue(self.holder1 in module_holders)
        self.assertFalse(None in module_holders)
Пример #7
0
class TestContainerModuleRacks(ContainerTestCase):

    def setUp(self):
        ContainerTestCase.setUp(self)
        self.holder1 = Holder()
        self.holder2 = Holder()
        self.holder3 = Holder()
        self.holder4 = Holder()
        self.holder5 = Holder()
        self.holder6 = Holder()
        self.highRack = [self.holder1, None, None, self.holder2]
        self.medRack = [None, self.holder3, None, None, self.holder4]
        self.lowRack = [self.holder5, None, None, None, self.holder6]
        self.modules = ModuleRacks(high=self.highRack, med=self.medRack, low=self.lowRack)

    def testRackAccessibility(self):
        self.assertIs(self.modules.high, self.highRack)
        self.assertIs(self.modules.med, self.medRack)
        self.assertIs(self.modules.low, self.lowRack)

    def testHoldersLen(self):
        moduleHolders = self.modules.holders()
        self.assertEqual(len(moduleHolders), 6)
        self.highRack.remove(self.holder1)
        self.assertEqual(len(moduleHolders), 5)
        self.medRack.remove(self.holder3)
        self.assertEqual(len(moduleHolders), 4)
        self.lowRack.append(self.holder1)
        self.assertEqual(len(moduleHolders), 5)

    def testHoldersIter(self):
        moduleHolders = self.modules.holders()
        expected = [self.holder1, self.holder2, self.holder3,
                    self.holder4, self.holder5, self.holder6]
        self.assertEqual(list(moduleHolders), expected)
        self.highRack.remove(self.holder1)
        expected = [self.holder2, self.holder3, self.holder4,
                    self.holder5, self.holder6]
        self.assertEqual(list(moduleHolders), expected)
        self.medRack.remove(self.holder3)
        expected = [self.holder2, self.holder4, self.holder5,
                    self.holder6]
        self.assertEqual(list(moduleHolders), expected)
        self.lowRack.append(self.holder1)
        expected = [self.holder2, self.holder4, self.holder5,
                    self.holder6, self.holder1]
        self.assertEqual(list(moduleHolders), expected)

    def testHolderContains(self):
        moduleHolders = self.modules.holders()
        self.assertFalse(None in moduleHolders)
        self.assertTrue(self.holder1 in moduleHolders)
        self.assertTrue(self.holder2 in moduleHolders)
        self.highRack.remove(self.holder1)
        self.assertFalse(self.holder1 in moduleHolders)
        self.assertTrue(self.holder2 in moduleHolders)
        self.assertTrue(self.holder3 in moduleHolders)
        self.assertTrue(self.holder4 in moduleHolders)
        self.medRack.remove(self.holder3)
        self.assertFalse(self.holder3 in moduleHolders)
        self.assertTrue(self.holder4 in moduleHolders)
        self.assertTrue(self.holder5 in moduleHolders)
        self.assertTrue(self.holder6 in moduleHolders)
        self.assertFalse(self.holder1 in moduleHolders)
        self.lowRack.append(self.holder1)
        self.assertTrue(self.holder5 in moduleHolders)
        self.assertTrue(self.holder6 in moduleHolders)
        self.assertTrue(self.holder1 in moduleHolders)
        self.assertFalse(None in moduleHolders)