Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_priority_raises_good_errors_for_zero_stream(self):
"""
Attempting operations on stream 0 raises a PseudoStreamError.
"""
p = priority.PriorityTree()
p.insert_stream(1)
with pytest.raises(priority.PseudoStreamError):
p.reprioritize(0)
with pytest.raises(priority.PseudoStreamError):
p.block(0)
with pytest.raises(priority.PseudoStreamError):
p.unblock(0)
with pytest.raises(priority.PseudoStreamError):
p.remove_stream(0)
def _run_action(self, action, stream_id):
try:
action(stream_id)
except priority.MissingStreamError:
assert stream_id not in self.stream_ids
except priority.PseudoStreamError:
assert stream_id == 0
else:
assert stream_id in self.stream_ids