Beispiel #1
0
 def testAddDevice(self):
     device = Device("abcde", None, None)
     section = Section("test", "grey")
     self.assertEqual(section.numberOfDevices(), 0)
     section.addDevice(device)
     self.assertEqual(section.numberOfDevices(), 1)
     self.assertEqual(section.devices[0], device)
     self.assertEqual(device.numberInSection, 0)
     otherDevice = Device("other", None, None)
     section.addDevice(otherDevice)
     self.assertEqual(otherDevice.numberInSection, 1)
Beispiel #2
0
 def testGetDevice(self):
     dev1 = Device("foo", None, None)
     dev2 = Device("bar", None, None)
     section = Section("test", "grey")
     self.assertEqual(section.numberOfDevices(), 0)
     section.addDevice(dev1)
     section.addDevice(dev2)
     self.assertEqual(section.numberOfDevices(), 2)
     self.assertEqual(section.getDevice(0), dev1)
     self.assertNotEqual(section.getDevice(0), dev2)
     self.assertEqual(section.getDevice(1), dev2)
     self.assertEqual(section.getDevice(3), None)