예제 #1
0
def test_family_mapping():
    elem_kwargs = {}
    for family_name in CLASS_MAPPING:
        elem_kwargs['FamName'] = family_name
        assert find_class_name(elem_kwargs) == CLASS_MAPPING[family_name]
        elem_kwargs['FamName'] = family_name.upper()
        assert find_class_name(elem_kwargs) == CLASS_MAPPING[family_name]
예제 #2
0
def test_class_mapping():
    elem_kwargs = {'FamName': 'fam'}
    for class_name in CLASS_MAPPING:
        elem_kwargs['Class'] = class_name
        assert find_class_name(elem_kwargs) == CLASS_MAPPING[class_name]
        elem_kwargs['Class'] = class_name.upper()
        assert find_class_name(elem_kwargs) == CLASS_MAPPING[class_name]
예제 #3
0
def test_find_Monitor():
    elem_kwargs = {'GCR': [1, 1, 0, 0], 'FamName': 'fam'}
    assert find_class_name(elem_kwargs) == 'Monitor'
예제 #4
0
def test_invalid_class_warns_when_quiet_is_False():
    elem_kwargs = {'Class': 'Invalid'}
    with pytest.warns(at.AtWarning):
        find_class_name(elem_kwargs, quiet=False)
예제 #5
0
def test_find_RFCavity(elem_kwargs):
    assert find_class_name(elem_kwargs) == 'RFCavity'
예제 #6
0
def test_find_Aperture():
    elem_kwargs = {'Limits': [-0.5, 0.5, -0.5, 0.5], 'FamName': 'fam'}
    assert find_class_name(elem_kwargs) == 'Aperture'
예제 #7
0
def test_PassMethod_mapping():
    elem_kwargs = {'FamName': 'fam'}
    for pass_method in PASS_MAPPING.keys():
        elem_kwargs['PassMethod'] = pass_method
        assert find_class_name(elem_kwargs) == PASS_MAPPING[pass_method]
예제 #8
0
def test_find_M66():
    elem_kwargs = {'M66': numpy.eye(6), 'FamName': 'fam'}
    assert find_class_name(elem_kwargs) == 'M66'
예제 #9
0
def test_find_Marker(elem_kwargs):
    assert find_class_name(elem_kwargs) == 'Marker'
예제 #10
0
def test_find_ThinMultipole(elem_kwargs):
    assert find_class_name(elem_kwargs) == 'ThinMultipole'
예제 #11
0
def test_find_Octupole():
    elem_kwargs = {'PolynomB': [0, 0, 0, 1], 'FamName': 'fam'}
    assert find_class_name(elem_kwargs) == 'Octupole'
예제 #12
0
def test_find_Drift():
    elem_kwargs = {'Length': 1, 'FamName': 'fam'}
    assert find_class_name(elem_kwargs) == 'Drift'
예제 #13
0
def test_invalid_class_does_not_warn_when_quiet_is_True():
    elem_kwargs = {'Class': 'Invalid'}
    with pytest.warns(None) as record:
        find_class_name(elem_kwargs, quiet=True)
    assert len(record) is 0
예제 #14
0
def test_find_Quadrupole(elem_kwargs):
    assert find_class_name(elem_kwargs) == 'Quadrupole'
예제 #15
0
def test_find_Dipole(elem_kwargs):
    assert find_class_name(elem_kwargs) == 'Dipole'
예제 #16
0
def test_find_Corrector():
    elem_kwargs = {'KickAngle': [0, 0], 'FamName': 'fam'}
    assert find_class_name(elem_kwargs) == 'Corrector'
예제 #17
0
def test_find_RingParam():
    elem_kwargs = {'Periodicity': 1, 'FamName': 'fam'}
    assert find_class_name(elem_kwargs) == 'RingParam'