Fixing integer assumptions for factorial

This is related to #8723, but fixes a different bug - `factorial(n)` was assumed to be an integer (and therefore a real), even without the assumption of nonnegativity of `n`, which is wrong. This PR fixes that, fixes the relevant test, and adds a new test.

I've also made some minor PEP8 corrections.
Actually, now I see that in master it was only indented 3 spaces. It should either be 4 or 8 or together with parenthesis. With 4 it causes the PEP8 error.