Skip to content
Myr

Add test for Issue #423.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Cory Benfield · committed by Cory Benfield · parent bc7b2f9 · Browse files · 1 file+18 added−0 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+18 added−0 removed

  • tests:+18 added−0 removed

1 file+18 added−0 removed

modified:tests/test_requests.py+18 added
994 unmodified lines
995 # content should not have been prefetched, and iter_lines should succeed996 first_line = next(req.response.iter_lines())997 self.assertTrue(first_line.strip().decode('utf-8').startswith('{'))998999 def test_accept_objects_with_string_representations_as_urls(self):1000 """Test that URLs can be set to objects with string representations,1001 e.g. for use with furl."""1002 class URL():1003 def __unicode__(self):1004 # Can't have unicode literals in Python3, so avoid them.1005 # TODO: fixup when moving to Python 3.31006 if (sys.version_info[0] == 2):1007 return 'http://httpbin.org/get'.decode('utf-8')1008 else:1009 return 'http://httpbin.org/get'10101011 def __str__(self):1012 return 'http://httpbin.org/get'10131014 r = get(URL())1015 self.assertEqual(r.status_code, 200)10161017if __name__ == '__main__':1018 unittest.main()