Fixed #23768 -- Rewrote template tests as unit tests

I'd omit the blank line after the docstring as you've done in most places.