The code that you proposed does its job. But there's no unittest for it, nor we ever needed one. ;)