Tests and re-organization in test_types.py.

This commit marks the completion of my first round of major changes to
types.py. Aside from various bug fixes, the major functional difference
is that numpy is now assumed to be available, and all numeric array types
are automatically unflattened to either ndarray or l.u.ValueArray.