liormizr / s3path

s3path is a pathlib extension for AWS S3 Service
Apache License 2.0
207 stars 39 forks source link

fix: Fixes writelines method of S3KeyWritableFileObject #51

Closed Darkheir closed 3 years ago

Darkheir commented 3 years ago

To be compliant with the base writelines method the new line character should not be added.

From the documentation https://docs.python.org/2/library/stdtypes.html#file.writelines :

The name is intended to match readlines(); writelines() does not add line separators.

There was also an issue where the double call to _string_parser (once in writlines and then in write) was raising an error:

TypeError: a bytes-like object is required, not 'str'

See #52

liormizr commented 3 years ago

Hi @Darkheir looks like a good start Can we add an issue for tracking?

Darkheir commented 3 years ago

Hi @Darkheir looks like a good start Can we add an issue for tracking?

Done :-)

Also the test is failing because the readlines method is wrong. Once #50 is merged the test should pass.

I rewrote the test to not rely on the other PR