Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Temporary fix for unicode literal breaking test. #690

Merged
merged 1 commit into from

3 participants

@Lukasa
Collaborator

As discussed in #687.

I'm not really wild about this commit. The awkward if block mentioned in #687 is present here, which isn't lovely, as is the awkward dependence on sys.version_info. This also relies on the fact that the parser will only look for a method when it's called, not when it's parsed, which means that str.decode() won't throw AttributeErrors in Python 3.

This is butt-ugly, and if it had to live in the codebase for all time I would ask you not to actually pull it. If you're planning to only test against 3.3 when it's released, however, then it's probably ok.

If you (or anyone else) can think of a nicer way to use this split, by all means use it and don't accept this pull request. =D

@kennethreitz

Thanks :)

@kennethreitz kennethreitz merged commit da35675 into kennethreitz:develop
@travisbot

This pull request passes (merged f8076fe into bcf04d5).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 19, 2012
  1. @Lukasa
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 1 deletion.
  1. +8 −1 tests/test_requests.py
View
9 tests/test_requests.py
@@ -351,7 +351,14 @@ def test_POSTBIN_GET_POST_FILES_STRINGS(self):
post5 = post(url, files={'file': ('file.txt', 'more fdata')})
self.assertEqual(post5.status_code, 200)
- post6 = post(url, files={'fname.txt': '\xe9'})
+ # Dirty hack to tide us over until 3.3.
+ # TODO: Remove this hack when Python 3.3 is released.
+ if (sys.version_info[0] == 2):
+ fdata = '\xc3\xa9'.decode('utf-8')
+ else:
+ fdata = '\xe9'
+
+ post6 = post(url, files={'fname.txt': fdata})
self.assertEqual(post6.status_code, 200)
post7 = post(url, files={'fname.txt': 'fdata to verify'})
Something went wrong with that request. Please try again.