← Về thư mục
scripts/test_semantic_scholar_client.py
- _mock_response · function · L27-L34 — def _mock_response(payload: dict) -> MagicMock
- _mock_urlopen_returning · function · L37-L39 — def _mock_urlopen_returning(payload: dict) -> MagicMock
- DoiLookupTest · class · L42-L160 — class DoiLookupTest(unittest.TestCase)
- test_doi_match_with_matching_title · method · L43-L52 — def test_doi_match_with_matching_title(self) -> None
- test_doi_lookup_quotes_doi_path_segment · method · L54-L75 — def test_doi_lookup_quotes_doi_path_segment(self) -> None
- mock_urlopen · function · L58-L63 — def mock_urlopen(req, args, *kwargs)
- test_rejects_non_s2_api_url_before_urlopen · method · L77-L85 — def test_rejects_non_s2_api_url_before_urlopen(self) -> None
- test_rejects_wrong_s2_host_before_urlopen · method · L87-L94 — def test_rejects_wrong_s2_host_before_urlopen(self) -> None
- test_doi_404_falls_back_to_title_search · method · L96-L120 — def test_doi_404_falls_back_to_title_search(self) -> None
- test_doi_title_mismatch_falls_back_to_title_search · method · L122-L147 — def test_doi_title_mismatch_falls_back_to_title_search(self) -> None
- test_doi_404_and_title_404_returns_no_match · method · L149-L160 — def test_doi_404_and_title_404_returns_no_match(self) -> None
- TitleSearchTest · class · L163-L196 — class TitleSearchTest(unittest.TestCase)
- test_title_search_above_threshold_matches · method · L164-L175 — def test_title_search_above_threshold_matches(self) -> None
- test_title_search_below_threshold_no_match · method · L177-L188 — def test_title_search_below_threshold_no_match(self) -> None
- test_empty_results_no_match · method · L190-L196 — def test_empty_results_no_match(self) -> None
- FailureHandlingTest · class · L199-L254 — class FailureHandlingTest(unittest.TestCase)
- _raise_http · method · L200-L201 — def _raise_http(self, code: int)
- test_429_backoff_then_recover · method · L203-L225 — def test_429_backoff_then_recover(self) -> None
- test_429_after_max_retries_raises_unavailable · method · L227-L233 — def test_429_after_max_retries_raises_unavailable(self) -> None
- test_5xx_raises_unavailable · method · L235-L240 — def test_5xx_raises_unavailable(self) -> None
- test_404_means_no_match_not_unavailable · method · L242-L247 — def test_404_means_no_match_not_unavailable(self) -> None
- test_network_error_raises_unavailable · method · L249-L254 — def test_network_error_raises_unavailable(self) -> None
- TitleNormalizationTest · class · L257-L279 — class TitleNormalizationTest(unittest.TestCase)
- test_acronym_punctuation_clears_threshold · method · L261-L265 — def test_acronym_punctuation_clears_threshold(self) -> None
- test_punctuation_stripped_before_similarity · method · L267-L275 — def test_punctuation_stripped_before_similarity(self) -> None
- test_title_normalize_collapses_whitespace · method · L277-L279 — def test_title_normalize_collapses_whitespace(self) -> None
- ResponseReadTimeoutTest · class · L282-L306 — class ResponseReadTimeoutTest(unittest.TestCase)
- test_response_read_oserror_raises_unavailable · method · L288-L296 — def test_response_read_oserror_raises_unavailable(self) -> None
- test_response_read_timeout_error_raises_unavailable · method · L298-L306 — def test_response_read_timeout_error_raises_unavailable(self) -> None
- RateLimitThrottleTest · class · L309-L455 — class RateLimitThrottleTest(unittest.TestCase)
- _good_resp · method · L314-L315 — def _good_resp(self, payload: dict) -> MagicMock
- test_first_request_does_not_sleep · method · L317-L332 — def test_first_request_does_not_sleep(self) -> None
- test_back_to_back_calls_throttle_to_one_req_per_second · method · L334-L357 — def test_back_to_back_calls_throttle_to_one_req_per_second(self) -> None
- test_back_to_back_calls_past_interval_do_not_sleep · method · L359-L378 — def test_back_to_back_calls_past_interval_do_not_sleep(self) -> None
- test_api_key_lowers_interval_to_authenticated_tier · method · L380-L398 — def test_api_key_lowers_interval_to_authenticated_tier(self) -> None
- test_429_retry_refreshes_throttle_anchor · method · L400-L437 — def test_429_retry_refreshes_throttle_anchor(self) -> None
- urlopen_side · function · L420-L426 — def urlopen_side(args, *kwargs)
- test_explicit_min_interval_override · method · L439-L455 — def test_explicit_min_interval_override(self) -> None
- OutageLatchTest · class · L458-L539 — class OutageLatchTest(unittest.TestCase)
- test_url_error_latches_client_unavailable · method · L464-L480 — def test_url_error_latches_client_unavailable(self) -> None
- test_reset_outage_latch_restores_normal_behavior · method · L482-L503 — def test_reset_outage_latch_restores_normal_behavior(self) -> None
- test_response_read_oserror_also_latches · method · L505-L524 — def test_response_read_oserror_also_latches(self) -> None
- test_http_error_does_not_latch · method · L526-L539 — def test_http_error_does_not_latch(self) -> None
- CLIWiringTest · class · L542-L550 — class CLIWiringTest(unittest.TestCase)
- test_build_default_ss_client_returns_real_client · method · L547-L550 — def test_build_default_ss_client_returns_real_client(self) -> None