Fixed #23768 -- Rewrote template tests as unit tests

unicode -> str (Python 3, first)