def test_request_reordering(): ctx = Dummy() # reordering off n = ctx._last_len assert n is None, n _bdd._request_reordering(ctx) # reordering on ctx._last_len = 1 ctx.length = 3 # >= 2 = 2 * _last_len # large growth with nt.assert_raises(_bdd._NeedsReordering): _bdd._request_reordering(ctx) ctx._last_len = 2 ctx.length = 3 # < 4 = 2 * _last_len # small growth _bdd._request_reordering(ctx)