Refactor tests

Use assertIn and assertNotIn where possible.