Skip to content
Myr

Basic tests for internationalized domain names.

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 49b69b5 · Browse files · 1 file+37 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+37 added−0 removed

  • tests:+37 added−0 removed

1 file+37 added−0 removed

modified:tests/test_requests.py+37 added
1886 unmodified lines
1887 from requests.packages import idna18881889 with pytest.raises(ImportError):1890 from requests.packages import webbrowser189118921893class TestPreparingURLs(object):1894 @pytest.mark.parametrize(1895 'url,expected',1896 (1897 ('http://google.com', 'http://google.com/'),1898 (u'http://ジェーピーニック.jp', u'http://xn--hckqz9bzb1cyrb.jp/'),1899 (1900 u'http://ジェーピーニック.jp'.encode('utf-8'),1901 u'http://xn--hckqz9bzb1cyrb.jp/'1902 ),1903 (u'http://straße.de/straße', u'http://xn--strae-oqa.de/stra%C3%9Fe'),1904 (1905 u'http://straße.de/straße'.encode('utf-8'),1906 u'http://xn--strae-oqa.de/stra%C3%9Fe'1907 ),1908 )1909 )1910 def test_preparing_url(self, url, expected):1911 r = requests.Request(url=url)1912 p = r.prepare()1913 assert p.url == expected19141915 @pytest.mark.parametrize(1916 'url',1917 (1918 b"http://*.google.com",1919 b"http://*",1920 u"http://*.google.com",1921 u"http://*",1922 )1923 )1924 def test_preparing_bad_url(self, url):1925 r = requests.Request(url=url)1926 with pytest.raises(requests.exceptions.InvalidURL):1927 r.prepare()