Skip to content

Add integration test for Unicode filenames.#3215

Merged
lukesneeringer merged 3 commits intogoogleapis:masterfrom
lukesneeringer:storage-unicode-filenames
Mar 28, 2017
Merged

Add integration test for Unicode filenames.#3215
lukesneeringer merged 3 commits intogoogleapis:masterfrom
lukesneeringer:storage-unicode-filenames

Conversation

@lukesneeringer
Copy link
Copy Markdown
Contributor

This is a port of googleapis/google-cloud-dotnet#933.

This also exposes the fact that Python 2 cannot handle some Unicode in URLs at all, because urllib.quote raises KeyError (wha....?) if you use Unicode. That is an issue with the Python standard library, however.

This is a port of googleapis/google-cloud-dotnet#933.

This also exposes the fact that Python 2 cannot handle some Unicode
in URLs at all, because urllib.quote raises KeyError (wha....?)
if you use Unicode.

That is an issue with the Python standard library, however.
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 27, 2017
@lukesneeringer lukesneeringer requested a review from dhermes March 27, 2017 18:07
@lukesneeringer lukesneeringer self-assigned this Mar 27, 2017
Comment thread storage/tests/system.py Outdated


class TestUnicode(unittest.TestCase):
@unittest.skipIf(six.PY2, 'Unicode URLs only work on Python 3.')

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@dhermes
Copy link
Copy Markdown
Contributor

dhermes commented Mar 28, 2017

LGTM

@lukesneeringer What is your feeling on usage of encode / decode instead of using google.cloud._helpers._to_bytes / _bytes_to_unicode?

@lukesneeringer
Copy link
Copy Markdown
Contributor Author

I would prefer use .encode and .decode when you know what you have (as is the case here), and helper functions when you do not know what you have. When possible, I prefer using helper functions in six versus custom baked ones. (I am pretty sure that ._to_bytes covers a case that six does not.)

@lukesneeringer lukesneeringer merged commit 761f2c6 into googleapis:master Mar 28, 2017
@lukesneeringer lukesneeringer deleted the storage-unicode-filenames branch March 28, 2017 16:05
@dhermes
Copy link
Copy Markdown
Contributor

dhermes commented Mar 28, 2017

👍 That is @jonparrott's take as well (so I suppose I should warm to that approach). I wasn't aware that six provided any support resembling those two helpers, what functions did you have in mind (provided by six)?

@lukesneeringer
Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants