Refactor and add tests for plugins.py

Improvement to the tests currently being run on ``plugins.py``

related #644 
The parenthesis were for the multiline condition.

The latter is right. I was thinking it may throw an exception but that is fine since it would go into the else statement anyway.