Beispiel #1
0
    def testGetAllDevices(self):
        section = LinacSection("I-K00", None, 0)

        firstDevice = Device("test1", None, None)
        secondDevice = Device("test2", None, None)
        thirdDevice = Device("test3", None, None)
        fourthDevice = Device("test4", None, None)

        section.addSubsection("I-K01A", None, 100)
        section.addSubsection("I-K01B", None, 100)
        firstSubsection = section.getSubsection("I-K01A")
        secondSubsection = section.getSubsection("I-K01B")

        firstSubsection.addDevice(firstDevice)
        section.addDevice(secondDevice)
        secondSubsection.addDevice(thirdDevice)
        firstSubsection.addDevice(fourthDevice)

        allDevices = section.getAllDevices()
        self.assertTrue(firstDevice in allDevices)
        self.assertTrue(secondDevice in allDevices)
        self.assertTrue(thirdDevice in allDevices)
        self.assertTrue(fourthDevice in allDevices)
        self.assertEqual(len(allDevices), 4)
Beispiel #2
0
 def testGetSubsection(self):
     section = LinacSection("I-K00", None, 100)
     subsection = section.addSubsection("I-K00A", None, 100)
     self.assertEqual(section.getSubsection("I-K00B"), None)
     self.assertEqual(section.getSubsection("I-K00A"), section.subsections[0])
     self.assertEqual(subsection, section.getSubsection("I-K00A"))
Beispiel #3
0
    def testComputeSubsectionCoordinate(self):
        section = LinacSection("test", None, 100)
        self.assertEqual(section.computeSubsectionStartCoordinate(), 100)

        section.addSubsection("subtest", None, 45)
        self.assertEqual(section.computeSubsectionStartCoordinate(), 145)