def test_equality(self): same_wire = wire.WireSegment(self.current, self.start, self.end) self.assertEqual(self.wire, same_wire) # Check with same current same_current = parameter.ConstantParameter(self.current.value(0)) same_wire = wire.WireSegment(same_current, self.start, self.end) self.assertEqual(self.wire, same_wire) # Check with different current diff_current = parameter.ConstantParameter(-2) different_wire = wire.WireSegment(diff_current, [-5, 0, 0], [0, 0, 3]) self.assertNotEqual(self.wire, different_wire)
def setUp(self): # setup parallel wire cluster current_pve = parameter.ConstantParameter(1) current_nve = parameter.ConstantParameter(-1) wire_top = wire.WireSegment(current_pve, [-1, 1, 0], [1, 1, 0]) wire_bot = wire.WireSegment(current_pve, [-1, -1, 0], [1, -1, 0]) self.cluster_parallel = wire.WireCluster([wire_top, wire_bot]) # And anti-parallel wire_top = wire.WireSegment(current_pve, [-1, 1, 0], [1, 1, 0]) wire_bot = wire.WireSegment(current_nve, [-1, -1, 0], [1, -1, 0]) self.cluster_antiparallel = wire.WireCluster([wire_bot, wire_top])
def setUp(self): """ Initialise a wire for basic testing """ self.start = [-1, 0, 0] self.end = [1, 0, 0] self.current = parameter.ConstantParameter(1) self.wire = wire.WireSegment(self.current, self.start, self.end)
def test_init(self): """ Test that the zwire initialises in the expected way """ # TODO Check non-axial wires too axis = self.z_wire.wires[1] axis_expect = wire.WireSegment(self.current, [0, -self.al / 2, 0], [0, self.al / 2, 0]) self.assertEqual(axis, axis_expect)