def test_from_list(self): meters = [] for i in range(1,6): meters.append(ElecMeter(meter_id=ElecMeterID(i, 1, None))) mg = global_meter_group.from_list([ ElecMeterID(1,1,None), (ElecMeterID(2,1,None), (ElecMeterID(3,1,None), ElecMeterID(4,1,None), ElecMeterID(5,1,None))) ]) """
def test_from_list(self): meters = [] for i in range(1,6): meters.append(ElecMeter(meter_id=ElecMeterID(i, 1, None))) mg = global_meter_group.from_list([ ElecMeterID(1,1,None), (ElecMeterID(2,1,None), (ElecMeterID(3,1,None), ElecMeterID(4,1,None), ElecMeterID(5,1,None))) ]) self.assertIs(mg.meters[0], meters[0]) self.assertIs(mg.meters[1].meters[0], meters[1]) self.assertEqual(len(mg.meters[1].meters[1].meters), 3) self.assertEqual(len(mg.meters), 2)
def test_from_list(self): meters = [] for i in range(1, 6): meters.append(ElecMeter(meter_id=ElecMeterID(i, 1, None))) mg = global_meter_group.from_list([ ElecMeterID(1, 1, None), (ElecMeterID(2, 1, None), (ElecMeterID(3, 1, None), ElecMeterID(4, 1, None), ElecMeterID(5, 1, None))) ]) self.assertEqual(mg.meters[0], meters[0]) self.assertEqual(mg.meters[1].meters[0], meters[1]) self.assertEqual(len(mg.meters[1].meters[1].meters), 3) self.assertEqual(len(mg.meters), 2)