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.
why this?