Skip to content

Commit

Permalink
Merge branch 'master' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Stapleton Cordasco committed Jan 21, 2019
2 parents b49547f + 67a9ed4 commit 334be4d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -36,5 +36,5 @@ jobs:
python: '3.7'
dist: xenial
- stage: coverage
python: 3.6
python: '3.6'
script: codecov
2 changes: 1 addition & 1 deletion Makefile
@@ -1,7 +1,7 @@
.PHONY: docs
init:
pip install pipenv --upgrade
pipenv install --dev --skip-lock
pipenv install --dev
test:
# This runs all of the tests, on both Python 2 and Python 3.
detox
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Expand Up @@ -4,7 +4,7 @@ verify_ssl = true
name = "pypi"

[dev-packages]
pytest = ">=2.8.0"
pytest = ">=2.8.0,<4.1"
codecov = "*"
pytest-httpbin = ">=0.0.7"
pytest-mock = "*"
Expand Down
11 changes: 10 additions & 1 deletion tests/test_requests.py
Expand Up @@ -9,6 +9,7 @@
import collections
import contextlib
import warnings
import re

import io
import requests
Expand Down Expand Up @@ -2418,9 +2419,17 @@ class TestPreparingURLs(object):
)
)
def test_preparing_url(self, url, expected):

def normalize_percent_encode(x):
# Helper function that normalizes equivalent
# percent-encoded bytes before comparisons
for c in re.findall(r'%[a-fA-F0-9]{2}', x):
x = x.replace(c, c.upper())
return x

r = requests.Request('GET', url=url)
p = r.prepare()
assert p.url == expected
assert normalize_percent_encode(p.url) == expected

@pytest.mark.parametrize(
'url',
Expand Down

0 comments on commit 334be4d

Please sign in to comment.