repo_id
stringclasses
409 values
prefix
large_stringlengths
34
36.3k
target
large_stringlengths
1
498
assertion_type
stringclasses
31 values
difficulty
stringclasses
8 values
test_file
stringlengths
10
121
test_function
stringlengths
1
104
test_class
stringlengths
0
51
lineno
int32
2
11.3k
commit_idx
int32
datarobot/syftr
import tempfile from pathlib import Path from optuna.storages import RDBStorage from syftr.configuration import cfg from syftr.optimization import initialize_from_study from syftr.optuna_helper import get_completed_trials, get_pareto_df from syftr.studies import StudyConfig, get_subspace def test_study_initializatio...
len(df_dst)
assert
func_call
tests/functional/test_initialization.py
test_study_initialization
48
null
datarobot/syftr
import pytest from syftr.evaluation.evaluator_factory import json_parser_function @pytest.mark.parametrize( "data,expected_score,expected_reasoning", [ ( '{"score": 1e2, "reasoning": "Looks good."}', 1e2, "Looks good.", ), ( 'Reasoning mi...
expected_score
assert
variable
tests/unit/test_evaluator_factory.py
test_json_parser
106
null
datarobot/syftr
from pathlib import Path from syftr.configuration import cfg from syftr.helpers import get_baselines_from_trials from syftr.optuna_helper import ( get_completed_trials, get_flows_from_trials, get_pareto_flows, ) from syftr.studies import StudyConfig from syftr.tuner.qa_tuner import run from tests.check_tri...
sorted( pareto_flows_holdout, key=lambda d: sorted(d.items()) )
assert
func_call
tests/e2e/test_meta.py
test_separate_pareto_evaluation
76
null
datarobot/syftr
import datasets from syftr.storage import ( BrightHF, CragTask3HF, DRDocsHF, FinanceBenchHF, HotPotQAHF, MultiHopRAGHF, PartitionMap, PhantomWikiV001HF, PhantomWikiv050, SyntheticCragTask3HF, SyntheticFinanceBenchHF, SyntheticHotPotQAHF, ) def test_hotpotqa_hf(): # ...
6
assert
numeric_literal
tests/functional/test_hf_datasets.py
test_hotpotqa_hf
583
null
datarobot/syftr
from syftr.flows import Flow def test_token_counts_basic_generator(basic_flow_all_llms): response, duration, call_data = basic_flow_all_llms.generate( "What is the capital of France?" ) assert "paris" in str(response.text).lower() assert duration assert len(call_data) >=
1
assert
numeric_literal
tests/functional/flows/test_llm_token_counter.py
test_token_counts_basic_generator
10
null
datarobot/syftr
import pytest from optuna import TrialPruned from syftr.evaluation.evaluation import eval_dataset from syftr.pruning import CostPruner, ParetoPruner def test_eval_react_rag_agent_variance_mitigation_pruning( react_agent_flow, monkeypatch ): flow, study_config = react_agent_flow study_config.optimization.u...
True
assert
bool_literal
tests/functional/test_eval.py
test_eval_react_rag_agent_variance_mitigation_pruning
105
null
datarobot/syftr
import datasets from syftr.storage import ( BrightHF, CragTask3HF, DRDocsHF, FinanceBenchHF, HotPotQAHF, MultiHopRAGHF, PartitionMap, PhantomWikiV001HF, PhantomWikiv050, SyntheticCragTask3HF, SyntheticFinanceBenchHF, SyntheticHotPotQAHF, ) def test_drdocs_hf(): """D...
80
assert
numeric_literal
tests/functional/test_hf_datasets.py
test_drdocs_hf
41
null
datarobot/syftr
import math import typing as T from syftr.studies import ( FewShotRetriever, Hybrid, LLMConfig, QueryDecomposition, Reranker, Retriever, SearchSpace, Splitter, TopK, ) MINIMAL_LLMS: T.List[str] = ["llmA", "llmB"] def _get_minimal_splitter() -> Splitter: return Splitter( ...
expected_no_rag_card
assert
variable
tests/unit/test_cardinality.py
test_search_space_cardinality
177
null
datarobot/syftr
from pathlib import Path import optuna from syftr.configuration import cfg from syftr.studies import StudyConfig from tests.check_trials import check_trials_are_flawless from tests.e2e.optimization import run_and_test_optimization def test_agents_with_synthetic_crag(): study_config_file_name = "test-synthetic-cr...
len(df_all)
assert
func_call
tests/e2e/test_synthetic.py
test_agents_with_synthetic_crag
27
null
datarobot/syftr
from syftr.flows import Flow def test_token_counts_basic_generator(basic_flow_all_llms): response, duration, call_data = basic_flow_all_llms.generate( "What is the capital of France?" ) assert "paris" in
str(response.text).lower()
assert
func_call
tests/functional/flows/test_llm_token_counter.py
test_token_counts_basic_generator
8
null
datarobot/syftr
from pathlib import Path from syftr.configuration import cfg from syftr.helpers import get_baselines_from_trials from syftr.optuna_helper import ( get_completed_trials, get_flows_from_trials, get_pareto_flows, ) from syftr.studies import StudyConfig from syftr.tuner.qa_tuner import run from tests.check_tri...
len(pareto_flows_holdout)
assert
func_call
tests/e2e/test_meta.py
test_separate_pareto_replace_llm_evaluation
98
null
datarobot/syftr
import typing as T import pytest from llama_index.core.callbacks import CBEventType from syftr.flows import CritiqueAgentFlow, ReActAgentFlow, SubQuestionRAGFlow from syftr.logger import logger from syftr.studies import StudyConfig QA_PAIRS = { "hotpotqa_hf/dev": [ ("Were Scott Derrickson and Ed Wood bot...
1
assert
numeric_literal
tests/functional/flows/test_agentic_rag.py
test_subquestion_flow
68
null
datarobot/syftr
import pytest from tenacity import retry, stop_after_attempt, wait_exponential def bad_function(): raise _TestException() def test_custom_exception(): with pytest.raises(_TestException) as exc_info: bad_function() assert type(exc_info.value) is
_TestException
assert
variable
tests/unit/test_retry.py
test_custom_exception
21
null
datarobot/syftr
import pathlib from pathlib import Path from unittest.mock import MagicMock, patch import optuna import pandas as pd import pytest from syftr import api from syftr.configuration import cfg from syftr.studies import StudyConfig MOCK_STUDY = MagicMock(spec=optuna.Study) MOCK_STUDY.study_name = "example-dr-docs" TRIALS...
"Not enough points in the Pareto front to find a knee point."
assert
string_literal
tests/unit/test_api.py
test_knee_point
91
null
datarobot/syftr
from pathlib import Path from syftr.configuration import cfg from syftr.helpers import get_baselines_from_trials from syftr.optuna_helper import ( get_completed_trials, get_flows_from_trials, get_pareto_flows, ) from syftr.studies import StudyConfig from syftr.tuner.qa_tuner import run from tests.check_tri...
baselines_reused
assert
variable
tests/e2e/test_meta.py
test_reusing_a_study
30
null
datarobot/syftr
import pytest from optuna import TrialPruned from syftr.evaluation.evaluation import eval_dataset from syftr.pruning import CostPruner, ParetoPruner def test_eval_react_rag_agent_normal(react_agent_flow): flow, study_config = react_agent_flow study_config.optimization.use_pareto_pruner = False study_confi...
results["num_total"]
assert
complex_expr
tests/functional/test_eval.py
test_eval_react_rag_agent_normal
20
null
datarobot/syftr
import pathlib from pathlib import Path from unittest.mock import MagicMock, patch import optuna import pandas as pd import pytest from syftr import api from syftr.configuration import cfg from syftr.studies import StudyConfig MOCK_STUDY = MagicMock(spec=optuna.Study) MOCK_STUDY.study_name = "example-dr-docs" TRIALS...
study_config_path
assert
variable
tests/unit/test_api.py
test_init_no_path
37
null
datarobot/syftr
import typing as T import pytest from llama_index.core.callbacks import CBEventType from syftr.flows import RAGFlow from syftr.storage import SyftrQADataset from syftr.studies import StudyConfig def test_real_data_hybrid_flow( real_hybrid_flow: T.Tuple[RAGFlow, StudyConfig], llama_debug ): flow, _ = real_hyb...
0
assert
numeric_literal
tests/functional/flows/test_rag.py
test_real_data_hybrid_flow
57
null
datarobot/syftr
def test_basic_generator(basic_flow): response, duration, call_data = basic_flow.generate( "What is the capital of France?" ) assert "paris" in
str(response).lower()
assert
func_call
tests/functional/flows/test_generator.py
test_basic_generator
5
null
datarobot/syftr
import time from pathlib import Path import pytest from syftr import api from syftr.configuration import cfg EXAMPLE_STUDY_CONFIG_PATH = Path(cfg.paths.studies_dir / "example-dr-docs.yaml") NON_EXISTANT_STUDY_CONFIG_PATH = Path( cfg.paths.test_studies_dir / "hotpot-toy-non-existent.yaml" ) @pytest.mark.skip(rea...
api.SyftrStudyStatus.COMPLETED
assert
complex_expr
tests/integration/test_api_e2e.py
test_wait_for_completion
43
null
datarobot/syftr
import pytest from tenacity import retry, stop_after_attempt, wait_exponential def bad_function(): raise _TestException() def test_custom_exception(): with pytest.raises(
_TestException)
pytest.raises
variable
tests/unit/test_retry.py
test_custom_exception
19
null
datarobot/syftr
import typing as T import pytest from llama_index.core.callbacks import CBEventType from syftr.flows import CritiqueAgentFlow, ReActAgentFlow, SubQuestionRAGFlow from syftr.logger import logger from syftr.studies import StudyConfig QA_PAIRS = { "hotpotqa_hf/dev": [ ("Were Scott Derrickson and Ed Wood bot...
0
assert
numeric_literal
tests/functional/flows/test_agentic_rag.py
test_subquestion_flow
69
null
datarobot/syftr
import pytest from optuna import TrialPruned from syftr.evaluation.evaluation import eval_dataset from syftr.pruning import CostPruner, ParetoPruner def test_eval_react_rag_agent_bias_variance_mitigation(react_agent_flow): flow, study_config = react_agent_flow study_config.optimization.use_pareto_pruner = Fal...
AssertionError)
pytest.raises
variable
tests/functional/test_eval.py
test_eval_react_rag_agent_bias_variance_mitigation
67
null
datarobot/syftr
import logging import typing as T import pytest from syftr.embeddings.timeouts import EmbeddingPreemptiveTimeoutError from syftr.huggingface_helper import get_embedding_model from syftr.logger import logger from syftr.storage import FinanceBenchHF, PartitionMap from syftr.studies import StudyConfig def test_embeddin...
None
assert
none_literal
tests/functional/test_embedding_models.py
test_embedding_models
31
null
datarobot/syftr
import pytest from optuna import TrialPruned from syftr.evaluation.evaluation import eval_dataset from syftr.pruning import CostPruner, ParetoPruner def test_eval_react_rag_agent_variance_mitigation_timeout(react_agent_flow): flow, study_config = react_agent_flow study_config.optimization.use_pareto_pruner = ...
TrialPruned)
pytest.raises
variable
tests/functional/test_eval.py
test_eval_react_rag_agent_variance_mitigation_timeout
117
null
datarobot/syftr
from pathlib import Path from syftr.configuration import cfg from syftr.studies import StudyConfig from tests.check_trials import check_trials_are_flawless from tests.e2e.optimization import run_and_test_optimization PARAM_LIST = ["rag_mode"] def test_no_rag_optimization(): study_config_file = Path( cfg....
5
assert
numeric_literal
tests/e2e/test_no_rag.py
test_no_rag_optimization
36
null
datarobot/syftr
import logging import typing as T import pytest from syftr.embeddings.timeouts import EmbeddingPreemptiveTimeoutError from syftr.huggingface_helper import get_embedding_model from syftr.logger import logger from syftr.storage import FinanceBenchHF, PartitionMap from syftr.studies import StudyConfig def test_embeddin...
[True, False]
assert
collection
tests/functional/test_embedding_models.py
test_embedding_models
30
null
datarobot/syftr
import pytest from optuna import TrialPruned from syftr.evaluation.evaluation import eval_dataset from syftr.pruning import CostPruner, ParetoPruner def test_eval_react_rag_agent_normal(react_agent_flow): flow, study_config = react_agent_flow study_config.optimization.use_pareto_pruner = False study_confi...
0
assert
numeric_literal
tests/functional/test_eval.py
test_eval_react_rag_agent_normal
19
null
datarobot/syftr
from syftr.helpers import get_exception_report def test_get_exception_report(): generation_exceptions = [] try: eval("x === 3") # SyntaxError except Exception as e: generation_exceptions.append(e) try: "2" + 2 # TypeError except Exception as e: generation_excepti...
exception_message
assert
variable
tests/unit/test_report.py
test_get_exception_report
62
null
datarobot/syftr
import time from pathlib import Path import pytest from syftr import api from syftr.configuration import cfg EXAMPLE_STUDY_CONFIG_PATH = Path(cfg.paths.studies_dir / "example-dr-docs.yaml") NON_EXISTANT_STUDY_CONFIG_PATH = Path( cfg.paths.test_studies_dir / "hotpot-toy-non-existent.yaml" ) def test_get_study_ge...
api.SyftrUserAPIError)
pytest.raises
complex_expr
tests/integration/test_api_e2e.py
test_get_study_get_delete
74
null
evansd/whitenoise
from __future__ import annotations import contextlib import gzip import os import re import shutil import tempfile from unittest import mock import pytest from whitenoise.compress import Compressor from whitenoise.compress import main as compress_main COMPRESSIBLE_FILE = "application.css" TOO_SMALL_FILE = "too-smal...
re.compile("^$")
assert
func_call
tests/test_compress.py
test_with_falsey_extensions
70
null
evansd/whitenoise
from __future__ import annotations import shutil import tempfile from contextlib import closing from urllib.parse import urljoin, urlparse import pytest from django.conf import settings from django.contrib.staticfiles import finders, storage from django.core.management import call_command from django.core.wsgi import...
{"content-type"}
assert
collection
tests/test_django_whitenoise.py
test_whitenoise_file_response_has_only_one_header
202
null
evansd/whitenoise
from __future__ import annotations import shutil import tempfile from contextlib import closing from urllib.parse import urljoin, urlparse import pytest from django.conf import settings from django.contrib.staticfiles import finders, storage from django.core.management import call_command from django.core.wsgi import...
None
assert
none_literal
tests/test_django_whitenoise.py
test_no_content_disposition_header
136
null
evansd/whitenoise
from __future__ import annotations import contextlib import gzip import os import re import shutil import tempfile from unittest import mock import pytest from whitenoise.compress import Compressor from whitenoise.compress import main as compress_main COMPRESSIBLE_FILE = "application.css" TOO_SMALL_FILE = "too-smal...
"test"
assert
string_literal
tests/test_compress.py
test_custom_log
75
null
evansd/whitenoise
from __future__ import annotations import os import re import shutil import stat import sys import tempfile import warnings from contextlib import closing from urllib.parse import urljoin from wsgiref.headers import Headers from wsgiref.simple_server import demo_app import pytest from tests.utils import AppServer, F...
302
assert
numeric_literal
tests/test_whitenoise.py
test_index_file_path_redirected
242
null
evansd/whitenoise
from __future__ import annotations from whitenoise.media_types import MediaTypes def test_matched_extension(): result = MediaTypes().get_type("static/app.js") assert result ==
"text/javascript"
assert
string_literal
tests/test_media_types.py
test_matched_extension
18
null
evansd/whitenoise
from __future__ import annotations import contextlib import gzip import os import re import shutil import tempfile from unittest import mock import pytest from whitenoise.compress import Compressor from whitenoise.compress import main as compress_main COMPRESSIBLE_FILE = "application.css" TOO_SMALL_FILE = "too-smal...
ValueError)
pytest.raises
variable
tests/test_compress.py
test_main_error
92
null
evansd/whitenoise
from __future__ import annotations import os import re import shutil import stat import sys import tempfile import warnings from contextlib import closing from urllib.parse import urljoin from wsgiref.headers import Headers from wsgiref.simple_server import demo_app import pytest from tests.utils import AppServer, F...
405
assert
numeric_literal
tests/test_whitenoise.py
test_post_request_returns_405
213
null
evansd/whitenoise
from __future__ import annotations from whitenoise.string_utils import ensure_leading_trailing_slash class EnsureLeadingTrailingSlashTests: def test_contents(self): assert ensure_leading_trailing_slash("/foo/") ==
"/foo/"
assert
string_literal
tests/test_string_utils.py
test_contents
EnsureLeadingTrailingSlashTests
17
null
evansd/whitenoise
from __future__ import annotations import os import re import shutil import stat import sys import tempfile import warnings from contextlib import closing from urllib.parse import urljoin from wsgiref.headers import Headers from wsgiref.simple_server import demo_app import pytest from tests.utils import AppServer, F...
14
assert
numeric_literal
tests/test_whitenoise.py
test_file_size_matches_range_with_range_header
371
null
evansd/whitenoise
from __future__ import annotations import contextlib import gzip import os import re import shutil import tempfile from unittest import mock import pytest from whitenoise.compress import Compressor from whitenoise.compress import main as compress_main COMPRESSIBLE_FILE = "application.css" TOO_SMALL_FILE = "too-smal...
contents
assert
variable
tests/test_compress.py
test_compresses_file
46
null
evansd/whitenoise
from __future__ import annotations import shutil import tempfile from contextlib import closing from urllib.parse import urljoin, urlparse import pytest from django.conf import settings from django.contrib.staticfiles import finders, storage from django.core.management import call_command from django.core.wsgi import...
"gzip"
assert
string_literal
tests/test_django_whitenoise.py
test_get_gzip
94
null
evansd/whitenoise
from __future__ import annotations import shutil import tempfile from contextlib import closing from urllib.parse import urljoin, urlparse import pytest from django.conf import settings from django.contrib.staticfiles import finders, storage from django.core.management import call_command from django.core.wsgi import...
static_files.js_content
assert
complex_expr
tests/test_django_whitenoise.py
test_versioned_file_cached_forever
76
null
evansd/whitenoise
from __future__ import annotations import os import re import shutil import stat import sys import tempfile import warnings from contextlib import closing from urllib.parse import urljoin from wsgiref.headers import Headers from wsgiref.simple_server import demo_app import pytest from tests.utils import AppServer, F...
200
assert
numeric_literal
tests/test_whitenoise.py
test_modified
137
null
evansd/whitenoise
from __future__ import annotations import os import re import shutil import stat import sys import tempfile import warnings from contextlib import closing from urllib.parse import urljoin from wsgiref.headers import Headers from wsgiref.simple_server import demo_app import pytest from tests.utils import AppServer, F...
416
assert
numeric_literal
tests/test_whitenoise.py
test_out_of_range_error
282
null
evansd/whitenoise
from __future__ import annotations from whitenoise.string_utils import ensure_leading_trailing_slash class EnsureLeadingTrailingSlashTests: def test_none(self): assert ensure_leading_trailing_slash(None) ==
"/"
assert
string_literal
tests/test_string_utils.py
test_none
EnsureLeadingTrailingSlashTests
8
null
evansd/whitenoise
from __future__ import annotations import os import re import shutil import stat import sys import tempfile import warnings from contextlib import closing from urllib.parse import urljoin from wsgiref.headers import Headers from wsgiref.simple_server import demo_app import pytest from tests.utils import AppServer, F...
500
assert
numeric_literal
tests/test_whitenoise.py
test_no_error_on_very_long_filename
309
null
evansd/whitenoise
from __future__ import annotations import contextlib import gzip import os import re import shutil import tempfile from unittest import mock import pytest from whitenoise.compress import Compressor from whitenoise.compress import main as compress_main COMPRESSIBLE_FILE = "application.css" TOO_SMALL_FILE = "too-smal...
[]
assert
collection
tests/test_compress.py
test_compress
80
null
evansd/whitenoise
from __future__ import annotations from io import BytesIO from django.test import SimpleTestCase from whitenoise.responders import SlicedFile class SlicedFileTests(SimpleTestCase): def test_close_does_not_rerun_on_del(self): """ Regression test for the subtle close() behaviour of SlicedFile that...
1
assert
numeric_literal
tests/test_responders.py
test_close_does_not_rerun_on_del
SlicedFileTests
38
null
evansd/whitenoise
from __future__ import annotations import os import re import shutil import tempfile from posixpath import basename import pytest from django.conf import settings from django.contrib.staticfiles.storage import HashedFilesMixin, staticfiles_storage from django.core.management import call_command from django.test.utils...
remaining_files
assert
variable
tests/test_storage.py
test_unversioned_files_are_deleted
102
null
evansd/whitenoise
from __future__ import annotations from whitenoise.media_types import MediaTypes def test_unmatched_extension(): result = MediaTypes().get_type("static/app.example-unmatched") assert result ==
"application/octet-stream"
assert
string_literal
tests/test_media_types.py
test_unmatched_extension
23
null
evansd/whitenoise
from __future__ import annotations import os import re import shutil import stat import sys import tempfile import warnings from contextlib import closing from urllib.parse import urljoin from wsgiref.headers import Headers from wsgiref.simple_server import demo_app import pytest from tests.utils import AppServer, F...
"*"
assert
string_literal
tests/test_whitenoise.py
test_response_has_allow_origin_header
196
null
evansd/whitenoise
from __future__ import annotations import os import re import shutil import stat import sys import tempfile import warnings from contextlib import closing from urllib.parse import urljoin from wsgiref.headers import Headers from wsgiref.simple_server import demo_app import pytest from tests.utils import AppServer, F...
304
assert
numeric_literal
tests/test_whitenoise.py
test_not_modified_exact
125
null
evansd/whitenoise
from __future__ import annotations import shutil import tempfile from contextlib import closing from urllib.parse import urljoin, urlparse import pytest from django.conf import settings from django.contrib.staticfiles import finders, storage from django.core.management import call_command from django.core.wsgi import...
root_files.robots_content
assert
complex_expr
tests/test_django_whitenoise.py
test_get_root_file
70
null
evansd/whitenoise
from __future__ import annotations import shutil import tempfile from contextlib import closing from urllib.parse import urljoin, urlparse import pytest from django.conf import settings from django.contrib.staticfiles import finders, storage from django.core.management import call_command from django.core.wsgi import...
"br"
assert
string_literal
tests/test_django_whitenoise.py
test_get_brotli
102
null
evansd/whitenoise
from __future__ import annotations import contextlib import gzip import os import re import shutil import tempfile from unittest import mock import pytest from whitenoise.compress import Compressor from whitenoise.compress import main as compress_main COMPRESSIBLE_FILE = "application.css" TOO_SMALL_FILE = "too-smal...
os.path.getmtime(gzip_path)
assert
func_call
tests/test_compress.py
test_mtime_is_preserved
60
null
evansd/whitenoise
from __future__ import annotations import shutil import tempfile from contextlib import closing from urllib.parse import urljoin, urlparse import pytest from django.conf import settings from django.contrib.staticfiles import finders, storage from django.core.management import call_command from django.core.wsgi import...
302
assert
numeric_literal
tests/test_django_whitenoise.py
test_index_file_path_redirected
179
null
evansd/whitenoise
from __future__ import annotations import os import re import shutil import stat import sys import tempfile import warnings from contextlib import closing from urllib.parse import urljoin from wsgiref.headers import Headers from wsgiref.simple_server import demo_app import pytest from tests.utils import AppServer, F...
"True"
assert
string_literal
tests/test_whitenoise.py
test_custom_headers
229
null
evansd/whitenoise
from __future__ import annotations import contextlib import gzip import os import re import shutil import tempfile from unittest import mock import pytest from whitenoise.compress import Compressor from whitenoise.compress import main as compress_main COMPRESSIBLE_FILE = "application.css" TOO_SMALL_FILE = "too-smal...
re.compile(r"\.(jpg)$", re.IGNORECASE)
assert
func_call
tests/test_compress.py
test_with_custom_extensions
65
null
evansd/whitenoise
from __future__ import annotations import os import re import shutil import stat import sys import tempfile import warnings from contextlib import closing from urllib.parse import urljoin from wsgiref.headers import Headers from wsgiref.simple_server import demo_app import pytest from tests.utils import AppServer, F...
None
assert
none_literal
tests/test_whitenoise.py
test_chunked_file_size_matches_range_with_range_header
379
null
evansd/whitenoise
from __future__ import annotations import os import re import shutil import tempfile from posixpath import basename import pytest from django.conf import settings from django.contrib.staticfiles.storage import HashedFilesMixin, staticfiles_storage from django.core.management import call_command from django.test.utils...
False
assert
bool_literal
tests/test_storage.py
test_manifest_strict_attribute_is_set
116
null
evansd/whitenoise
from __future__ import annotations import shutil import tempfile from contextlib import closing from urllib.parse import urljoin, urlparse import pytest from django.conf import settings from django.contrib.staticfiles import finders, storage from django.core.management import call_command from django.core.wsgi import...
"max-age=60, public"
assert
string_literal
tests/test_django_whitenoise.py
test_unversioned_file_not_cached_forever
87
null
evansd/whitenoise
from __future__ import annotations import os import re import shutil import stat import sys import tempfile import warnings from contextlib import closing from urllib.parse import urljoin from wsgiref.headers import Headers from wsgiref.simple_server import demo_app import pytest from tests.utils import AppServer, F...
"gzip"
assert
string_literal
tests/test_whitenoise.py
test_get_accept_gzip
112
null
evansd/whitenoise
from __future__ import annotations import os import re import shutil import stat import sys import tempfile import warnings from contextlib import closing from urllib.parse import urljoin from wsgiref.headers import Headers from wsgiref.simple_server import demo_app import pytest from tests.utils import AppServer, F...
1
assert
numeric_literal
tests/test_whitenoise.py
test_warn_about_missing_directories
294
null
evansd/whitenoise
from __future__ import annotations from whitenoise.string_utils import ensure_leading_trailing_slash class EnsureLeadingTrailingSlashTests: def test_leading(self): assert ensure_leading_trailing_slash("/foo") ==
"/foo"
assert
string_literal
tests/test_string_utils.py
test_leading
EnsureLeadingTrailingSlashTests
20
null
jazzband/django-rest-knox
from datetime import timedelta from django.contrib.auth import get_user_model from django.test import TestCase from django.utils import timezone from freezegun import freeze_time from knox.models import AuthToken from knox.settings import CONSTANTS, knox_settings class AuthTokenTests(TestCase): def setUp(self):...
instance.token_key.startswith(custom_prefix))
self.assertTrue
func_call
tests/test_models.py
test_token_with_custom_prefix
AuthTokenTests
87
null
jazzband/django-rest-knox
from unittest.mock import patch from django.test import TestCase from knox.crypto import create_token_string, hash_token, make_hex_compatible from knox.settings import knox_settings class CryptoUtilsTestCase(TestCase): def test_hash_token_with_valid_token(self): """ Verify hash output is correct...
128)
self.assertEqual
numeric_literal
tests/test_crypto.py
test_hash_token_with_valid_token
CryptoUtilsTestCase
57
null
jazzband/django-rest-knox
from datetime import timedelta from django.contrib.auth import get_user_model from django.test import TestCase from django.utils import timezone from freezegun import freeze_time from knox.models import AuthToken from knox.settings import CONSTANTS, knox_settings class AuthTokenTests(TestCase): def setUp(self):...
token2.digest)
self.assertNotEqual
complex_expr
tests/test_models.py
test_multiple_tokens_for_user
AuthTokenTests
75
null
jazzband/django-rest-knox
import hashlib from datetime import timedelta from unittest import mock from django.core.signals import setting_changed from django.test import override_settings from knox.settings import ( CONSTANTS, IMPORT_STRINGS, knox_settings, reload_api_settings, ) class TestKnoxSettings: @override_settings(REST_KNOX=...
hashlib.md5
assert
complex_expr
tests/test_settings.py
test_hash_algorithm_import
TestKnoxSettings
88
null
jazzband/django-rest-knox
from datetime import timedelta from django.contrib.auth import get_user_model from django.test import TestCase from django.utils import timezone from freezegun import freeze_time from knox.models import AuthToken from knox.settings import CONSTANTS, knox_settings class AuthTokenTests(TestCase): def setUp(self):...
CONSTANTS.TOKEN_KEY_LENGTH)
self.assertEqual
complex_expr
tests/test_models.py
test_token_creation
AuthTokenTests
33
null
jazzband/django-rest-knox
from datetime import timedelta from django.contrib.auth import get_user_model from django.test import TestCase from django.utils import timezone from freezegun import freeze_time from knox.models import AuthToken from knox.settings import CONSTANTS, knox_settings class AuthTokenTests(TestCase): def setUp(self):...
expected_str)
self.assertEqual
variable
tests/test_models.py
test_token_string_representation
AuthTokenTests
65
null
jazzband/django-rest-knox
import hashlib from datetime import timedelta from unittest import mock from django.core.signals import setting_changed from django.test import override_settings from knox.settings import ( CONSTANTS, IMPORT_STRINGS, knox_settings, reload_api_settings, ) class TestKnoxSettings: def test_token_prefix_length_...
ValueError)
self.assertRaises
variable
tests/test_settings.py
test_token_prefix_length_validation
TestKnoxSettings
68
null
jazzband/django-rest-knox
import hashlib from datetime import timedelta from unittest import mock from django.core.signals import setting_changed from django.test import override_settings from knox.settings import ( CONSTANTS, IMPORT_STRINGS, knox_settings, reload_api_settings, ) class TestKnoxSettings: def test_reload_api_settings(...
timedelta(hours=2)
assert
func_call
tests/test_settings.py
test_reload_api_settings
TestKnoxSettings
61
null
jazzband/django-rest-knox
from unittest.mock import patch from django.test import TestCase from knox.crypto import create_token_string, hash_token, make_hex_compatible from knox.settings import knox_settings class CryptoUtilsTestCase(TestCase): def test_make_hex_compatible_with_valid_input(self): """ Ensure standard stri...
expected)
self.assertEqual
variable
tests/test_crypto.py
test_make_hex_compatible_with_valid_input
CryptoUtilsTestCase
30
null
jazzband/django-rest-knox
from unittest.mock import patch from django.test import TestCase from knox.crypto import create_token_string, hash_token, make_hex_compatible from knox.settings import knox_settings class CryptoUtilsTestCase(TestCase): def test_hash_token_with_valid_token(self): """ Verify hash output is correct...
str)
self.assertIsInstance
variable
tests/test_crypto.py
test_hash_token_with_valid_token
CryptoUtilsTestCase
56
null
jazzband/django-rest-knox
from unittest.mock import patch from django.test import TestCase from knox.crypto import create_token_string, hash_token, make_hex_compatible from knox.settings import knox_settings class CryptoUtilsTestCase(TestCase): def test_make_hex_compatible_with_empty_string(self): """ Verify empty string...
b'')
self.assertEqual
string_literal
tests/test_crypto.py
test_make_hex_compatible_with_empty_string
CryptoUtilsTestCase
38
null
jazzband/django-rest-knox
from unittest.mock import patch from django.test import TestCase from knox.crypto import create_token_string, hash_token, make_hex_compatible from knox.settings import knox_settings class CryptoUtilsTestCase(TestCase): def test_create_token_string(self): """ Verify token string creation has corre...
expected_length)
self.assertEqual
variable
tests/test_crypto.py
test_create_token_string
CryptoUtilsTestCase
18
null
jazzband/django-rest-knox
import hashlib from datetime import timedelta from unittest import mock from django.core.signals import setting_changed from django.test import override_settings from knox.settings import ( CONSTANTS, IMPORT_STRINGS, knox_settings, reload_api_settings, ) class TestKnoxSettings: def test_constants_immutabili...
Exception)
self.assertRaises
variable
tests/test_settings.py
test_constants_immutability
TestKnoxSettings
33
null
jazzband/django-rest-knox
from datetime import timedelta from django.contrib.auth import get_user_model from django.test import TestCase from django.utils import timezone from freezegun import freeze_time from knox.models import AuthToken from knox.settings import CONSTANTS, knox_settings class AuthTokenTests(TestCase): def setUp(self):...
token_creation + timedelta(hours=10))
self.assertEqual
func_call
tests/test_models.py
test_token_creation
AuthTokenTests
38
null
jazzband/django-rest-knox
import hashlib from datetime import timedelta from unittest import mock from django.core.signals import setting_changed from django.test import override_settings from knox.settings import ( CONSTANTS, IMPORT_STRINGS, knox_settings, reload_api_settings, ) class TestKnoxSettings: @override_settings(REST_KNOX={...
timedelta(hours=5)
assert
func_call
tests/test_settings.py
test_override_settings
TestKnoxSettings
24
null
jazzband/django-rest-knox
import base64 from datetime import datetime, timedelta from importlib import reload from django.contrib.auth import get_user_model from django.test import override_settings from django.urls import reverse from freezegun import freeze_time from rest_framework.exceptions import AuthenticationFailed from rest_framework.s...
2)
self.assertEqual
numeric_literal
tests/test_views.py
test_logout_deletes_keys
LogoutViewsTestCase
159
null
jazzband/django-rest-knox
from datetime import timedelta from django.contrib.auth import get_user_model from django.test import TestCase from django.utils import timezone from freezegun import freeze_time from knox.models import AuthToken from knox.settings import CONSTANTS, knox_settings class AuthTokenTests(TestCase): def setUp(self):...
(instance.expiry - before_creation - expiry_time).total_seconds() < 1)
self.assertTrue
collection
tests/test_models.py
test_token_creation_with_expiry
AuthTokenTests
55
null
jazzband/django-rest-knox
from datetime import timedelta from django.contrib.auth import get_user_model from django.test import TestCase from django.utils import timezone from freezegun import freeze_time from knox.models import AuthToken from knox.settings import CONSTANTS, knox_settings class AuthTokenTests(TestCase): def setUp(self):...
self.user)
self.assertEqual
complex_expr
tests/test_models.py
test_token_creation
AuthTokenTests
37
null
jazzband/django-rest-knox
from unittest.mock import patch from django.test import TestCase from knox.crypto import create_token_string, hash_token, make_hex_compatible from knox.settings import knox_settings class CryptoUtilsTestCase(TestCase): def test_create_token_string(self): """ Verify token string creation has corre...
all(c in hex_chars for c in token.lower()))
self.assertTrue
func_call
tests/test_crypto.py
test_create_token_string
CryptoUtilsTestCase
20
null
jazzband/django-rest-knox
from datetime import timedelta from django.contrib.auth import get_user_model from django.test import TestCase from django.utils import timezone from freezegun import freeze_time from knox.models import AuthToken from knox.settings import CONSTANTS, knox_settings class AuthTokenTests(TestCase): def setUp(self):...
token)
self.assertIsNotNone
variable
tests/test_models.py
test_token_creation
AuthTokenTests
31
null
jazzband/django-rest-knox
import base64 from datetime import datetime, timedelta from importlib import reload from django.contrib.auth import get_user_model from django.test import override_settings from django.urls import reverse from freezegun import freeze_time from rest_framework.exceptions import AuthenticationFailed from rest_framework.s...
10)
self.assertEqual
numeric_literal
tests/test_views.py
test_logout_all_deletes_keys
LogoutViewsTestCase
171
null
jazzband/django-rest-knox
from unittest.mock import patch from django.test import TestCase from knox.crypto import create_token_string, hash_token, make_hex_compatible from knox.settings import knox_settings class CryptoUtilsTestCase(TestCase): def test_hash_token_with_valid_token(self): """ Verify hash output is correct...
all(c in hex_chars for c in result.lower()))
self.assertTrue
func_call
tests/test_crypto.py
test_hash_token_with_valid_token
CryptoUtilsTestCase
59
null
jazzband/django-rest-knox
import hashlib from datetime import timedelta from unittest import mock from django.core.signals import setting_changed from django.test import override_settings from knox.settings import ( CONSTANTS, IMPORT_STRINGS, knox_settings, reload_api_settings, ) class TestKnoxSettings: def test_constants_values(sel...
10
assert
numeric_literal
tests/test_settings.py
test_constants_values
TestKnoxSettings
45
null
jazzband/django-rest-knox
import base64 from datetime import datetime, timedelta from importlib import reload from django.contrib.auth import get_user_model from django.test import override_settings from django.urls import reverse from freezegun import freeze_time from rest_framework.exceptions import AuthenticationFailed from rest_framework.s...
5)
self.assertEqual
numeric_literal
tests/test_views.py
test_login_creates_keys
LoginViewTestCase
92
null
jazzband/django-rest-knox
import base64 from datetime import datetime, timedelta from importlib import reload from django.contrib.auth import get_user_model from django.test import override_settings from django.urls import reverse from freezegun import freeze_time from rest_framework.exceptions import AuthenticationFailed from rest_framework.s...
0)
self.assertEqual
numeric_literal
tests/test_views.py
test_login_creates_keys
LoginViewTestCase
85
null
jazzband/django-rest-knox
import hashlib from datetime import timedelta from unittest import mock from django.core.signals import setting_changed from django.test import override_settings from knox.settings import ( CONSTANTS, IMPORT_STRINGS, knox_settings, reload_api_settings, ) class TestKnoxSettings: def test_setting_changed_sign...
timedelta(hours=3)
assert
func_call
tests/test_settings.py
test_setting_changed_signal
TestKnoxSettings
104
null
jazzband/django-rest-knox
from datetime import timedelta from django.contrib.auth import get_user_model from django.test import TestCase from django.utils import timezone from freezegun import freeze_time from knox.models import AuthToken from knox.settings import CONSTANTS, knox_settings class AuthTokenTests(TestCase): def setUp(self):...
before_creation < instance.expiry)
self.assertTrue
complex_expr
tests/test_models.py
test_token_creation_with_expiry
AuthTokenTests
54
null
jazzband/django-rest-knox
import hashlib from datetime import timedelta from unittest import mock from django.core.signals import setting_changed from django.test import override_settings from knox.settings import ( CONSTANTS, IMPORT_STRINGS, knox_settings, reload_api_settings, ) class TestKnoxSettings: def test_import_strings(self)...
IMPORT_STRINGS
assert
variable
tests/test_settings.py
test_import_strings
TestKnoxSettings
78
null
jazzband/django-rest-knox
import hashlib from datetime import timedelta from unittest import mock from django.core.signals import setting_changed from django.test import override_settings from knox.settings import ( CONSTANTS, IMPORT_STRINGS, knox_settings, reload_api_settings, ) class TestKnoxSettings: @mock.patch('django.conf.sett...
custom_model
assert
variable
tests/test_settings.py
test_custom_token_model
TestKnoxSettings
120
null
jazzband/django-rest-knox
import hashlib from datetime import timedelta from unittest import mock from django.core.signals import setting_changed from django.test import override_settings from knox.settings import ( CONSTANTS, IMPORT_STRINGS, knox_settings, reload_api_settings, ) class TestKnoxSettings: def test_reload_api_settings(...
'Bearer'
assert
string_literal
tests/test_settings.py
test_reload_api_settings
TestKnoxSettings
62
null
jazzband/django-rest-knox
import hashlib from datetime import timedelta from unittest import mock from django.core.signals import setting_changed from django.test import override_settings from knox.settings import ( CONSTANTS, IMPORT_STRINGS, knox_settings, reload_api_settings, ) class TestKnoxSettings: def test_constants_values(sel...
128
assert
numeric_literal
tests/test_settings.py
test_constants_values
TestKnoxSettings
44
null
jazzband/django-rest-knox
from datetime import timedelta from django.contrib.auth import get_user_model from django.test import TestCase from django.utils import timezone from freezegun import freeze_time from knox.models import AuthToken from knox.settings import CONSTANTS, knox_settings class AuthTokenTests(TestCase): def setUp(self):...
token.startswith(custom_prefix))
self.assertTrue
func_call
tests/test_models.py
test_token_with_custom_prefix
AuthTokenTests
86
null
ultrabug/mkdocs-static-i18n
import pytest from mkdocs.commands.build import build def navigate(nav): for item in nav: if item.children: for child in navigate(item.children): yield child yield item @pytest.mark.parametrize( "control_data,test_data", [ ( {"mkdocs_fp": "te...
test_page.url
assert
complex_expr
tests/test_control.py
test_control_single
96
null
ultrabug/mkdocs-static-i18n
from mkdocs.commands.build import build from mkdocs.config.base import load_config def test_search_entries_no_reconfigure(): mkdocs_config = load_config( "tests/mkdocs.yml", theme={"name": "mkdocs"}, use_directory_urls=True, docs_dir="docs_suffix_structure_two_languages/", p...
40
assert
numeric_literal
tests/test_search.py
test_search_entries_no_reconfigure
85
null
ultrabug/mkdocs-static-i18n
import re import logging from pathlib import Path from mkdocs.commands.build import build from mkdocs.config.base import load_config def test_plugin_no_use_directory_urls_default_language_only(): mkdocs_config = load_config( "tests/mkdocs.yml", theme={"name": "material"}, docs_dir="details...
[ 'Conseil', # ??? tip 'Conseil', # ???tip 'Conseil', # ???+ tip 'Conseil', # ???+tip 'Avertissement', # ??? warning (overrided) 'Heey', # ??? warning "Heey" 'Conseil', # Indented ??? tip 'Conseil', # Indented ???+ tip 'Conseil', # ??? Tip (uppercase) 'Conseil', # ???+ Tip 'Conseil', # ???Tip 'Conseil', # ???+Tip ]
assert
collection
tests/test_details.py
test_plugin_no_use_directory_urls_default_language_only
59
null