Пример #1
0
 def assert_auth(url, *args, headers, **kwargs):
     assert headers["authorization"] == "Bearer foo"
     return http_head(url, *args, headers=headers, **kwargs)
Пример #2
0
def test_http_offline(tmp_path_factory):
    filename = tmp_path_factory.mktemp("data") / "file.html"
    with pytest.raises(OfflineModeIsEnabled):
        http_get("https://huggingface.co", temp_file=filename)
    with pytest.raises(OfflineModeIsEnabled):
        http_head("https://huggingface.co")
Пример #3
0
def test_offline_with_datasets_offline_mode_enabled():
    with offline(OfflineSimulationMode.HF_DATASETS_OFFLINE_SET_TO_1):
        with pytest.raises(ConnectionError):
            http_head("https://huggingface.co")