repositori / bagas / requests

requests public ready

https://github.com/psf/requests commit 3c7baaa 48 berkas · 374 potongan 2026-11-21T15:17:50Z
48berkas
36berkas python
374potongan
python 36 markdown 5 yaml 2 text 2 toml 1 css 1 html 1
tests/test_help.pypython 27 baris ditampilkan
1
from unittest import mock
2
3
from requests.help import info
4
5
6
def test_system_ssl():
7
"""Verify we're actually setting system_ssl when it should be available."""
8
assert info()["system_ssl"]["version"] != ""
9
10
11
class VersionedPackage:
12
def __init__(self, version):
13
self.__version__ = version
14
15
16
def test_idna_without_version_attribute():
17
"""Older versions of IDNA don't provide a __version__ attribute, verify
18
that if we have such a package, we don't blow up.
19
"""
20
with mock.patch("requests.help.idna", new=None):
21
assert info()["idna"] == {"version": ""}
22
23
24
def test_idna_with_version_attribute():
25
"""Verify we're actually setting idna version when it should be available."""
26
with mock.patch("requests.help.idna", new=VersionedPackage("2.6")):
27
assert info()["idna"] == {"version": "2.6"}