add a check that byte url is not accepted in http.Response on py3

This commit is contained in:
Konstantin Lopuhin 2016-01-15 13:27:28 +03:00
parent 99f1f2ad1d
commit 96fcf4cea4
1 changed files with 2 additions and 0 deletions

View File

@ -17,6 +17,8 @@ class BaseResponseTest(unittest.TestCase):
# Response requires url in the consturctor
self.assertRaises(Exception, self.response_class)
self.assertTrue(isinstance(self.response_class('http://example.com/'), self.response_class))
if not six.PY2:
self.assertRaises(TypeError, self.response_class, b"http://example.com")
# body can be str or None
self.assertTrue(isinstance(self.response_class('http://example.com/', body=b''), self.response_class))
self.assertTrue(isinstance(self.response_class('http://example.com/', body=b'body'), self.response_class))