repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/integration/cli/test_new.py | test_should_generate_using_overriden_template | assert | string_literal | 30 | import os
from copier.user_data import load_answersfile_data
from tests.integration.conftest import assert_paths
from fastapi_mvc import ANSWERS_FILE
class TestCliNewCommand:
def test_should_generate_using_overriden_template(self, new_copy, cli_runner):
with cli_runner.isolated_filesystem() as tmp:
... | "https://github.com/rszamszur/copier-project" | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/integration/cli/test_update.py | test_should_update_outdated_project_to_given_version | assert | numeric_literal | 69 | import pytest
from fastapi_mvc.utils import run_shell
def dirhash(path):
"""Calculate directory sha256sum using bash magic.
The bellow code will execute the following shell command:
``find . -type f ! -path "./.git/*" -print0 | xargs -0 sha256sum | sort | sha256sum``
"""
# First, find all the fil... | 0 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/integration/cli/test_update.py | test_should_not_update_when_git_dirty | assert | numeric_literal | 63 | import pytest
from fastapi_mvc.utils import run_shell
def dirhash(path):
"""Calculate directory sha256sum using bash magic.
The bellow code will execute the following shell command:
``find . -type f ! -path "./.git/*" -print0 | xargs -0 sha256sum | sort | sha256sum``
"""
# First, find all the fil... | 2 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/integration/cli/test_update.py | test_should_update_outdated_project_to_given_version | assert | func_call | 88 | import pytest
from fastapi_mvc.utils import run_shell
def dirhash(path):
"""Calculate directory sha256sum using bash magic.
The bellow code will execute the following shell command:
``find . -type f ! -path "./.git/*" -print0 | xargs -0 sha256sum | sort | sha256sum``
"""
# First, find all the fil... | dirhash(str(reference_projects[target])) | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/integration/conftest.py | default_project | assert | numeric_literal | 50 | import os
import copy
import pytest
from click.testing import CliRunner
from fastapi_mvc.cli.new import new
from fastapi_mvc.cli.update import update
COPIER_PROJECT_RELEASES = {
"0.1.0",
"0.1.1",
"0.2.0",
"0.3.0",
"0.4.0",
}
def assert_paths(paths, condition):
for path in paths:
asser... | 0 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/integration/generators/test_controller.py | test_should_generate_controller_using_given_arguments | assert | numeric_literal | 18 | import os
from tests.integration.conftest import assert_paths
from fastapi_mvc.generators import ControllerGenerator
class TestControllerGeneratorCli:
def test_should_generate_controller_using_given_arguments(self, cli_runner, default_project, monkeypatch):
# given / when
monkeypatch.chdir(defaul... | 0 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/integration/generators/test_controller.py | test_should_generate_controller_using_given_arguments | assert_* | collection | 19 | import os
from tests.integration.conftest import assert_paths
from fastapi_mvc.generators import ControllerGenerator
class TestControllerGeneratorCli:
def test_should_generate_controller_using_given_arguments(self, cli_runner, default_project, monkeypatch):
# given / when
monkeypatch.chdir(defaul... | [ f"{default_project}/default_project/app/controllers/stock_market.py", f"{default_project}/tests/unit/app/controllers/test_stock_market.py", ]) | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/integration/generators/test_generator.py | test_should_generate_generator_with_default_structure | assert | numeric_literal | 15 | import os
from fastapi_mvc.generators import GeneratorGenerator
from tests.integration.conftest import assert_paths
class TestGeneratorGeneratorCli:
def test_should_generate_generator_with_default_structure(self, cli_runner, default_project, monkeypatch):
# given
monkeypatch.chdir(default_project... | 0 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/integration/generators/test_generator.py | test_should_generate_generator_with_minimal_structure | assert_* | collection | 16 | import os
from fastapi_mvc.generators import GeneratorGenerator
from tests.integration.conftest import assert_paths
class TestGeneratorGeneratorCli:
def test_should_generate_generator_with_minimal_structure(self, cli_runner, default_project, monkeypatch):
# given
monkeypatch.chdir(default_project... | [ "lib/generators/foo_bar/default.nix", "lib/generators/foo_bar/shell.nix", ]) | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/integration/generators/test_script.py | test_should_generate_script_using_given_arguments | assert | numeric_literal | 20 | import os
import pytest
from tests.integration.conftest import assert_paths
from fastapi_mvc.generators import ScriptGenerator
class TestScriptGeneratorCli:
@pytest.mark.parametrize("args", [
["my-script.sh"],
["--use-nix", "my-script.sh"]
])
def test_should_generate_script_using_given_ar... | 0 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/integration/generators/test_script.py | test_should_generate_script_using_given_arguments | assert_* | collection | 21 | import os
import pytest
from tests.integration.conftest import assert_paths
from fastapi_mvc.generators import ScriptGenerator
class TestScriptGeneratorCli:
@pytest.mark.parametrize("args", [
["my-script.sh"],
["--use-nix", "my-script.sh"]
])
def test_should_generate_script_using_given_ar... | [f"{tmp}/my-script.sh"]) | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_cli.py | test_should_exit_zero_when_invoked_empty | assert | numeric_literal | 14 | import copy
import pytest
from fastapi_mvc.cli.cli import cli
class TestCliRoot:
def test_should_exit_zero_when_invoked_empty(self, cli_runner):
# given / when
result = cli_runner.invoke(cli)
# then
assert result.exit_code == | 0 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_cli.py | test_should_exit_error_when_invoked_with_invalid_option | assert | numeric_literal | 14 | import copy
import pytest
from fastapi_mvc.cli.cli import cli
class TestCliRoot:
def test_should_exit_error_when_invoked_with_invalid_option(self, cli_runner):
# given / when
result = cli_runner.invoke(cli, ["--not_exists"])
# then
assert result.exit_code == | 2 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_generate.py | test_should_exit_zero_when_invoked_with_help | assert | numeric_literal | 13 | import pytest
from fastapi_mvc.cli.generate import get_generate_cmd
class TestCliGenerateCommand:
def test_should_exit_zero_when_invoked_with_help(self, monkeypatch, fake_project_with_generators, cli_runner):
# given / when
monkeypatch.chdir(fake_project_with_generators["root"])
result = c... | 0 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_generate.py | test_should_exit_error_when_invoked_with_invalid_option | assert | numeric_literal | 12 | import pytest
from fastapi_mvc.cli.generate import get_generate_cmd
class TestCliGenerateCommand:
def test_should_exit_error_when_invoked_with_invalid_option(self, cli_runner):
# given / when
result = cli_runner.invoke(get_generate_cmd(), ["--not_exists"])
# then
assert result.ex... | 2 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_new.py | test_should_exit_zero_when_invoked_with_help | assert | numeric_literal | 38 | import os
import copy
from datetime import datetime
from unittest import mock
import pytest
from fastapi_mvc import VERSION
from fastapi_mvc.cli.new import new
DIR = os.getcwd()
class TestCliNewCommand:
def patched_new(self):
cmd = copy.deepcopy(new)
shell_patch = mock.patch("fastapi_mvc.cli.new... | 0 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_new.py | test_should_exit_error_when_invoked_with_invalid_option | assert | numeric_literal | 38 | import os
import copy
from datetime import datetime
from unittest import mock
import pytest
from fastapi_mvc import VERSION
from fastapi_mvc.cli.new import new
DIR = os.getcwd()
class TestCliNewCommand:
def patched_new(self):
cmd = copy.deepcopy(new)
shell_patch = mock.patch("fastapi_mvc.cli.new... | 2 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_new.py | test_should_exit_zero_and_call_copier_with_defaults | assert_* | string_literal | 45 | import os
import copy
from datetime import datetime
from unittest import mock
import pytest
from fastapi_mvc import VERSION
from fastapi_mvc.cli.new import new
DIR = os.getcwd()
class TestCliNewCommand:
def patched_new(self):
cmd = copy.deepcopy(new)
shell_patch = mock.patch("fastapi_mvc.cli.new... | "make") | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_new.py | test_should_exit_zero_and_call_copier_with_defaults | assert_* | collection | 39 | import os
import copy
from datetime import datetime
from unittest import mock
import pytest
from fastapi_mvc import VERSION
from fastapi_mvc.cli.new import new
DIR = os.getcwd()
class TestCliNewCommand:
def patched_new(self):
cmd = copy.deepcopy(new)
shell_patch = mock.patch("fastapi_mvc.cli.new... | [ mock.call(cmd=["git", "init"], cwd=f"{DIR}/test-project"), mock.call(cmd=["make", "install"], cwd=f"{DIR}/test-project"), ]) | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_run.py | test_should_exit_zero_when_invoked_with_help | assert | numeric_literal | 23 | import copy
from unittest import mock
from subprocess import CalledProcessError
import pytest
from fastapi_mvc.cli.run import run
class TestCliRunCommand:
def patched_run(self):
cmd = copy.deepcopy(run)
with mock.patch("fastapi_mvc.cli.run.run_shell") as mck:
cmd.run_shell = mck
... | 0 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_run.py | test_should_exit_error_when_invoked_with_invalid_option | assert | numeric_literal | 23 | import copy
from unittest import mock
from subprocess import CalledProcessError
import pytest
from fastapi_mvc.cli.run import run
class TestCliRunCommand:
def patched_run(self):
cmd = copy.deepcopy(run)
with mock.patch("fastapi_mvc.cli.run.run_shell") as mck:
cmd.run_shell = mck
... | 2 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_run.py | test_should_exit_error_when_not_in_fastapi_mvc_project | assert | numeric_literal | 23 | import copy
from unittest import mock
from subprocess import CalledProcessError
import pytest
from fastapi_mvc.cli.run import run
class TestCliRunCommand:
def patched_run(self):
cmd = copy.deepcopy(run)
with mock.patch("fastapi_mvc.cli.run.run_shell") as mck:
cmd.run_shell = mck
... | 1 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_run.py | test_should_exit_error_when_not_in_fastapi_mvc_project | assert | complex_expr | 25 | import copy
from unittest import mock
from subprocess import CalledProcessError
import pytest
from fastapi_mvc.cli.run import run
class TestCliRunCommand:
def patched_run(self):
cmd = copy.deepcopy(run)
with mock.patch("fastapi_mvc.cli.run.run_shell") as mck:
cmd.run_shell = mck
... | result.output | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_update.py | test_should_exit_zero_when_invoked_with_help | assert | numeric_literal | 23 | import copy
from unittest import mock
import pytest
from copier.errors import UserMessageError
from fastapi_mvc.cli.update import update
class TestCliUpdateCommand:
def patched_update(self):
cmd = copy.deepcopy(update)
cmd.run_update = mock.Mock()
yield cmd
del cmd
def test_s... | 0 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_update.py | test_should_exit_error_when_invoked_with_invalid_option | assert | numeric_literal | 22 | import copy
from unittest import mock
import pytest
from copier.errors import UserMessageError
from fastapi_mvc.cli.update import update
class TestCliUpdateCommand:
def patched_update(self):
cmd = copy.deepcopy(update)
cmd.run_update = mock.Mock()
yield cmd
del cmd
def test_s... | 2 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_update.py | test_should_exit_error_when_not_in_fastapi_mvc_project | assert | numeric_literal | 22 | import copy
from unittest import mock
import pytest
from copier.errors import UserMessageError
from fastapi_mvc.cli.update import update
class TestCliUpdateCommand:
def patched_update(self):
cmd = copy.deepcopy(update)
cmd.run_update = mock.Mock()
yield cmd
del cmd
def test_s... | 1 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_update.py | test_should_exit_zero_and_call_copier_with_parsed_arguments | assert | string_literal | 57 | import copy
from unittest import mock
import pytest
from copier.errors import UserMessageError
from fastapi_mvc.cli.update import update
class TestCliUpdateCommand:
def patched_update(self):
cmd = copy.deepcopy(update)
cmd.run_update = mock.Mock()
yield cmd
del cmd
def test_s... | "master" | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/cli/test_update.py | test_should_exit_error_when_not_in_fastapi_mvc_project | assert | complex_expr | 24 | import copy
from unittest import mock
import pytest
from copier.errors import UserMessageError
from fastapi_mvc.cli.update import update
class TestCliUpdateCommand:
def patched_update(self):
cmd = copy.deepcopy(update)
cmd.run_update = mock.Mock()
yield cmd
del cmd
def test_s... | result.output | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/generators/test_controller.py | test_should_exit_zero_when_invoked_with_help | assert | numeric_literal | 22 | import copy
from unittest import mock
import pytest
from fastapi_mvc.generators import ControllerGenerator
class TestControllerGenerator:
def controller(self):
controller = copy.deepcopy(ControllerGenerator)
controller.run_copy = mock.Mock()
controller.insert_router_import = mock.Mock()
... | 0 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/generators/test_controller.py | test_should_exit_error_when_invoked_with_invalid_option | assert | numeric_literal | 22 | import copy
from unittest import mock
import pytest
from fastapi_mvc.generators import ControllerGenerator
class TestControllerGenerator:
def controller(self):
controller = copy.deepcopy(ControllerGenerator)
controller.run_copy = mock.Mock()
controller.insert_router_import = mock.Mock()
... | 2 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/generators/test_controller.py | test_should_exit_error_when_not_in_fastapi_mvc_project | assert | numeric_literal | 22 | import copy
from unittest import mock
import pytest
from fastapi_mvc.generators import ControllerGenerator
class TestControllerGenerator:
def controller(self):
controller = copy.deepcopy(ControllerGenerator)
controller.run_copy = mock.Mock()
controller.insert_router_import = mock.Mock()
... | 1 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/generators/test_controller.py | test_should_exit_error_when_not_in_fastapi_mvc_project | assert | complex_expr | 24 | import copy
from unittest import mock
import pytest
from fastapi_mvc.generators import ControllerGenerator
class TestControllerGenerator:
def controller(self):
controller = copy.deepcopy(ControllerGenerator)
controller.run_copy = mock.Mock()
controller.insert_router_import = mock.Mock()
... | result.output | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/generators/test_controller.py | test_should_call_copier_using_default_values | assert_* | string_literal | 31 | import copy
from unittest import mock
import pytest
from fastapi_mvc.generators import ControllerGenerator
class TestControllerGenerator:
def controller(self):
controller = copy.deepcopy(ControllerGenerator)
controller.run_copy = mock.Mock()
controller.insert_router_import = mock.Mock()
... | "fake_controller") | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/generators/test_generator.py | test_should_exit_zero_when_invoked_with_help | assert | numeric_literal | 22 | import copy
from unittest import mock
from datetime import datetime
import pytest
from fastapi_mvc.generators import GeneratorGenerator
class TestGeneratorGenerator:
def generator(self):
generator = copy.deepcopy(GeneratorGenerator)
generator.run_copy = mock.Mock()
yield generator
... | 0 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/generators/test_generator.py | test_should_exit_error_when_invoked_with_invalid_option | assert | numeric_literal | 22 | import copy
from unittest import mock
from datetime import datetime
import pytest
from fastapi_mvc.generators import GeneratorGenerator
class TestGeneratorGenerator:
def generator(self):
generator = copy.deepcopy(GeneratorGenerator)
generator.run_copy = mock.Mock()
yield generator
... | 2 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/generators/test_generator.py | test_should_exit_error_when_not_in_fastapi_mvc_project | assert | numeric_literal | 22 | import copy
from unittest import mock
from datetime import datetime
import pytest
from fastapi_mvc.generators import GeneratorGenerator
class TestGeneratorGenerator:
def generator(self):
generator = copy.deepcopy(GeneratorGenerator)
generator.run_copy = mock.Mock()
yield generator
... | 1 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/generators/test_generator.py | test_should_exit_error_when_not_in_fastapi_mvc_project | assert | complex_expr | 24 | import copy
from unittest import mock
from datetime import datetime
import pytest
from fastapi_mvc.generators import GeneratorGenerator
class TestGeneratorGenerator:
def generator(self):
generator = copy.deepcopy(GeneratorGenerator)
generator.run_copy = mock.Mock()
yield generator
... | result.output | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/generators/test_loader.py | test_should_continue_on_import_error | assert | func_call | 20 | from unittest import mock
from fastapi_mvc.generators import load_generators
class TestLoadGenerators:
@mock.patch("fastapi_mvc.generators.loader.importlib.util")
def test_should_continue_on_import_error(self, importlib_mock, monkeypatch, fake_project_with_generators):
# given
monkeypatch.chd... | sorted( ["controller", "generator", "script"] ) | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/generators/test_loader.py | test_should_load_custom_generators_from_default_path | assert | func_call | 16 | from unittest import mock
from fastapi_mvc.generators import load_generators
class TestLoadGenerators:
def test_should_load_custom_generators_from_default_path(self, monkeypatch, fake_project_with_generators):
# given
monkeypatch.chdir(fake_project_with_generators["root"])
# when
... | sorted( ["controller", "foobar", "generator", "my-controller", "script"] ) | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/generators/test_script.py | test_should_exit_zero_when_invoked_with_help | assert | numeric_literal | 21 | import copy
from unittest import mock
import pytest
from fastapi_mvc.generators import ScriptGenerator
class TestScriptGenerator:
def script(self):
script = copy.deepcopy(ScriptGenerator)
script.run_copy = mock.Mock()
yield script
del script
def test_should_exit_zero_when_inv... | 0 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/generators/test_script.py | test_should_exit_error_when_invoked_with_invalid_option | assert | numeric_literal | 21 | import copy
from unittest import mock
import pytest
from fastapi_mvc.generators import ScriptGenerator
class TestScriptGenerator:
def script(self):
script = copy.deepcopy(ScriptGenerator)
script.run_copy = mock.Mock()
yield script
del script
def test_should_exit_error_when_in... | 2 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/test_core.py | test_should_create_generator_and_populate_defaults | assert | string_literal | 68 | import os
from unittest import mock
import pytest
from fastapi_mvc import Generator, Command, ANSWERS_FILE
router_content = """\
from fastapi import APIRouter
from fake_project.app.controllers import ready
root_api_router = APIRouter(prefix="/api")
root_api_router.include_router(ready.router, tags=["ready"])
"""
ro... | "Other" | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/test_core.py | test_should_expand_poetry_path_from_env | assert | variable | 72 | import os
from unittest import mock
import pytest
from fastapi_mvc import Generator, Command, ANSWERS_FILE
router_content = """\
from fastapi import APIRouter
from fake_project.app.controllers import ready
root_api_router = APIRouter(prefix="/api")
root_api_router.include_router(ready.router, tags=["ready"])
"""
ro... | expected | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/test_core.py | test_should_raise_when_not_fastapi_mvc_project | pytest.raises | variable | 66 | import os
from unittest import mock
import pytest
from fastapi_mvc import Generator, Command, ANSWERS_FILE
router_content = """\
from fastapi import APIRouter
from fake_project.app.controllers import ready
root_api_router = APIRouter(prefix="/api")
root_api_router.include_router(ready.router, tags=["ready"])
"""
ro... | SystemExit) | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/test_core.py | test_should_create_command_and_populate_defaults | assert | string_literal | 66 | import os
from unittest import mock
import pytest
from fastapi_mvc import Generator, Command, ANSWERS_FILE
router_content = """\
from fastapi import APIRouter
from fake_project.app.controllers import ready
root_api_router = APIRouter(prefix="/api")
root_api_router.include_router(ready.router, tags=["ready"])
"""
ro... | "fake-command" | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/test_core.py | test_should_not_raise_when_valid_fastapi_mvc_project | assert | string_literal | 70 | import os
from unittest import mock
import pytest
from fastapi_mvc import Generator, Command, ANSWERS_FILE
router_content = """\
from fastapi import APIRouter
from fake_project.app.controllers import ready
root_api_router = APIRouter(prefix="/api")
root_api_router.include_router(ready.router, tags=["ready"])
"""
ro... | "fake_project" | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/test_core.py | test_should_not_raise_when_valid_fastapi_mvc_project | assert | string_literal | 71 | import os
from unittest import mock
import pytest
from fastapi_mvc import Generator, Command, ANSWERS_FILE
router_content = """\
from fastapi import APIRouter
from fake_project.app.controllers import ready
root_api_router = APIRouter(prefix="/api")
root_api_router.include_router(ready.router, tags=["ready"])
"""
ro... | "fake-project" | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/test_core.py | test_should_insert_router_import | assert | variable | 73 | import os
from unittest import mock
import pytest
from fastapi_mvc import Generator, Command, ANSWERS_FILE
router_content = """\
from fastapi import APIRouter
from fake_project.app.controllers import ready
root_api_router = APIRouter(prefix="/api")
root_api_router.include_router(ready.router, tags=["ready"])
"""
ro... | router_expected | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/test_core.py | test_should_insert_router_import_at_file_end | assert | variable | 73 | import os
from unittest import mock
import pytest
from fastapi_mvc import Generator, Command, ANSWERS_FILE
router_content = """\
from fastapi import APIRouter
from fake_project.app.controllers import ready
root_api_router = APIRouter(prefix="/api")
root_api_router.include_router(ready.router, tags=["ready"])
"""
ro... | router2_expected | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/test_core.py | test_should_create_generator_and_populate_defaults | assert | string_literal | 66 | import os
from unittest import mock
import pytest
from fastapi_mvc import Generator, Command, ANSWERS_FILE
router_content = """\
from fastapi import APIRouter
from fake_project.app.controllers import ready
root_api_router = APIRouter(prefix="/api")
root_api_router.include_router(ready.router, tags=["ready"])
"""
ro... | "https://fake.repo.git" | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/utils/test_excepthook.py | test_should_format_issue_template | assert | numeric_literal | 17 | import logging
from fastapi_mvc.utils import global_except_hook
class TestGlobalExceptHook:
def test_should_format_issue_template(self, caplog):
# given
caplog.set_level(logging.DEBUG)
ex = Exception("Oh no! Something went wrong :(")
# when
global_except_hook(type(ex), ex... | 2 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/utils/test_excepthook.py | test_should_format_issue_template | assert | complex_expr | 20 | import logging
from fastapi_mvc.utils import global_except_hook
class TestGlobalExceptHook:
def test_should_format_issue_template(self, caplog):
# given
caplog.set_level(logging.DEBUG)
ex = Exception("Oh no! Something went wrong :(")
# when
global_except_hook(type(ex), ex... | caplog.records[1].message | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/utils/test_excepthook.py | test_should_format_issue_template | assert | collection | 19 | import logging
from fastapi_mvc.utils import global_except_hook
class TestGlobalExceptHook:
def test_should_format_issue_template(self, caplog):
# given
caplog.set_level(logging.DEBUG)
ex = Exception("Oh no! Something went wrong :(")
# when
global_except_hook(type(ex), ex... | (type(ex), ex, ex.__traceback__) | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/utils/test_excepthook.py | test_should_format_issue_template | assert | string_literal | 18 | import logging
from fastapi_mvc.utils import global_except_hook
class TestGlobalExceptHook:
def test_should_format_issue_template(self, caplog):
# given
caplog.set_level(logging.DEBUG)
ex = Exception("Oh no! Something went wrong :(")
# when
global_except_hook(type(ex), ex... | "Unhandled exception occurred during RunTime." | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/utils/test_shell.py | test_should_call_and_populate_defaults | assert | numeric_literal | 20 | import os
import subprocess
from subprocess import CalledProcessError
from unittest import mock
import pytest
from fastapi_mvc.utils import get_git_user_info, run_shell
class TestRunShell:
def test_should_call_and_populate_defaults(self):
# given
cmd = ["/usr/bin/env", "true"]
# when
... | 0 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/utils/test_shell.py | test_should_call_and_populate_defaults | assert | variable | 21 | import os
import subprocess
from subprocess import CalledProcessError
from unittest import mock
import pytest
from fastapi_mvc.utils import get_git_user_info, run_shell
class TestRunShell:
def test_should_call_and_populate_defaults(self):
# given
cmd = ["/usr/bin/env", "true"]
# when
... | cmd | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/utils/test_shell.py | test_should_return_defaults_when_no_git_present | assert_* | string_literal | 24 | import os
import subprocess
from subprocess import CalledProcessError
from unittest import mock
import pytest
from fastapi_mvc.utils import get_git_user_info, run_shell
class TestGetGitUserInfo:
@mock.patch(
"fastapi_mvc.utils.shell.shutil.which",
return_value=False,
)
@mock.patch("fastap... | "git") | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/utils/test_shell.py | test_should_return_defaults_when_subprocess_error | assert | string_literal | 21 | import os
import subprocess
from subprocess import CalledProcessError
from unittest import mock
import pytest
from fastapi_mvc.utils import get_git_user_info, run_shell
class TestGetGitUserInfo:
@mock.patch(
"fastapi_mvc.utils.shell.subprocess.check_output",
side_effect=CalledProcessError(1, []),... | "John Doe" | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/utils/test_shell.py | test_should_return_git_username_and_email | assert | string_literal | 24 | import os
import subprocess
from subprocess import CalledProcessError
from unittest import mock
import pytest
from fastapi_mvc.utils import get_git_user_info, run_shell
class TestGetGitUserInfo:
@mock.patch(
"fastapi_mvc.utils.shell.subprocess.check_output",
side_effect=[
"Darth Vader... | "Darth Vader" | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/utils/test_shell.py | test_should_return_defaults_when_subprocess_error | assert | string_literal | 22 | import os
import subprocess
from subprocess import CalledProcessError
from unittest import mock
import pytest
from fastapi_mvc.utils import get_git_user_info, run_shell
class TestGetGitUserInfo:
@mock.patch(
"fastapi_mvc.utils.shell.subprocess.check_output",
side_effect=CalledProcessError(1, []),... | "example@email.com" | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/utils/test_shell.py | test_should_remove_venv_from_path_if_activated | assert_* | collection | 55 | import os
import subprocess
from subprocess import CalledProcessError
from unittest import mock
import pytest
from fastapi_mvc.utils import get_git_user_info, run_shell
class TestRunShell:
@pytest.mark.parametrize("env, expected", [
(
{
"SHELL": "/bin/bash",
"H... | ["make", "install"]) | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/utils/test_shell.py | test_should_return_git_username_and_email | assert | string_literal | 25 | import os
import subprocess
from subprocess import CalledProcessError
from unittest import mock
import pytest
from fastapi_mvc.utils import get_git_user_info, run_shell
class TestGetGitUserInfo:
@mock.patch(
"fastapi_mvc.utils.shell.subprocess.check_output",
side_effect=[
"Darth Vader... | "join@galactic.empire" | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/utils/test_shell.py | test_should_raise_when_subprocess_failed_and_check_is_true | pytest.raises | complex_expr | 17 | import os
import subprocess
from subprocess import CalledProcessError
from unittest import mock
import pytest
from fastapi_mvc.utils import get_git_user_info, run_shell
class TestRunShell:
def test_should_raise_when_subprocess_failed_and_check_is_true(self):
# given
check = True
# when /... | subprocess.CalledProcessError) | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/unit/utils/test_shell.py | test_should_return_git_username_and_email | assert_* | collection | 26 | import os
import subprocess
from subprocess import CalledProcessError
from unittest import mock
import pytest
from fastapi_mvc.utils import get_git_user_info, run_shell
class TestGetGitUserInfo:
@mock.patch(
"fastapi_mvc.utils.shell.subprocess.check_output",
side_effect=[
"Darth Vader... | [ mock.call(["git", "config", "--get", "user.name"]), mock.call(["git", "config", "--get", "user.email"]), ]) | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_authenticator.py | test_authenticator | assert | complex_expr | 86 | from typing import AsyncGenerator, Generic, List, Optional, Sequence
import httpx
import pytest
from fastapi import Depends, FastAPI, Request, status
from fastapi.security.base import SecurityBase
from fastapi_users import models
from fastapi_users.authentication import AuthenticationBackend, Authenticator
from fasta... | status.HTTP_200_OK | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_authenticator.py | test_authenticators_with_same_name | pytest.raises | variable | 84 | from typing import AsyncGenerator, Generic, List, Optional, Sequence
import httpx
import pytest
from fastapi import Depends, FastAPI, Request, status
from fastapi.security.base import SecurityBase
from fastapi_users import models
from fastapi_users.authentication import AuthenticationBackend, Authenticator
from fasta... | DuplicateBackendNamesError) | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_authenticator.py | test_authenticator_none | assert | complex_expr | 88 | from typing import AsyncGenerator, Generic, List, Optional, Sequence
import httpx
import pytest
from fastapi import Depends, FastAPI, Request, status
from fastapi.security.base import SecurityBase
from fastapi_users import models
from fastapi_users.authentication import AuthenticationBackend, Authenticator
from fasta... | status.HTTP_401_UNAUTHORIZED | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_backend.py | test_logout | assert | none_literal | 38 | from typing import Callable, Generic, Optional, Type, cast
import pytest
from fastapi import Response
from fastapi_users import models
from fastapi_users.authentication import (
AuthenticationBackend,
BearerTransport,
Strategy,
)
from fastapi_users.authentication.strategy import StrategyDestroyNotSupporte... | None | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_strategy_db.py | test_write_token | assert | none_literal | 32 | import dataclasses
import uuid
from datetime import datetime, timezone
from typing import Any, Dict, Optional
import pytest
from fastapi_users.authentication.strategy import (
AccessTokenDatabase,
AccessTokenProtocol,
DatabaseStrategy,
)
from tests.conftest import IDType, UserModel
def access_token_datab... | None | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_strategy_db.py | test_write_token | assert | complex_expr | 33 | import dataclasses
import uuid
from datetime import datetime, timezone
from typing import Any, Dict, Optional
import pytest
from fastapi_users.authentication.strategy import (
AccessTokenDatabase,
AccessTokenProtocol,
DatabaseStrategy,
)
from tests.conftest import IDType, UserModel
def access_token_datab... | user.id | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_strategy_jwt.py | test_missing_token | assert | none_literal | 92 | import pytest
from fastapi_users.authentication.strategy import (
JWTStrategy,
StrategyDestroyNotSupportedError,
)
from fastapi_users.jwt import SecretType, decode_jwt, generate_jwt
from tests.conftest import IDType, UserModel
LIFETIME = 3600
ECC_PRIVATE_KEY = """-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGS... | None | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_strategy_jwt.py | test_valid_token | assert | complex_expr | 94 | import pytest
from fastapi_users.authentication.strategy import (
JWTStrategy,
StrategyDestroyNotSupportedError,
)
from fastapi_users.jwt import SecretType, decode_jwt, generate_jwt
from tests.conftest import IDType, UserModel
LIFETIME = 3600
ECC_PRIVATE_KEY = """-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGS... | user.id | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_strategy_jwt.py | test_write_token | assert | func_call | 98 | import pytest
from fastapi_users.authentication.strategy import (
JWTStrategy,
StrategyDestroyNotSupportedError,
)
from fastapi_users.jwt import SecretType, decode_jwt, generate_jwt
from tests.conftest import IDType, UserModel
LIFETIME = 3600
ECC_PRIVATE_KEY = """-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGS... | str(user.id) | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_strategy_jwt.py | test_destroy_token | pytest.raises | variable | 90 | import pytest
from fastapi_users.authentication.strategy import (
JWTStrategy,
StrategyDestroyNotSupportedError,
)
from fastapi_users.jwt import SecretType, decode_jwt, generate_jwt
from tests.conftest import IDType, UserModel
LIFETIME = 3600
ECC_PRIVATE_KEY = """-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGS... | StrategyDestroyNotSupportedError) | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_strategy_redis.py | test_destroy_token | assert | none_literal | 25 | from datetime import datetime
from typing import Dict, Optional, Tuple
import pytest
from fastapi_users.authentication.strategy import RedisStrategy
from tests.conftest import IDType, UserModel
def redis() -> RedisMock:
return RedisMock()
def redis_strategy(redis):
return RedisStrategy(redis, 3600)
@pytest... | None | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_strategy_redis.py | test_valid_token | assert | complex_expr | 29 | from datetime import datetime
from typing import Dict, Optional, Tuple
import pytest
from fastapi_users.authentication.strategy import RedisStrategy
from tests.conftest import IDType, UserModel
def redis() -> RedisMock:
return RedisMock()
def redis_strategy(redis):
return RedisStrategy(redis, 3600)
class T... | user.id | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_strategy_redis.py | test_write_token | assert | func_call | 24 | from datetime import datetime
from typing import Dict, Optional, Tuple
import pytest
from fastapi_users.authentication.strategy import RedisStrategy
from tests.conftest import IDType, UserModel
def redis() -> RedisMock:
return RedisMock()
def redis_strategy(redis):
return RedisStrategy(redis, 3600)
@pytest... | str(user.id) | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_transport_bearer.py | test_get_openapi_logout_responses_success | assert | collection | 18 | import pytest
from fastapi import Response, status
from fastapi_users.authentication.transport import (
BearerTransport,
TransportLogoutNotSupportedError,
)
from fastapi_users.authentication.transport.bearer import BearerResponse
def bearer_transport() -> BearerTransport:
return BearerTransport(tokenUrl="... | {} | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_transport_bearer.py | test_get_login_response | assert | string_literal | 22 | import pytest
from fastapi import Response, status
from fastapi_users.authentication.transport import (
BearerTransport,
TransportLogoutNotSupportedError,
)
from fastapi_users.authentication.transport.bearer import BearerResponse
def bearer_transport() -> BearerTransport:
return BearerTransport(tokenUrl="... | "TOKEN" | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_transport_bearer.py | test_get_login_response | assert | string_literal | 23 | import pytest
from fastapi import Response, status
from fastapi_users.authentication.transport import (
BearerTransport,
TransportLogoutNotSupportedError,
)
from fastapi_users.authentication.transport.bearer import BearerResponse
def bearer_transport() -> BearerTransport:
return BearerTransport(tokenUrl="... | "bearer" | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_transport_bearer.py | test_get_openapi_login_responses_success | assert | variable | 18 | import pytest
from fastapi import Response, status
from fastapi_users.authentication.transport import (
BearerTransport,
TransportLogoutNotSupportedError,
)
from fastapi_users.authentication.transport.bearer import BearerResponse
def bearer_transport() -> BearerTransport:
return BearerTransport(tokenUrl="... | BearerResponse | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_transport_bearer.py | test_get_logout_response | pytest.raises | variable | 18 | import pytest
from fastapi import Response, status
from fastapi_users.authentication.transport import (
BearerTransport,
TransportLogoutNotSupportedError,
)
from fastapi_users.authentication.transport.bearer import BearerResponse
def bearer_transport() -> BearerTransport:
return BearerTransport(tokenUrl="... | TransportLogoutNotSupportedError) | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_transport_cookie.py | test_get_login_response | assert | numeric_literal | 37 | import re
import pytest
from fastapi import Response, status
from fastapi_users.authentication.transport import CookieTransport
COOKIE_MAX_AGE = 3600
COOKIE_NAME = "COOKIE_NAME"
def cookie_transport(request) -> CookieTransport:
path, domain, secure, httponly = request.param
return CookieTransport(
c... | 1 | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_transport_cookie.py | test_get_login_response | assert | none_literal | 34 | import re
import pytest
from fastapi import Response, status
from fastapi_users.authentication.transport import CookieTransport
COOKIE_MAX_AGE = 3600
COOKIE_NAME = "COOKIE_NAME"
def cookie_transport(request) -> CookieTransport:
path, domain, secure, httponly = request.param
return CookieTransport(
c... | None | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_transport_cookie.py | test_get_login_response | assert | variable | 41 | import re
import pytest
from fastapi import Response, status
from fastapi_users.authentication.transport import CookieTransport
COOKIE_MAX_AGE = 3600
COOKIE_NAME = "COOKIE_NAME"
def cookie_transport(request) -> CookieTransport:
path, domain, secure, httponly = request.param
return CookieTransport(
c... | cookie | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_authentication_transport_cookie.py | test_get_openapi_login_responses_success | assert | collection | 26 | import re
import pytest
from fastapi import Response, status
from fastapi_users.authentication.transport import CookieTransport
COOKIE_MAX_AGE = 3600
COOKIE_NAME = "COOKIE_NAME"
def cookie_transport(request) -> CookieTransport:
path, domain, secure, httponly = request.param
return CookieTransport(
c... | { status.HTTP_200_OK: {"model": None} } | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_db_base.py | test_not_implemented_methods | pytest.raises | variable | 16 | import uuid
import pytest
from fastapi_users.db import BaseUserDatabase
from tests.conftest import IDType, OAuthAccountModel, UserModel
@pytest.mark.asyncio
@pytest.mark.db
async def test_not_implemented_methods(
user: UserModel, oauth_account1: OAuthAccountModel
):
base_user_db = BaseUserDatabase[UserModel,... | NotImplementedError) | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_fastapi_users.py | test_missing_token | assert | none_literal | 15 | from typing import AsyncGenerator
import httpx
import pytest
from fastapi import Depends, FastAPI, status
from fastapi_users import FastAPIUsers
from tests.conftest import IDType, User, UserCreate, UserModel, UserUpdate
class TestOptionalGetCurrentUser:
async def test_missing_token(self, test_app_client: httpx.A... | None | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_jwt.py | test_generate_decode_jwt | assert | string_literal | 14 | import pytest
from fastapi_users.jwt import SecretType, decode_jwt, generate_jwt
@pytest.mark.jwt
def test_generate_decode_jwt(secret: SecretType):
audience = "TEST_AUDIENCE"
data = {"foo": "bar", "aud": audience}
jwt = generate_jwt(data, secret, 3600)
decoded = decode_jwt(jwt, secret, [audience])
... | "bar" | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_jwt.py | test_generate_decode_jwt | assert | variable | 15 | import pytest
from fastapi_users.jwt import SecretType, decode_jwt, generate_jwt
@pytest.mark.jwt
def test_generate_decode_jwt(secret: SecretType):
audience = "TEST_AUDIENCE"
data = {"foo": "bar", "aud": audience}
jwt = generate_jwt(data, secret, 3600)
decoded = decode_jwt(jwt, secret, [audience])
... | audience | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_manager.py | test_existing_user_with_oauth | assert | numeric_literal | 79 | from typing import Callable
import pytest
from fastapi.security import OAuth2PasswordRequestForm
from pydantic import UUID4
from pytest_mock import MockerFixture
from fastapi_users.exceptions import (
InvalidID,
InvalidPasswordException,
InvalidResetPasswordToken,
InvalidVerifyToken,
UserAlreadyEx... | 2 | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_manager.py | test_existing_user_without_oauth_associate | assert | numeric_literal | 80 | from typing import Callable
import pytest
from fastapi.security import OAuth2PasswordRequestForm
from pydantic import UUID4
from pytest_mock import MockerFixture
from fastapi_users.exceptions import (
InvalidID,
InvalidPasswordException,
InvalidResetPasswordToken,
InvalidVerifyToken,
UserAlreadyEx... | 1 | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_manager.py | test_integer_id_mixin | assert | numeric_literal | 66 | from typing import Callable
import pytest
from fastapi.security import OAuth2PasswordRequestForm
from pydantic import UUID4
from pytest_mock import MockerFixture
from fastapi_users.exceptions import (
InvalidID,
InvalidPasswordException,
InvalidResetPasswordToken,
InvalidVerifyToken,
UserAlreadyEx... | 123 | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_manager.py | test_regular_user | assert | bool_literal | 73 | from typing import Callable
import pytest
from fastapi.security import OAuth2PasswordRequestForm
from pydantic import UUID4
from pytest_mock import MockerFixture
from fastapi_users.exceptions import (
InvalidID,
InvalidPasswordException,
InvalidResetPasswordToken,
InvalidVerifyToken,
UserAlreadyEx... | True | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_manager.py | test_existing_user_without_oauth_associate | assert | none_literal | 81 | from typing import Callable
import pytest
from fastapi.security import OAuth2PasswordRequestForm
from pydantic import UUID4
from pytest_mock import MockerFixture
from fastapi_users.exceptions import (
InvalidID,
InvalidPasswordException,
InvalidResetPasswordToken,
InvalidVerifyToken,
UserAlreadyEx... | None | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_openapi.py | test_forgot_password_status_codes | assert | collection | 19 | import httpx
import pytest
from fastapi import FastAPI, status
from fastapi_users.fastapi_users import FastAPIUsers
from tests.conftest import IDType, User, UserCreate, UserModel, UserUpdate
def fastapi_users(get_user_manager, mock_authentication) -> FastAPIUsers:
return FastAPIUsers[UserModel, IDType](get_user_m... | ["202", "422"] | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_openapi.py | test_get_me_status_codes | assert | collection | 19 | import httpx
import pytest
from fastapi import FastAPI, status
from fastapi_users.fastapi_users import FastAPIUsers
from tests.conftest import IDType, User, UserCreate, UserModel, UserUpdate
def fastapi_users(get_user_manager, mock_authentication) -> FastAPIUsers:
return FastAPIUsers[UserModel, IDType](get_user_m... | ["200", "401"] | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_openapi.py | test_oauth_authorize_status_codes | assert | collection | 18 | import httpx
import pytest
from fastapi import FastAPI, status
from fastapi_users.fastapi_users import FastAPIUsers
from tests.conftest import IDType, User, UserCreate, UserModel, UserUpdate
def fastapi_users(get_user_manager, mock_authentication) -> FastAPIUsers:
return FastAPIUsers[UserModel, IDType](get_user_m... | ["200", "422"] | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_openapi.py | test_openapi_route | assert | complex_expr | 19 | import httpx
import pytest
from fastapi import FastAPI, status
from fastapi_users.fastapi_users import FastAPIUsers
from tests.conftest import IDType, User, UserCreate, UserModel, UserUpdate
def fastapi_users(get_user_manager, mock_authentication) -> FastAPIUsers:
return FastAPIUsers[UserModel, IDType](get_user_m... | status.HTTP_200_OK | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
fastapi-users/fastapi-users | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | train | train | tests/test_openapi.py | test_reset_password_status_codes | assert | collection | 18 | import httpx
import pytest
from fastapi import FastAPI, status
from fastapi_users.fastapi_users import FastAPIUsers
from tests.conftest import IDType, User, UserCreate, UserModel, UserUpdate
def fastapi_users(get_user_manager, mock_authentication) -> FastAPIUsers:
return FastAPIUsers[UserModel, IDType](get_user_m... | ["200", "400", "422"] | d661585238ecc409765215d2a56e6e2b5a17028c | 95 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.