def filter_suite(arr, b):
import random<EOL>random.seed(<NUM_LIT>)<EOL>filtered = b.filter(lambda x: False)<EOL>res = filtered.toarray()<EOL>assert res.shape == (<NUM_LIT:0>,)<EOL>filtered = b.filter(lambda x: True)<EOL>res = filtered.toarray()<EOL>assert res.shape == b.shape<EOL>def filter_half(x):<EOL><INDENT>random.seed(x.tostring())<EOL>return random.random()<EOL><DEDENT>filtered = b.filter(lambda x: filter_half(x) < <NUM_LIT:0.5>)<EOL>res = filtered.toarray()<EOL>assert res.shape[<NUM_LIT:1>:] == b.shape[<NUM_LIT:1>:]<EOL>assert res.shape[<NUM_LIT:0>] <= b.shape[<NUM_LIT:0>]<EOL>if not b.mode == "<STR_LIT>":<EOL><INDENT>filtered = b.filter(lambda x: filter_half(x) < <NUM_LIT:0.5>, sort=True)<EOL>res = filtered.toarray()<EOL>assert res.shape[<NUM_LIT:1>:] == b.shape[<NUM_LIT:1>:]<EOL>assert res.shape[<NUM_LIT:0>] <= b.shape[<NUM_LIT:0>]<EOL><DEDENT>filtered = b.filter(lambda x: filter_half(x) < <NUM_LIT:0.5>, axis=<NUM_LIT:1>)<EOL>res = filtered.toarray()<EOL>assert res.shape[<NUM_LIT:0>] <= b.shape[<NUM_LIT:1>]<EOL>assert res.shape[<NUM_LIT:1>] == b.shape[<NUM_LIT:0>]<EOL>assert res.shape[<NUM_LIT:2>] == b.shape[<NUM_LIT:2>]<EOL>filtered = b.filter(lambda x: filter_half(x) < <NUM_LIT:0.5>, axis=<NUM_LIT:2>)<EOL>res = filtered.toarray()<EOL>assert res.shape[<NUM_LIT:0>] <= b.shape[<NUM_LIT:2>]<EOL>assert res.shape[<NUM_LIT:1>] == b.shape[<NUM_LIT:0>]<EOL>assert res.shape[<NUM_LIT:2>] == b.shape[<NUM_LIT:1>]<EOL>filtered = b.filter(lambda x: False, axis=(<NUM_LIT:0>, <NUM_LIT:1>))<EOL>res = filtered.toarray()<EOL>assert res.shape == (<NUM_LIT:0>,)<EOL>filtered = b.filter(lambda x: True)<EOL>res = filtered.toarray()<EOL>assert res.shape == b.shape<EOL>filtered = b.filter(lambda x: filter_half(x) < <NUM_LIT:0.5>, axis=(<NUM_LIT:0>, <NUM_LIT:1>))<EOL>res = filtered.toarray()<EOL>assert res.shape[<NUM_LIT:0>] <= b.shape[<NUM_LIT:0>]*b.shape[<NUM_LIT:1>]<EOL>assert res.shape[<NUM_LIT:1>] == b.shape[<NUM_LIT:2>]<EOL>
A set of tests for the filter operator

Parameters
----------
arr: `ndarray`
    A 3D ndarray used in the construction of `b` (used to check results)
b: `BoltArray`
    The BoltArray to be used for testing