def test_marker(rin): m = elements.Marker('marker') assert m.Length == 0 rin = numpy.array(numpy.random.rand(*rin.shape), order='F') rin_orig = numpy.array(rin, copy=True, order='F') element_pass(m, rin) numpy.testing.assert_equal(rin, rin_orig)
def simple_ring(): ring = [elements.Drift('D1', 1, R1=numpy.eye(6), R2=numpy.eye(6)), elements.Marker('M1', attr='a_value'), elements.M66('M66'), elements.Drift('D2', 1, T1=numpy.zeros(6), T2=numpy.zeros(6)), elements.Drift('D3', 1, R1=numpy.eye(6), R2=numpy.eye(6)), elements.Drift('D4', 1, T1=numpy.zeros(6), T2=numpy.zeros(6))] return ring
def test_marker(rin): m = elements.Marker('marker') assert m.Length == 0 lattice = [m] rin = numpy.random.rand(*rin.shape) rin_orig = numpy.array(rin, copy=True) atpass(lattice, rin, 1) numpy.testing.assert_equal(rin, rin_orig)
def test_missing_pass_method_raises_attribute_error(rin): m = elements.Marker('marker') l = [m] del m.PassMethod with pytest.raises(AttributeError): atpass(l, rin, 1)
def test_missing_pass_method_raises_attribute_error(rin): lat = [elements.Marker('marker')] del lat[0].PassMethod with pytest.raises(AttributeError): atpass(lat, rin, 1)