Stylistic improvements

Test assertions should be positive
Deduplicate test code
Make test deal gracefully with empty list