tdb2: split expand into functions and test separately.