Add tests for invalid values and __toString().

Refs #3429