Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
assert selector.label == 'low'
assert selector.priority == 9
selector.keypress(10, 'right')
assert selector.label == 'medium'
assert selector.priority == 5
# Spin the whoel way around:
for _ in PrioritySelector.RANGES:
selector.keypress(10, 'right')
assert selector.label == 'medium'
assert selector.priority == 5
# Now the other way
for _ in PrioritySelector.RANGES:
selector.keypress(10, 'left')
assert selector.label == 'medium'
assert selector.priority == 5
# Should do nothing:
selector.keypress(10, 'd')
selector.keypress(10, '9')
assert selector.label == 'medium'
assert selector.priority == 5
selector.keypress(10, 'right')
assert selector.label == 'high'
assert selector.priority == 1
selector.keypress(10, 'left')
selector.keypress(10, 'left')
assert selector.label == 'low'
assert selector.priority == 9
selector.keypress(10, 'right')
assert selector.label == 'medium'
assert selector.priority == 5
# Spin the whoel way around:
for _ in PrioritySelector.RANGES:
selector.keypress(10, 'right')
assert selector.label == 'medium'
assert selector.priority == 5
# Now the other way
for _ in PrioritySelector.RANGES:
selector.keypress(10, 'left')
assert selector.label == 'medium'
assert selector.priority == 5
# Should do nothing:
selector.keypress(10, 'd')
selector.keypress(10, '9')
assert selector.label == 'medium'
def _update_label(self, delta=0):
for i, r in enumerate(PrioritySelector.RANGES):
if self._priority in r:
self._priority = PrioritySelector.RANGES[(
i + delta
) % len(PrioritySelector.RANGES)][0]
self._set_label()
return
def _update_label(self, delta=0):
for i, r in enumerate(PrioritySelector.RANGES):
if self._priority in r:
self._priority = PrioritySelector.RANGES[(
i + delta
) % len(PrioritySelector.RANGES)][0]
self._set_label()
return
def _update_label(self, delta=0):
for i, r in enumerate(PrioritySelector.RANGES):
if self._priority in r:
self._priority = PrioritySelector.RANGES[(
i + delta
) % len(PrioritySelector.RANGES)][0]
self._set_label()
return