Revert "Some pyflakes fixes."
Before adoption: this commit came in with the history the project adopted, so no landing records it.
This reverts commit c71f48b5f1d989644e26b9004c2af7a6f27d4708. To please his BDFLness @kennethreitz ;)
authored by Ian Cordasco · committed by Ian Cordasco · parent 329af44 · Browse files · 1 file·+11 added−24 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+11 added−24 removed
- tests:+11 added−24 removed
Provenance
- Commit
a5d462e- Tree
b5bb7c3- Author
Ian Cordasco <graffatcolmingov@gmail.com>- Committer
Ian Cordasco <graffatcolmingov@gmail.com>- Parent
329af44
1 file changed+11 added−24 removed
modified:tests/test_requests.py+11 added-24 removed
50 unmodified lines51 # c = envoy.connect('httpbin %s' % (PORT))52 # time.sleep(1)53 _httpbin = True54 55-55 class TestBaseMixin(object):56 57 def assertCookieHas(self, cookie, **kwargs):58 """Assert that a cookie has various specified properties."""59 for attr, expected_value in kwargs.items():60 cookie_attr = getattr(cookie, attr)62- message = 'Failed comparison for %s: %s != %s' % (attr,63- cookie_attr, expected_value)61+ message = 'Failed comparison for %s: %s != %s' % (attr, cookie_attr, expected_value)62 self.assertEqual(cookie_attr, expected_value, message)63 66-64 class RequestsTestSuite(TestSetup, TestBaseMixin, unittest.TestCase):65 """Requests test cases."""66 67 def test_entry_points(self):57 unmodified lines125 126 def test_HTTP_200_OK_GET_WITH_MIXED_PARAMS(self):127 heads = {'User-agent': 'Mozilla/5.0'}128 132- r = get(httpbin('get') + '?test=true', params={'q': 'test'},133- headers=heads)129+ r = get(httpbin('get') + '?test=true', params={'q': 'test'}, headers=heads)130 self.assertEqual(r.status_code, 200)131 132 # def test_unicode_headers(self):133 # # Simply calling requests with a unicode instance should simply work636 unmodified lines770 c = json.loads(r.text).get('cookies')771 self.assertEqual(c, _c)772 773 # Have the server set a cookie.778- r = get(httpbin('cookies', 'set', 'k', 'v'), allow_redirects=True,779- session=s)774+ r = get(httpbin('cookies', 'set', 'k', 'v'), allow_redirects=True, session=s)775 c = json.loads(r.text).get('cookies')776 777 assert 'k' in c778 56 unmodified lines835 self.assertCookieHas(cookie, name='a-cookie', value='cookie-value')836 837 def test_unpickled_session_requests(self):838 s = requests.session()844- r = get(httpbin('cookies', 'set', 'k', 'v'), allow_redirects=True,845- session=s)839+ r = get(httpbin('cookies', 'set', 'k', 'v'), allow_redirects=True, session=s)840 c = json.loads(r.text).get('cookies')841 assert 'k' in c842 843 ds = pickle.loads(pickle.dumps(s))133 unmodified lines977 s = requests.session()978 s.config['danger_mode'] = True979 s.get(httpbin('redirect', '4'))980 981+982 def test_empty_response(self):983 r = requests.get(httpbin('status', '404'))984 r.text985 986 def test_max_redirects(self):992- """Test the max_redirects config variable, normally and under993- safe_mode.994- """987+ """Test the max_redirects config variable, normally and under safe_mode."""988 def unsafe_callable():996- requests.get(httpbin('redirect', '3'),997- config=dict(max_redirects=2))998- self.assertRaises(requests.exceptions.TooManyRedirects,999- unsafe_callable)989+ requests.get(httpbin('redirect', '3'), config=dict(max_redirects=2))990+ self.assertRaises(requests.exceptions.TooManyRedirects, unsafe_callable)991 992 # add safe mode1002- response = requests.get(httpbin('redirect', '3'),1003- config=dict(safe_mode=True, max_redirects=2))993+ response = requests.get(httpbin('redirect', '3'), config=dict(safe_mode=True, max_redirects=2))994 self.assertTrue(response.content is None)1005- self.assertTrue(isinstance(response.error,1006- requests.exceptions.TooManyRedirects))995+ self.assertTrue(isinstance(response.error, requests.exceptions.TooManyRedirects))996 997 def test_connection_keepalive_and_close(self):1009- """Test that we send 'Connection: close' when keep_alive is1010- disabled.1011- """998+ """Test that we send 'Connection: close' when keep_alive is disabled."""999 # keep-alive should be on by default1000 r1 = requests.get(httpbin('get'))1001 # XXX due to proxying issues, test the header sent back by httpbin, rather than1002 # the header reported in its message body. See kennethreitz/httpbin#46110 unmodified lines