Raising a useful error and adding a speccific tests

Fixes #506
I will add a comment explaining what is going on in that code. I think this code is so simple to break the list comprehension, but I agree that it was not well documented.