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_stream_with_non_integer_weight_is_error(self, weight):
"""
Giving a stream a non-integer weight is rejected.
"""
p = priority.PriorityTree()
with pytest.raises(priority.BadWeightError) as err:
p.insert_stream(stream_id=1, weight=weight)
assert err.value.args[0] == 'Stream weight should be an integer'
p.insert_stream(stream_id=2)
with pytest.raises(priority.BadWeightError) as err:
p.reprioritize(stream_id=2, weight=weight)
assert err.value.args[0] == 'Stream weight should be an integer'