Add some missing test coverage for handling values of type `long` and fi...

...x the implementation to accept either `int` or `long` on Python 2 (more closely matching the API implemented by the old C code).