diff options
author | coletdjnz <coletdjnz@protonmail.com> | 2023-07-09 13:23:02 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2023-07-15 16:18:35 +0530 |
commit | 3d2623a898196640f7cc0fc8b70118ff19e6925d (patch) | |
tree | a0dc9fe53959ca673294902f7a553f55706cc5f3 /test/test_networking.py | |
parent | 227bf1a33be7b89cd7d44ad046844c4ccba104f4 (diff) | |
download | hypervideo-pre-3d2623a898196640f7cc0fc8b70118ff19e6925d.tar.lz hypervideo-pre-3d2623a898196640f7cc0fc8b70118ff19e6925d.tar.xz hypervideo-pre-3d2623a898196640f7cc0fc8b70118ff19e6925d.zip |
[compat, networking] Deprecate old functions (#2861)
Authored by: coletdjnz, pukkandan
Diffstat (limited to 'test/test_networking.py')
-rw-r--r-- | test/test_networking.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/test/test_networking.py b/test/test_networking.py index 147a4ff49..b60ed283b 100644 --- a/test/test_networking.py +++ b/test/test_networking.py @@ -1057,14 +1057,15 @@ class TestYoutubeDLNetworking: urllib_req = urllib.request.Request('http://foo.bar', data=b'test', method='PUT', headers={'X-Test': '1'}) urllib_req.add_unredirected_header('Cookie', 'bob=bob') urllib_req.timeout = 2 - - req = ydl.urlopen(urllib_req).request - assert req.url == urllib_req.get_full_url() - assert req.data == urllib_req.data - assert req.method == urllib_req.get_method() - assert 'X-Test' in req.headers - assert 'Cookie' in req.headers - assert req.extensions.get('timeout') == 2 + with warnings.catch_warnings(): + warnings.simplefilter('ignore', category=DeprecationWarning) + req = ydl.urlopen(urllib_req).request + assert req.url == urllib_req.get_full_url() + assert req.data == urllib_req.data + assert req.method == urllib_req.get_method() + assert 'X-Test' in req.headers + assert 'Cookie' in req.headers + assert req.extensions.get('timeout') == 2 with pytest.raises(AssertionError): ydl.urlopen(None) @@ -1362,7 +1363,9 @@ class TestResponse: def test_compat(self): res = Response(io.BytesIO(b''), url='test://', status=404, headers={'test': 'test'}) - assert res.code == res.getcode() == res.status - assert res.geturl() == res.url - assert res.info() is res.headers - assert res.getheader('test') == res.get_header('test') + with warnings.catch_warnings(): + warnings.simplefilter('ignore', category=DeprecationWarning) + assert res.code == res.getcode() == res.status + assert res.geturl() == res.url + assert res.info() is res.headers + assert res.getheader('test') == res.get_header('test') |