accept None as the same as having passed no argument in file types #7349

This is for consistency with imitation file objects like StringIO and BytesIO.

This commit also adds a few tests, where they were lacking for concerned
methods.
9 files changed