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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/test_cacher.py | test_cacheable_component_request_is_none_then_restored | assert | variable | 21 | from unittest.mock import MagicMock, patch
from django_unicorn.cacher import (
CacheableComponent,
cache_full_tree,
restore_from_cache,
)
from django_unicorn.components import UnicornView
def test_cacheable_component_request_is_none_then_restored():
component = FakeComponent(
component_id="tes... | request | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/action_parsers/utils/test_set_property_value.py | test_set_property_value_int | assert | variable | 20 | from datetime import datetime
from typing import List
import pytest
from django_unicorn.components import UnicornView
from django_unicorn.views.action_parsers.utils import set_property_value
from example.coffee.models import Flavor, Taste
def test_set_property_value_int():
component = FakeComponent(component_nam... | integer | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/call_method_parser/test_parse_args.py | test_args | assert | variable | 11 | from datetime import datetime
from uuid import UUID
from django_unicorn.call_method_parser import eval_value
def test_args():
expected = (1, 2)
actual = eval_value("1, 2")
assert actual == | expected | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/call_method_parser/test_parse_call_method_name.py | test_single_int_arg | assert | variable | 12 | from django_unicorn.call_method_parser import parse_call_method_name
def setup_function():
"""Clears lru_cache before every test in the module."""
parse_call_method_name.cache_clear()
def test_single_int_arg():
expected = ("set_name", (1,), {})
actual = parse_call_method_name("set_name(1)")
asse... | expected | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/call_method_parser/test_parse_kwarg.py | test_kwargs_string | assert | variable | 10 | import pytest
from django_unicorn.call_method_parser import InvalidKwargError, parse_kwarg
def test_kwargs_string():
expected = {"test": "1"}
actual = parse_kwarg("test='1'")
assert actual == | expected | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/components/test_unicorn_template_response.py | test_get_root_element | assert | variable | 24 | import pytest
from bs4 import BeautifulSoup
from django_unicorn.components.unicorn_template_response import (
UnicornTemplateResponse,
assert_has_single_wrapper_element,
get_root_element,
)
from django_unicorn.errors import (
MissingComponentElementError,
MissingComponentViewElementError,
Multi... | expected | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/serializer/test_exclude_field_attributes.py | test_exclude_field_attributes | assert | variable | 15 | import pytest
from django_unicorn.serializer import (
InvalidFieldAttributeError,
InvalidFieldNameError,
_exclude_field_attributes,
)
def test_exclude_field_attributes():
expected = {"1": {"2": {}}}
dict_data = {"1": {"2": {"3": "4"}}}
_exclude_field_attributes(dict_data, ("1.2.3",))
ass... | expected | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/test_typer.py | test_get_type_hints | assert | variable | 19 | import datetime
from dataclasses import dataclass
from typing import List, Optional
from typing import get_type_hints as typing_get_type_hints
from pydantic import BaseModel
from django_unicorn.components import UnicornView
from django_unicorn.typer import cast_attribute_value, cast_value, get_type_hints
from example... | expected | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/test_utils.py | test_get_method_arguments | assert | variable | 21 | import pytest
from django.template.backends.django import Template
from django_unicorn.utils import (
create_template,
generate_checksum,
get_method_arguments,
is_non_string_sequence,
sanitize_html,
)
def test_get_method_arguments():
def test_func(input_str):
return input_str
expe... | expected | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/action_parsers/call_method/test_call_method_name.py | test_call_method_name_no_params | assert | variable | 19 | from datetime import date, datetime, time, timedelta
from types import MappingProxyType
from typing import Optional, Union
from uuid import UUID, uuid4
import pytest
from django_unicorn.components import UnicornView
from django_unicorn.views.action_parsers.call_method import _call_method_name
from example.coffee.mode... | expected | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/action_parsers/utils/test_set_property_value.py | test_set_property_value_queryset | assert | variable | 31 | from datetime import datetime
from typing import List
import pytest
from django_unicorn.components import UnicornView
from django_unicorn.views.action_parsers.utils import set_property_value
from example.coffee.models import Flavor, Taste
@pytest.mark.django_db
def test_set_property_value_queryset():
component =... | queryset | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_message.py | test_message_component_with_dot | assert | variable | 34 | import time
from uuid import uuid4
import pytest
from django.http import JsonResponse
from django_unicorn.errors import ComponentClassLoadError, ComponentModuleLoadError
from django_unicorn.views import message
def assert_json_error(response, error):
assert isinstance(response, JsonResponse)
assert response.... | expected | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/test_typer.py | test_cast_value_dataclass | assert | variable | 20 | import datetime
from dataclasses import dataclass
from typing import List, Optional
from typing import get_type_hints as typing_get_type_hints
from pydantic import BaseModel
from django_unicorn.components import UnicornView
from django_unicorn.typer import cast_attribute_value, cast_value, get_type_hints
from example... | test_data | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/call_method_parser/test_parse_kwarg.py | test_kwargs_raise_unparseable_value | assert | variable | 10 | import pytest
from django_unicorn.call_method_parser import InvalidKwargError, parse_kwarg
def test_kwargs_raise_unparseable_value():
with pytest.raises(ValueError) as e:
parse_kwarg("test=some_context_variable", raise_if_unparseable=True)
assert e.type is | ValueError | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/test_utils.py | test_generate_checksum_invalid | pytest.raises | variable | 16 | import pytest
from django.template.backends.django import Template
from django_unicorn.utils import (
create_template,
generate_checksum,
get_method_arguments,
is_non_string_sequence,
sanitize_html,
)
def test_generate_checksum_invalid(settings):
settings.SECRET_KEY = "asdf"
with pytest.... | TypeError) | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/action_parsers/call_method/test_call_method_name.py | test_call_method_name_with_invalid_custom_class_type_hint | pytest.raises | variable | 30 | from datetime import date, datetime, time, timedelta
from types import MappingProxyType
from typing import Optional, Union
from uuid import UUID, uuid4
import pytest
from django_unicorn.components import UnicornView
from django_unicorn.views.action_parsers.call_method import _call_method_name
from example.coffee.mode... | TypeError) | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/call_method_parser/test_parse_kwarg.py | test_kwargs_raise_unparseable_value | pytest.raises | variable | 7 | import pytest
from django_unicorn.call_method_parser import InvalidKwargError, parse_kwarg
def test_kwargs_raise_unparseable_value():
with pytest.raises( | ValueError) | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/management/commands/startunicorn/test_handle.py | test_handle_reply_n | pytest.raises | variable | 22 | import io
import os
import uuid
import pytest
from django.core.management.base import CommandError
from django_unicorn.management.commands.startunicorn import Command
def test_handle_reply_n(settings, tmp_path, monkeypatch, capsys):
settings.BASE_DIR = tmp_path
# Reply "n"
monkeypatch.setattr("sys.stdin... | CommandError) | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/test_cacher.py | test_cacheable_component_extra_context_is_none_then_restored | assert | variable | 21 | from unittest.mock import MagicMock, patch
from django_unicorn.cacher import (
CacheableComponent,
cache_full_tree,
restore_from_cache,
)
from django_unicorn.components import UnicornView
def test_cacheable_component_extra_context_is_none_then_restored():
component = FakeComponent(
component_i... | extra_context | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/components/test_get_locations.py | test_get_locations_apps_setting_invalid | assert | variable | 23 | import pytest
from django_unicorn.components.unicorn_view import get_locations
def cache_clear():
get_locations.cache_clear()
def clear_apps(settings):
unicorn_apps = settings.UNICORN["APPS"]
del settings.UNICORN["APPS"]
yield
settings.UNICORN["APPS"] = unicorn_apps
def test_get_locations_apps... | AssertionError | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/test_settings.py | test_get_morpher_settings | assert | variable | 23 | import pytest
from django_unicorn.settings import (
get_cache_alias,
get_minify_html_enabled,
get_morpher_settings,
get_script_location,
get_serial_enabled,
)
def test_get_morpher_settings(settings):
assert get_morpher_settings() == {"NAME": "morphdom"}
settings.UNICORN["MORPHER"] = {"NAM... | AssertionError | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/components/test_get_locations.py | test_get_locations_apps_setting_invalid | pytest.raises | variable | 20 | import pytest
from django_unicorn.components.unicorn_view import get_locations
def cache_clear():
get_locations.cache_clear()
def clear_apps(settings):
unicorn_apps = settings.UNICORN["APPS"]
del settings.UNICORN["APPS"]
yield
settings.UNICORN["APPS"] = unicorn_apps
def test_get_locations_apps... | AssertionError) | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/components/test_get_locations.py | test_get_locations_installed_app_with_apps | assert | variable | 27 | import pytest
from django_unicorn.components.unicorn_view import get_locations
def cache_clear():
get_locations.cache_clear()
def clear_apps(settings):
unicorn_apps = settings.UNICORN["APPS"]
del settings.UNICORN["APPS"]
yield
settings.UNICORN["APPS"] = unicorn_apps
def test_get_locations_inst... | actual_location | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/test_settings.py | test_get_morpher_settings | pytest.raises | variable | 20 | import pytest
from django_unicorn.settings import (
get_cache_alias,
get_minify_html_enabled,
get_morpher_settings,
get_script_location,
get_serial_enabled,
)
def test_get_morpher_settings(settings):
assert get_morpher_settings() == {"NAME": "morphdom"}
settings.UNICORN["MORPHER"] = {"NAM... | AssertionError) | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/test_unicorn_view_init.py | test_init_no_component_name | pytest.raises | variable | 8 | import pytest
from django.template.backends.django import Template
from django_unicorn.components import UnicornView
def test_init_no_component_name():
with pytest.raises( | AssertionError) | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/call_method_parser/test_parse_kwarg.py | test_kwargs_invalid_startswith_doublequote | assert | variable | 10 | import pytest
from django_unicorn.call_method_parser import InvalidKwargError, parse_kwarg
def test_kwargs_invalid_startswith_doublequote():
with pytest.raises(InvalidKwargError) as e:
parse_kwarg('"test"=2')
assert e.type == | InvalidKwargError | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/call_method_parser/test_parse_kwarg.py | test_kwargs_invalid_startswith_doublequote | pytest.raises | variable | 7 | import pytest
from django_unicorn.call_method_parser import InvalidKwargError, parse_kwarg
def test_kwargs_invalid_startswith_doublequote():
with pytest.raises( | InvalidKwargError) | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_message.py | test_message_component_class_not_loaded | assert | variable | 51 | import time
from uuid import uuid4
import pytest
from django.http import JsonResponse
from django_unicorn.errors import ComponentClassLoadError, ComponentModuleLoadError
from django_unicorn.views import message
def assert_json_error(response, error):
assert isinstance(response, JsonResponse)
assert response.... | expected_locations | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/serializer/test_exclude_field_attributes.py | test_exclude_field_attributes_invalid_field_name | pytest.raises | variable | 13 | import pytest
from django_unicorn.serializer import (
InvalidFieldAttributeError,
InvalidFieldNameError,
_exclude_field_attributes,
)
def test_exclude_field_attributes_invalid_field_name():
dict_data = {"test": None}
with pytest.raises( | InvalidFieldNameError) | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_message.py | test_message_component_class_not_loaded | pytest.raises | variable | 27 | import time
from uuid import uuid4
import pytest
from django.http import JsonResponse
from django_unicorn.errors import ComponentClassLoadError, ComponentModuleLoadError
from django_unicorn.views import message
def assert_json_error(response, error):
assert isinstance(response, JsonResponse)
assert response.... | ComponentClassLoadError) | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/components/test_create.py | test_no_component | pytest.raises | variable | 8 | import pytest
from django_unicorn.components.unicorn_view import UnicornView
from django_unicorn.errors import ComponentModuleLoadError
def test_no_component():
with pytest.raises( | ComponentModuleLoadError) | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_message.py | test_message_component_module_not_loaded | pytest.raises | variable | 27 | import time
from uuid import uuid4
import pytest
from django.http import JsonResponse
from django_unicorn.errors import ComponentClassLoadError, ComponentModuleLoadError
from django_unicorn.views import message
def assert_json_error(response, error):
assert isinstance(response, JsonResponse)
assert response.... | ComponentModuleLoadError) | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_message.py | test_message_component_class_not_loaded | assert | variable | 38 | import time
from uuid import uuid4
import pytest
from django.http import JsonResponse
from django_unicorn.errors import ComponentClassLoadError, ComponentModuleLoadError
from django_unicorn.views import message
def assert_json_error(response, error):
assert isinstance(response, JsonResponse)
assert response.... | expected_exception_message | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/serializer/test_exclude_field_attributes.py | test_exclude_field_attributes_empty_value | pytest.raises | variable | 13 | import pytest
from django_unicorn.serializer import (
InvalidFieldAttributeError,
InvalidFieldNameError,
_exclude_field_attributes,
)
def test_exclude_field_attributes_empty_value():
dict_data = {"1": {}}
with pytest.raises( | InvalidFieldAttributeError) | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/call_method_parser/test_parse_kwarg.py | test_kwargs_int | assert | numeric_literal | 12 | import pytest
from django_unicorn.call_method_parser import InvalidKwargError, parse_kwarg
def test_kwargs_int():
expected = {"test": 2}
actual = parse_kwarg("test=2")
assert actual == expected
assert isinstance(actual["test"], int)
assert actual["test"] == | 2 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/components/test_component.py | test_init_attribute_names_cache | assert | numeric_literal | 19 | import types
import orjson
import pytest
from tests.views.fake_components import (
FakeAuthenticationComponent,
FakeValidationComponent,
)
from django_unicorn.components import UnicornView
from django_unicorn.serializer import InvalidFieldNameError
def component():
return ExampleComponent(component_id="a... | 1 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/components/test_component.py | test_get_frontend_context_variables_javascript_exclude | assert | numeric_literal | 25 | import types
import orjson
import pytest
from tests.views.fake_components import (
FakeAuthenticationComponent,
FakeValidationComponent,
)
from django_unicorn.components import UnicornView
from django_unicorn.serializer import InvalidFieldNameError
def component():
return ExampleComponent(component_id="a... | 0 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/components/test_component.py | test_get_context_data | assert | numeric_literal | 19 | import types
import orjson
import pytest
from tests.views.fake_components import (
FakeAuthenticationComponent,
FakeValidationComponent,
)
from django_unicorn.components import UnicornView
from django_unicorn.serializer import InvalidFieldNameError
def component():
return ExampleComponent(component_id="a... | 4 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/templatetags/test_unicorn.py | test_unicorn | assert | numeric_literal | 11 | from django.template.base import Parser, Token, TokenType
from django_unicorn.templatetags.unicorn import unicorn
def test_unicorn():
token = Token(TokenType.TEXT, "unicorn 'todo'")
unicorn_node = unicorn(Parser([]), token)
assert unicorn_node.component_name.resolve({}) == "todo"
assert len(unicorn_... | 0 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/templatetags/test_unicorn_render.py | test_unicorn_render_component_one_script_tag | assert | numeric_literal | 25 | import re
import pytest
from django.template import Context
from django.template.base import Parser, Token, TokenType
from django_unicorn.components import UnicornView
from django_unicorn.errors import ComponentNotValidError
from django_unicorn.templatetags.unicorn import unicorn
from django_unicorn.utils import gene... | 1 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/test_model_lifecycle.py | test_queryset | assert | numeric_literal | 13 | import pytest
from django_unicorn.components import UnicornView
from django_unicorn.serializer import dumps, loads
from django_unicorn.typer import _construct_model
from django_unicorn.views.utils import set_property_from_data
from example.coffee.models import Flavor
@pytest.mark.django_db
def test_queryset():
te... | 0 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/test_model_lifecycle.py | test_queryset | assert | numeric_literal | 25 | import pytest
from django_unicorn.components import UnicornView
from django_unicorn.serializer import dumps, loads
from django_unicorn.typer import _construct_model
from django_unicorn.views.utils import set_property_from_data
from example.coffee.models import Flavor
@pytest.mark.django_db
def test_queryset():
te... | 1 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/test_typer.py | test_cast_value_model_int | assert | numeric_literal | 22 | import datetime
from dataclasses import dataclass
from typing import List, Optional
from typing import get_type_hints as typing_get_type_hints
from pydantic import BaseModel
from django_unicorn.components import UnicornView
from django_unicorn.typer import cast_attribute_value, cast_value, get_type_hints
from example... | 1 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/action_parsers/utils/test_set_property_value.py | test_set_property_value_queryset | assert | numeric_literal | 14 | from datetime import datetime
from typing import List
import pytest
from django_unicorn.components import UnicornView
from django_unicorn.views.action_parsers.utils import set_property_value
from example.coffee.models import Flavor, Taste
@pytest.mark.django_db
def test_set_property_value_queryset():
component =... | 0 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/action_parsers/utils/test_set_property_value.py | test_set_property_value_queryset | assert | numeric_literal | 30 | from datetime import datetime
from typing import List
import pytest
from django_unicorn.components import UnicornView
from django_unicorn.views.action_parsers.utils import set_property_value
from example.coffee.models import Flavor, Taste
@pytest.mark.django_db
def test_set_property_value_queryset():
component =... | 2 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/action_parsers/utils/test_set_property_value.py | test_set_property_value_many_to_many_is_referenced | assert | numeric_literal | 33 | from datetime import datetime
from typing import List
import pytest
from django_unicorn.components import UnicornView
from django_unicorn.views.action_parsers.utils import set_property_value
from example.coffee.models import Flavor, Taste
@pytest.mark.django_db
def test_set_property_value_many_to_many_is_referenced(... | 1 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_call_method.py | test_message_call_method | assert | numeric_literal | 39 | import time
from typing import Dict, Optional
import orjson
import shortuuid
from tests.views.message.utils import post_and_get_response
from django_unicorn.components import UnicornView, unicorn_view
from django_unicorn.utils import generate_checksum
def _post_to_component(
client,
method_name: str,
com... | 1 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_call_method.py | test_message_call_method_setter | assert | numeric_literal | 39 | import time
from typing import Dict, Optional
import orjson
import shortuuid
from tests.views.message.utils import post_and_get_response
from django_unicorn.components import UnicornView, unicorn_view
from django_unicorn.utils import generate_checksum
def _post_to_component(
client,
method_name: str,
com... | 2 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_call_method.py | test_message_call_method_args | assert | numeric_literal | 39 | import time
from typing import Dict, Optional
import orjson
import shortuuid
from tests.views.message.utils import post_and_get_response
from django_unicorn.components import UnicornView, unicorn_view
from django_unicorn.utils import generate_checksum
def _post_to_component(
client,
method_name: str,
com... | 3 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_call_method.py | test_message_call_method_reset | assert | numeric_literal | 51 | import time
from typing import Dict, Optional
import orjson
import shortuuid
from tests.views.message.utils import post_and_get_response
from django_unicorn.components import UnicornView, unicorn_view
from django_unicorn.utils import generate_checksum
def _post_to_component(
client,
method_name: str,
com... | 0 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_call_method_multiple.py | test_message_single | assert | numeric_literal | 64 | import time
from copy import deepcopy
from multiprocessing.dummy import Pool as ThreadPool
import orjson
import pytest
import shortuuid
from django_unicorn.components import UnicornView
from django_unicorn.utils import generate_checksum
def _set_serial(
settings,
enabled,
timeout,
cache_backend="djan... | 1 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_call_method_multiple.py | test_message_two | assert | numeric_literal | 63 | import time
from copy import deepcopy
from multiprocessing.dummy import Pool as ThreadPool
import orjson
import pytest
import shortuuid
from django_unicorn.components import UnicornView
from django_unicorn.utils import generate_checksum
def _set_serial(
settings,
enabled,
timeout,
cache_backend="djan... | 2 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_call_method_multiple.py | test_message_multiple_with_updated_data | assert | numeric_literal | 75 | import time
from copy import deepcopy
from multiprocessing.dummy import Pool as ThreadPool
import orjson
import pytest
import shortuuid
from django_unicorn.components import UnicornView
from django_unicorn.utils import generate_checksum
def _set_serial(
settings,
enabled,
timeout,
cache_backend="djan... | 4 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_hash.py | test_message_hash_changes | assert | numeric_literal | 34 | import shortuuid
from tests.views.fake_components import FakeComponent
from tests.views.message.test_calls import FakeCallsComponent
from tests.views.message.utils import post_and_get_response
from django_unicorn.components import UnicornView
from django_unicorn.utils import generate_checksum
def test_message_hash_ch... | 1 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_hash.py | test_message_hash_no_change_but_parent | assert | numeric_literal | 18 | import shortuuid
from tests.views.fake_components import FakeComponent
from tests.views.message.test_calls import FakeCallsComponent
from tests.views.message.utils import post_and_get_response
from django_unicorn.components import UnicornView
from django_unicorn.utils import generate_checksum
def test_message_hash_no... | 0 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_set_property.py | test_setter_updated | assert | numeric_literal | 38 | import time
import orjson
import shortuuid
from django_unicorn.utils import generate_checksum
def _post_message_and_get_body(client, message, url="/message/tests.views.fake_components.FakeComponent"):
response = client.post(
url,
message,
content_type="application/json",
)
body =... | 2 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_sync_input.py | test_message_sync_input_choices_with_select_widget | assert | numeric_literal | 26 | from tests.views.message.utils import post_and_get_response
def test_message_sync_input_choices_with_select_widget(client):
"""
ModelForms with a Model that have a field with `choices` and the form's field uses a Select widget.
Need to handle Select widget specifically otherwise `field.widget.format_value`... | 2 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_target.py | test_message_target_id | assert | numeric_literal | 35 | import time
import shortuuid
from bs4 import BeautifulSoup
from django_unicorn.components import UnicornView
from django_unicorn.utils import generate_checksum
def test_message_target_id(client):
data = {"clicked": False}
message = {
"actionQueue": [
{
"payload": {"name": ... | 1 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_type_hints.py | assert_int | assert | numeric_literal | 18 | from dataclasses import dataclass
from decimal import Decimal
from tests.views.message.utils import post_and_get_response
from django_unicorn.components import UnicornView
class FakeObjectsComponent(UnicornView):
template_name = "templates/test_component.html"
decimal_example: Decimal = Decimal(1.1)
flo... | 4 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/test_unicorn_view_init.py | test_init_caches | assert | numeric_literal | 9 | import pytest
from django.template.backends.django import Template
from django_unicorn.components import UnicornView
def test_init_caches():
component = UnicornView(component_id="test_init_caches", component_name="hello_world")
assert len(component._methods_cache) == | 0 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/utils/test_construct_model.py | test_construct_model_simple_model | assert | numeric_literal | 16 | import pytest
from django_unicorn.typer import _construct_model
from example.books.models import Author, Book
from example.coffee.models import Flavor
def test_construct_model_simple_model():
model_data = {
"pk": 1,
"name": "test-name",
}
actual = _construct_model(Flavor, model_data)
... | 1 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/utils/test_set_property_from_data.py | component_queryset_field_asserts | assert | numeric_literal | 18 | import sys
from datetime import datetime, timezone
from typing import List
import pytest
from django.db.models import Model, QuerySet
from django_unicorn.components import UnicornView
from django_unicorn.typing import QuerySetType
from django_unicorn.views.utils import set_property_from_data
from example.coffee.model... | 1 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/utils/test_set_property_from_data.py | test_set_property_from_data_empty_queryset | assert | numeric_literal | 23 | import sys
from datetime import datetime, timezone
from typing import List
import pytest
from django.db.models import Model, QuerySet
from django_unicorn.components import UnicornView
from django_unicorn.typing import QuerySetType
from django_unicorn.views.utils import set_property_from_data
from example.coffee.model... | 0 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_call_method.py | test_message_call_method_kwargs | assert | numeric_literal | 39 | import time
from typing import Dict, Optional
import orjson
import shortuuid
from tests.views.message.utils import post_and_get_response
from django_unicorn.components import UnicornView, unicorn_view
from django_unicorn.utils import generate_checksum
def _post_to_component(
client,
method_name: str,
com... | 99 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_hash.py | test_message_hash_no_change | assert | numeric_literal | 34 | import shortuuid
from tests.views.fake_components import FakeComponent
from tests.views.message.test_calls import FakeCallsComponent
from tests.views.message.utils import post_and_get_response
from django_unicorn.components import UnicornView
from django_unicorn.utils import generate_checksum
def test_message_hash_no... | 304 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_hash.py | test_message_hash_no_change_but_parent | assert | numeric_literal | 42 | import shortuuid
from tests.views.fake_components import FakeComponent
from tests.views.message.test_calls import FakeCallsComponent
from tests.views.message.utils import post_and_get_response
from django_unicorn.components import UnicornView
from django_unicorn.utils import generate_checksum
def test_message_hash_no... | 200 | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/call_method_parser/test_parse_kwarg.py | test_kwargs_string | assert | string_literal | 12 | import pytest
from django_unicorn.call_method_parser import InvalidKwargError, parse_kwarg
def test_kwargs_string():
expected = {"test": "1"}
actual = parse_kwarg("test='1'")
assert actual == expected
assert isinstance(actual["test"], str)
assert actual["test"] == | "1" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/components/test_component.py | test_init_attribute_names_cache | assert | string_literal | 20 | import types
import orjson
import pytest
from tests.views.fake_components import (
FakeAuthenticationComponent,
FakeValidationComponent,
)
from django_unicorn.components import UnicornView
from django_unicorn.serializer import InvalidFieldNameError
def component():
return ExampleComponent(component_id="a... | "name" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/templatetags/test_unicorn.py | test_unicorn | assert | string_literal | 10 | from django.template.base import Parser, Token, TokenType
from django_unicorn.templatetags.unicorn import unicorn
def test_unicorn():
token = Token(TokenType.TEXT, "unicorn 'todo'")
unicorn_node = unicorn(Parser([]), token)
assert unicorn_node.component_name.resolve({}) == | "todo" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/action_parsers/call_method/test_call_method_name.py | test_call_method_name_with_custom_class_type_hint | assert | string_literal | 33 | from datetime import date, datetime, time, timedelta
from types import MappingProxyType
from typing import Optional, Union
from uuid import UUID, uuid4
import pytest
from django_unicorn.components import UnicornView
from django_unicorn.views.action_parsers.call_method import _call_method_name
from example.coffee.mode... | "test" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/components/test_component.py | test_init_attributes | assert | string_literal | 20 | import types
import orjson
import pytest
from tests.views.fake_components import (
FakeAuthenticationComponent,
FakeValidationComponent,
)
from django_unicorn.components import UnicornView
from django_unicorn.serializer import InvalidFieldNameError
def component():
return ExampleComponent(component_id="a... | "World" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/test_settings.py | test_get_script_location | assert | string_literal | 13 | import pytest
from django_unicorn.settings import (
get_cache_alias,
get_minify_html_enabled,
get_morpher_settings,
get_script_location,
get_serial_enabled,
)
def test_get_script_location(settings):
assert get_script_location() == | "after" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_type_hints.py | assert_dataclass | assert | string_literal | 28 | from dataclasses import dataclass
from decimal import Decimal
from tests.views.message.utils import post_and_get_response
from django_unicorn.components import UnicornView
class FakeObjectsComponent(UnicornView):
template_name = "templates/test_component.html"
decimal_example: Decimal = Decimal(1.1)
flo... | "world" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/test_settings.py | test_get_script_location | assert | string_literal | 17 | import pytest
from django_unicorn.settings import (
get_cache_alias,
get_minify_html_enabled,
get_morpher_settings,
get_script_location,
get_serial_enabled,
)
def test_get_script_location(settings):
assert get_script_location() == "after"
settings.UNICORN["SCRIPT_LOCATION"] = "append"
... | "append" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/test_settings.py | test_get_morpher_settings | assert | string_literal | 16 | import pytest
from django_unicorn.settings import (
get_cache_alias,
get_minify_html_enabled,
get_morpher_settings,
get_script_location,
get_serial_enabled,
)
def test_get_morpher_settings(settings):
assert get_morpher_settings() == {"NAME": "morphdom"}
settings.UNICORN["MORPHER"] = {"NAM... | "alpine" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/test_unicorn_set_property_value.py | test_set_property_value_array | assert | string_literal | 25 | from dataclasses import dataclass
import pytest
from django_unicorn.components import UnicornView
from django_unicorn.views.action_parsers.utils import set_property_value
from example.coffee.models import Flavor
@pytest.mark.django_db
def test_set_property_value_array():
flavor_one = Flavor(name="initial 1")
... | "test 1" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/utils/test_set_property_from_data.py | component_queryset_field_asserts | assert | string_literal | 19 | import sys
from datetime import datetime, timezone
from typing import List
import pytest
from django.db.models import Model, QuerySet
from django_unicorn.components import UnicornView
from django_unicorn.typing import QuerySetType
from django_unicorn.views.utils import set_property_from_data
from example.coffee.model... | "test-qs" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/templatetags/test_unicorn_scripts.py | test_unicorn_scripts | assert | string_literal | 8 | from django_unicorn.templatetags.unicorn import unicorn_scripts
def test_unicorn_scripts():
actual = unicorn_scripts()
assert actual["CSRF_HEADER_NAME"] == "X-CSRFTOKEN"
assert actual["CSRF_COOKIE_NAME"] == | "csrftoken" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/templatetags/test_unicorn_scripts.py | test_unicorn_scripts_csrf_header_name | assert | string_literal | 8 | from django_unicorn.templatetags.unicorn import unicorn_scripts
def test_unicorn_scripts_csrf_header_name(settings):
settings.CSRF_HEADER_NAME = "HTTP_X_UNICORN"
actual = unicorn_scripts()
assert actual["CSRF_HEADER_NAME"] == | "X-UNICORN" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/utils/test_construct_model.py | test_construct_model_simple_model | assert | string_literal | 17 | import pytest
from django_unicorn.typer import _construct_model
from example.books.models import Author, Book
from example.coffee.models import Flavor
def test_construct_model_simple_model():
model_data = {
"pk": 1,
"name": "test-name",
}
actual = _construct_model(Flavor, model_data)
... | "test-name" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/utils/test_set_property_from_data.py | test_set_property_from_data_model | assert | string_literal | 29 | import sys
from datetime import datetime, timezone
from typing import List
import pytest
from django.db.models import Model, QuerySet
from django_unicorn.components import UnicornView
from django_unicorn.typing import QuerySetType
from django_unicorn.views.utils import set_property_from_data
from example.coffee.model... | "test-test" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/templatetags/test_unicorn_scripts.py | test_unicorn_scripts | assert | string_literal | 7 | from django_unicorn.templatetags.unicorn import unicorn_scripts
def test_unicorn_scripts():
actual = unicorn_scripts()
assert actual["CSRF_HEADER_NAME"] == | "X-CSRFTOKEN" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/test_process_component_request.py | test_html_entities_encoded | assert | string_literal | 22 | from tests.views.message.utils import post_and_get_response
from django_unicorn.components import UnicornView
def test_html_entities_encoded(client):
data = {"hello": "test"}
action_queue = [
{
"payload": {"name": "hello", "value": "<b>test1</b>"},
"type": "syncInput",
... | "<b>test1</b>" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/utils/test_set_property_from_data.py | test_set_property_from_data_model | assert | string_literal | 23 | import sys
from datetime import datetime, timezone
from typing import List
import pytest
from django.db.models import Model, QuerySet
from django_unicorn.components import UnicornView
from django_unicorn.typing import QuerySetType
from django_unicorn.views.utils import set_property_from_data
from example.coffee.model... | "test-initial" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_message.py | test_message_no_epoch | assert_* | string_literal | 23 | import time
from uuid import uuid4
import pytest
from django.http import JsonResponse
from django_unicorn.errors import ComponentClassLoadError, ComponentModuleLoadError
from django_unicorn.views import message
def assert_json_error(response, error):
assert isinstance(response, JsonResponse)
assert response.... | "Missing epoch") | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_set_property.py | test_equal_sign | assert | string_literal | 37 | import time
import orjson
import shortuuid
from django_unicorn.utils import generate_checksum
def _post_message_and_get_body(client, message, url="/message/tests.views.fake_components.FakeComponent"):
response = client.post(
url,
message,
content_type="application/json",
)
body =... | "does=thiswork?" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_target.py | test_message_target_id | assert | string_literal | 36 | import time
import shortuuid
from bs4 import BeautifulSoup
from django_unicorn.components import UnicornView
from django_unicorn.utils import generate_checksum
def test_message_target_id(client):
data = {"clicked": False}
message = {
"actionQueue": [
{
"payload": {"name": ... | "test-target-id" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_target.py | test_message_target_only_key | assert | string_literal | 36 | import time
import shortuuid
from bs4 import BeautifulSoup
from django_unicorn.components import UnicornView
from django_unicorn.utils import generate_checksum
def test_message_target_only_key(client):
data = {"clicked": False}
message = {
"actionQueue": [
{
"payload": {"n... | "test-target-key" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/templatetags/test_unicorn_scripts.py | test_unicorn_scripts_csrf_cookie_name | assert | string_literal | 8 | from django_unicorn.templatetags.unicorn import unicorn_scripts
def test_unicorn_scripts_csrf_cookie_name(settings):
settings.CSRF_COOKIE_NAME = "unicorn-csrftoken"
actual = unicorn_scripts()
assert actual["CSRF_COOKIE_NAME"] == | "unicorn-csrftoken" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_message.py | test_message_no_checksum | assert_* | string_literal | 27 | import time
from uuid import uuid4
import pytest
from django.http import JsonResponse
from django_unicorn.errors import ComponentClassLoadError, ComponentModuleLoadError
from django_unicorn.views import message
def assert_json_error(response, error):
assert isinstance(response, JsonResponse)
assert response.... | "Missing checksum") | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/test_unicorn_view_init.py | test_init_component_name_valid_template_name | assert | string_literal | 9 | import pytest
from django.template.backends.django import Template
from django_unicorn.components import UnicornView
def test_init_component_name_valid_template_name():
component = UnicornView(component_id="test_init_component_name_valid_template_name", component_name="test")
assert component.template_name =... | "unicorn/test.html" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_message.py | test_message_no_data | assert_* | string_literal | 23 | import time
from uuid import uuid4
import pytest
from django.http import JsonResponse
from django_unicorn.errors import ComponentClassLoadError, ComponentModuleLoadError
from django_unicorn.views import message
def assert_json_error(response, error):
assert isinstance(response, JsonResponse)
assert response.... | "Invalid JSON body") | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/components/test_unicorn_template_response.py | test_assert_has_single_wrapper_element_true | assert_* | string_literal | 22 | import pytest
from bs4 import BeautifulSoup
from django_unicorn.components.unicorn_template_response import (
UnicornTemplateResponse,
assert_has_single_wrapper_element,
get_root_element,
)
from django_unicorn.errors import (
MissingComponentElementError,
MissingComponentViewElementError,
Multi... | "test-component-name") | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/call_method_parser/test_parse_kwarg.py | test_kwargs_skip_unparseable_value | assert | string_literal | 12 | import pytest
from django_unicorn.call_method_parser import InvalidKwargError, parse_kwarg
def test_kwargs_skip_unparseable_value():
expected = {"test": "some_context_variable"}
actual = parse_kwarg("test=some_context_variable")
assert actual == expected
assert isinstance(actual["test"], str)
as... | "some_context_variable" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_message.py | test_message_no_component_id | assert_* | string_literal | 27 | import time
from uuid import uuid4
import pytest
from django.http import JsonResponse
from django_unicorn.errors import ComponentClassLoadError, ComponentModuleLoadError
from django_unicorn.views import message
def assert_json_error(response, error):
assert isinstance(response, JsonResponse)
assert response.... | "Missing component id") | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/test_unicorn_view_init.py | test_init_component_id | assert | string_literal | 9 | import pytest
from django.template.backends.django import Template
from django_unicorn.components import UnicornView
def test_init_component_id():
component = UnicornView(component_name="test", component_id="test_init_component_id")
assert component.component_id == | "test_init_component_id" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_message.py | test_message_bad_checksum | assert_* | string_literal | 28 | import time
from uuid import uuid4
import pytest
from django.http import JsonResponse
from django_unicorn.errors import ComponentClassLoadError, ComponentModuleLoadError
from django_unicorn.views import message
def assert_json_error(response, error):
assert isinstance(response, JsonResponse)
assert response.... | "Checksum does not match") | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/test_unicorn_view_init.py | test_init_kebab_component_name_valid_template_name | assert | string_literal | 11 | import pytest
from django.template.backends.django import Template
from django_unicorn.components import UnicornView
def test_init_kebab_component_name_valid_template_name():
component = UnicornView(
component_id="test_init_kebab_component_name_valid_template_name", component_name="hello-world"
)
... | "unicorn/hello-world.html" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/test_unicorn_view_init.py | test_init_snake_component_name_valid_template_name | assert | string_literal | 11 | import pytest
from django.template.backends.django import Template
from django_unicorn.components import UnicornView
def test_init_snake_component_name_valid_template_name():
component = UnicornView(
component_id="test_init_snake_component_name_valid_template_name", component_name="hello_world"
)
... | "unicorn/hello_world.html" | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
django-commons/django-unicorn | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | train | train | tests/views/message/test_message.py | test_message_no_body | assert_* | string_literal | 22 | import time
from uuid import uuid4
import pytest
from django.http import JsonResponse
from django_unicorn.errors import ComponentClassLoadError, ComponentModuleLoadError
from django_unicorn.views import message
def assert_json_error(response, error):
assert isinstance(response, JsonResponse)
assert response.... | "Body could not be parsed") | 04be090fec6234f5501f47f1c4661beb454db861 | 139 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.