示例#1
0
def test_entered():
    vis = pedl.Visibility()
    assert not vis.entered
    vis.min = 1
    assert vis.entered
    vis.max = 2
    assert vis.entered
示例#2
0
 def create_motion_indicator(self, mtr, w, h):
     """
     Create indicator frame to notify when any motor in group is moving
     """
     #Visibility Rules
     vis = pedl.Visibility(pv=mtr.prefix + self.motion_pv, min=0)
     return Rectangle(fill=False,
                      w=w,
                      h=h,
                      lineWidth=self.frame_width,
                      lineColor=ColorChoice.Yellow,
                      visibility=vis)
示例#3
0
def test_valid():
    vis = pedl.Visibility()
    #Test no information
    assert not vis.valid
    vis.pv = 'TST:PV'

    #Test valid
    vis.min, vis.max = 0, 4
    assert vis.valid

    #Test conflicting range
    vis.max = -1
    assert not vis.valid
示例#4
0
def test_is_visibility():
    v = pedl.Visibility.is_visibility(pedl.Visibility(pv='TST:PV'))
    v.pv == 'TST:PV'

    v = pedl.Visibility.is_visibility({'pv': 'TST:PV', 'min': 2})
    assert v.pv == 'TST:PV'
    assert v.min == 2

    v = pedl.Visibility.is_visibility(['TST:PV', 2])
    assert v.pv == 'TST:PV'
    assert v.min == 2

    with pytest.raises(ValueError):
        v = pedl.Visibility.is_visibility(12)
示例#5
0
def test_invert():
    vis = pedl.Visibility()
    assert vis.inverted == False
    vis.inverted = True
    assert vis.inverted