repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
django-commons/django-unicorn | import json
from unittest.mock import Mock
import pytest
from django_unicorn.components import Component
from django_unicorn.errors import RenderNotModifiedError
from django_unicorn.utils import generate_checksum
from django_unicorn.views.action import CallMethod, Refresh, SyncInput, Toggle
from django_unicorn.views.... | "test-component" | assert | string_literal | tests/views/test_unit_views.py | test_component_request_parsing | 54 | null | |
django-commons/django-unicorn | 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_settings_cache_alias(settings):
settings.UNICORN = {**settings.UNICORN, "CACHE_ALIAS": "unicorn_cache"}
expected = "unico... | actual | assert | variable | tests/test_settings.py | test_settings_cache_alias | 17 | null | |
django-commons/django-unicorn | import pytest
from django_unicorn.typer import _construct_model
from example.books.models import Author, Book
from example.coffee.models import Flavor
@pytest.mark.django_db
def test_construct_model_many_to_many():
author = Author(name="author 1")
author.save()
book = Book(title="book 1", date_published="... | author.pk | assert | complex_expr | tests/views/utils/test_construct_model.py | test_construct_model_many_to_many | 81 | null | |
django-commons/django-unicorn | import time
from typing import Any
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,
component_name... | [] | assert | collection | tests/views/message/test_call_method.py | test_message_call_method_return_value | 131 | null | |
django-commons/django-unicorn | from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect
from django.test import RequestFactory
from django_unicorn.components.unicorn_view import UnicornView, construct_component
def test_mount_response_direct_view():
request = RequestFactory().get("/")
view = Response... | "Custom Content" | assert | string_literal | tests/components/test_mount_redirect.py | test_mount_response_direct_view | 33 | null | |
django-commons/django-unicorn | import pytest
from tests.views.message.utils import post_and_get_response
from django_unicorn.components import UnicornView
from example.coffee.models import Flavor
@pytest.mark.django_db
def test_fk_loading(client):
# Setup
parent_flavor = Flavor.objects.create(name="Parent")
child_flavor = Flavor.object... | child_flavor.pk | assert | complex_expr | tests/views/test_fk_loading.py | test_fk_loading | 49 | null | |
django-commons/django-unicorn | import datetime
from dataclasses import dataclass
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.coffee.models import Flavor
def ... | None | assert | none_literal | tests/test_typer.py | test_cast_value_model_none | 85 | null | |
django-commons/django-unicorn | 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 | assert | numeric_literal | tests/views/test_unicorn_view_init.py | test_init_caches | 63 | null | |
django-commons/django-unicorn | 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... | str(flavor.uuid) | assert | func_call | tests/test_model_lifecycle.py | test_queryset | 69 | null | |
django-commons/django-unicorn | 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_serial_enabled(settings):
settings.UNICORN = {**settings.UNICORN, "SERIAL": {**settings.UNICORN.get("SERIAL", {}), "ENABLE... | True | assert | bool_literal | tests/test_settings.py | test_get_serial_enabled | 34 | null | |
django-commons/django-unicorn | 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")
f... | "world" | assert | string_literal | tests/views/message/test_type_hints.py | assert_dataclass | FakeObjectsComponent | 34 | null |
django-commons/django-unicorn | import time
from typing import Any
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,
component_name... | 0 | assert | numeric_literal | tests/views/message/test_call_method.py | test_message_call_method_reset | 234 | null | |
django-commons/django-unicorn | from datetime import date, datetime, time, timedelta
from types import MappingProxyType
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.models import Flavor
def _get_actual(m... | TypeError) | pytest.raises | variable | tests/views/action_parsers/call_method/test_call_method_name.py | test_call_method_name_with_invalid_custom_class_type_hint | 257 | null | |
django-commons/django-unicorn | from datetime import datetime
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_str():
component = FakeComponent(component_name="test", component_id="... | string | assert | variable | tests/views/action_parsers/utils/test_set_property_value.py | test_set_property_value_str | 34 | null | |
django-commons/django-unicorn | 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 | assert | numeric_literal | tests/views/message/test_set_property.py | test_setter_updated | 57 | null | |
django-commons/django-unicorn | from django.template.base import Parser, Token, TokenType
from django_unicorn.templatetags.unicorn import unicorn
def test_unicorn_kwargs():
token = Token(TokenType.TEXT, "unicorn 'todo' blob='blob'")
unicorn_node = unicorn(Parser([]), token)
assert unicorn_node.kwargs == | {"blob": "blob"} | assert | collection | tests/templatetags/test_unicorn.py | test_unicorn_kwargs | 18 | null | |
sissbruecker/linkding | import os
from django.conf import settings
from django.test import TestCase
from bookmarks.models import BookmarkAsset
from bookmarks.services import bookmarks
from bookmarks.tests.helpers import BookmarkFactoryMixin
class BookmarkAssetsTestCase(TestCase, BookmarkFactoryMixin):
def setUp(self):
self.setu... | asset.file_size) | self.assertIsNone | complex_expr | bookmarks/tests/test_bookmark_assets.py | test_save_updates_file_size | BookmarkAssetsTestCase | 73 | null |
sissbruecker/linkding | from django.urls import reverse
from playwright.sync_api import expect
from bookmarks.models import Tag
from bookmarks.tests_e2e.helpers import LinkdingE2ETestCase
class TagManagementE2ETestCase(LinkdingE2ETestCase):
def locate_tag_modal(self):
modal = self.page.locator("ld-modal.tag-edit-modal")
... | self.page.url) | self.assertIn | complex_expr | bookmarks/tests_e2e/e2e_test_tag_management.py | test_search_updates_url_query_params | TagManagementE2ETestCase | 361 | null |
sissbruecker/linkding | import os
from unittest import mock
from django.test import TestCase
from bookmarks.management.commands.create_initial_superuser import Command
from bookmarks.models import User
class TestCreateInitialSuperuserCommand(TestCase):
@mock.patch.dict(
os.environ,
{"LD_SUPERUSER_NAME": "john", "LD_SUPE... | user.username) | self.assertEqual | complex_expr | bookmarks/tests/test_create_initial_superuser_command.py | test_create_with_password | TestCreateInitialSuperuserCommand | 21 | null |
sissbruecker/linkding | from django.test import TestCase
from bookmarks.forms import BookmarkSearchForm
from bookmarks.models import BookmarkSearch
from bookmarks.tests.helpers import BookmarkFactoryMixin
class BookmarkSearchFormTest(TestCase, BookmarkFactoryMixin):
def test_initial_values(self):
# no params
search = Boo... | "") | self.assertEqual | string_literal | bookmarks/tests/test_bookmark_search_form.py | test_initial_values | BookmarkSearchFormTest | 13 | null |
sissbruecker/linkding | from django.test import TestCase
from bookmarks.services import auto_tagging
class AutoTaggingTestCase(TestCase):
def test_auto_tag_with_url_fragment(self):
script = """
example.com/#/section/1 section1
example.com/#/section/2 section2
"""
url = "https://example.co... | {"section1"}) | self.assertEqual | collection | bookmarks/tests/test_auto_tagging.py | test_auto_tag_with_url_fragment | AutoTaggingTestCase | 216 | null |
sissbruecker/linkding | from datetime import UTC, datetime
from django.test import TestCase
from bookmarks.services import exporter
from bookmarks.tests.helpers import BookmarkFactoryMixin
class ExporterTestCase(TestCase, BookmarkFactoryMixin):
def test_export_bookmarks(self):
bookmarks = [
self.setup_bookmark(
... | html) | self.assertIn | variable | bookmarks/tests/test_exporter.py | test_export_bookmarks | ExporterTestCase | 92 | null |
sissbruecker/linkding | from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import reverse
from bookmarks.models import build_tag_string
from bookmarks.tests.helpers import BookmarkFactoryMixin
class BookmarkEditViewTestCase(TestCase, BookmarkFactoryMixin):
def setUp(self) -> None:
user ... | self.user) | self.assertEqual | complex_expr | bookmarks/tests/test_bookmark_edit_view.py | test_should_edit_bookmark | BookmarkEditViewTestCase | 45 | null |
sissbruecker/linkding | from django.http import QueryDict
from django.test import TestCase
from bookmarks.models import BookmarkSearch
from bookmarks.tests.helpers import BookmarkFactoryMixin
class BookmarkSearchModelTest(TestCase, BookmarkFactoryMixin):
def test_from_request_ignores_invalid_bundle_param(self):
self.setup_bundl... | search.bundle) | self.assertIsNone | complex_expr | bookmarks/tests/test_bookmark_search_model.py | test_from_request_ignores_invalid_bundle_param | BookmarkSearchModelTest | 87 | null |
sissbruecker/linkding | from bs4 import BeautifulSoup
from django.template import RequestContext, Template
from django.test import RequestFactory, TestCase
from bookmarks.models import BookmarkSearch
from bookmarks.tests.helpers import BookmarkFactoryMixin, HtmlTestMixin
class BookmarkSearchTagTest(TestCase, BookmarkFactoryMixin, HtmlTestMi... | button["class"]) | self.assertNotIn | complex_expr | bookmarks/tests/test_bookmark_search_tag.py | test_modified_indicator | BookmarkSearchTagTest | 192 | null |
sissbruecker/linkding | from django.urls import reverse
from rest_framework import status
from bookmarks.models import BookmarkBundle
from bookmarks.tests.helpers import BookmarkFactoryMixin, LinkdingApiTestCase
class BundlesApiTestCase(LinkdingApiTestCase, BookmarkFactoryMixin):
def assertBundle(self, bundle: BookmarkBundle, data: dict... | 3) | self.assertEqual | numeric_literal | bookmarks/tests/test_bundles_api.py | test_bundle_list | BundlesApiTestCase | 37 | null |
sissbruecker/linkding | from django.test import TestCase
from django.urls import reverse
from bookmarks.models import Bookmark
from bookmarks.tests.helpers import BookmarkFactoryMixin
class BookmarkNewViewTestCase(TestCase, BookmarkFactoryMixin):
def setUp(self) -> None:
user = self.get_or_create_test_user()
self.client.... | bookmark.shared) | self.assertTrue | complex_expr | bookmarks/tests/test_bookmark_new_view.py | test_should_create_new_shared_bookmark | BookmarkNewViewTestCase | 71 | null |
sissbruecker/linkding | import os
from django.conf import settings
from django.test import TestCase
from bookmarks.models import BookmarkAsset
from bookmarks.services import bookmarks
from bookmarks.tests.helpers import BookmarkFactoryMixin
class BookmarkAssetsTestCase(TestCase, BookmarkFactoryMixin):
def setUp(self):
self.setu... | 4) | self.assertEqual | numeric_literal | bookmarks/tests/test_bookmark_assets.py | test_save_updates_file_size | BookmarkAssetsTestCase | 78 | null |
sissbruecker/linkding | import datetime
import io
import urllib.parse
from collections import OrderedDict
from unittest.mock import ANY, patch
from django.contrib.auth.models import User
from django.test import override_settings
from django.urls import reverse
from django.utils import timezone
from rest_framework import status
from rest_fram... | 0) | self.assertEqual | numeric_literal | bookmarks/tests/test_bookmarks_api.py | test_delete_bookmark | BookmarksApiTestCase | 955 | null |
sissbruecker/linkding | import io
import os
import tempfile
from pathlib import Path
from unittest import mock
from django.conf import settings
from django.test import TestCase
from bookmarks.services import preview_image_loader
mock_image_data = b"mock_image"
class PreviewImageLoaderTestCase(TestCase):
def setUp(self) -> None:
... | file.split(".")[-1]) | self.assertEqual | func_call | bookmarks/tests/test_preview_image_loader.py | test_guess_file_extension | PreviewImageLoaderTestCase | 199 | null |
sissbruecker/linkding | from unittest import mock
from django.test import TestCase
from bookmarks.services import website_loader
class WebsiteLoaderTestCase(TestCase):
def setUp(self):
# clear cached metadata before test run
website_loader._load_website_metadata_cached.cache_clear()
def render_html_document(
... | metadata.title) | self.assertEqual | complex_expr | bookmarks/tests/test_website_loader.py | test_load_website_metadata | WebsiteLoaderTestCase | 113 | null |
sissbruecker/linkding | from django.test import TestCase
from bookmarks.services import auto_tagging
class AutoTaggingTestCase(TestCase):
def test_auto_tag_with_url_fragment_partial_match(self):
script = """
example.com/#/section section
"""
url = "https://example.com/#/section/1"
tags = aut... | {"section"}) | self.assertEqual | collection | bookmarks/tests/test_auto_tagging.py | test_auto_tag_with_url_fragment_partial_match | AutoTaggingTestCase | 226 | null |
sissbruecker/linkding | from bs4 import BeautifulSoup
from django.template import RequestContext, Template
from django.test import RequestFactory, TestCase
from bookmarks.models import BookmarkSearch
from bookmarks.tests.helpers import BookmarkFactoryMixin, HtmlTestMixin
class BookmarkSearchTagTest(TestCase, BookmarkFactoryMixin, HtmlTestMi... | select) | self.assertIsNotNone | variable | bookmarks/tests/test_bookmark_search_tag.py | assertSelect | BookmarkSearchTagTest | 49 | null |
sissbruecker/linkding | from django.test import TestCase
from bookmarks.models import UserProfile
from bookmarks.services.search_query_parser import (
AndExpression,
NotExpression,
OrExpression,
SearchExpression,
SearchQueryParseError,
SearchQueryTokenizer,
SpecialKeywordExpression,
TagExpression,
TermExpr... | 4) | self.assertEqual | numeric_literal | bookmarks/tests/test_search_query_parser.py | test_multiple_terms | SearchQueryTokenizerTest | 70 | null |
sissbruecker/linkding | import datetime
import re
from django.test import TestCase, override_settings
from django.urls import reverse
from django.utils import formats, timezone
from bookmarks.models import BookmarkAsset, UserProfile
from bookmarks.tests.helpers import BookmarkFactoryMixin, HtmlTestMixin
class BookmarkDetailsModalTestCase(T... | form) | self.assertIsNotNone | variable | bookmarks/tests/test_bookmark_details_modal.py | test_status | BookmarkDetailsModalTestCase | 349 | null |
sissbruecker/linkding | import datetime
from django.test import TestCase
from django.utils import timezone
from bookmarks.models import Tag
from bookmarks.services.tags import get_or_create_tag, get_or_create_tags
from bookmarks.tests.helpers import BookmarkFactoryMixin
class TagServiceTestCase(TestCase, BookmarkFactoryMixin):
def setU... | [books_tag]) | self.assertListEqual | collection | bookmarks/tests/test_tags_service.py | test_get_or_create_tags_should_deduplicate_tags | TagServiceTestCase | 69 | null |
sissbruecker/linkding | from unittest.mock import patch
from django.test import TestCase, override_settings
from django.utils import timezone
from bookmarks.models import Bookmark, Tag, parse_tag_string
from bookmarks.services import tasks
from bookmarks.services.importer import ImportOptions, import_netscape_html
from bookmarks.tests.helpe... | 2) | self.assertEqual | numeric_literal | bookmarks/tests/test_importer.py | test_import_with_some_invalid_bookmarks | ImporterTestCase | 224 | null |
sissbruecker/linkding | import urllib.parse
from django.contrib.auth.models import User
from django.test import TestCase, override_settings
from django.urls import reverse
from bookmarks.models import BookmarkSearch, UserProfile
from bookmarks.tests.helpers import (
BookmarkFactoryMixin,
BookmarkListTestMixin,
TagCloudTestMixin,... | url) | self.assertEqual | variable | bookmarks/tests/test_bookmark_index_view.py | assertBulkActionForm | BookmarkIndexViewTestCase | 35 | null |
sissbruecker/linkding | from django.contrib.auth.models import AnonymousUser, User
from django.http import HttpResponse
from django.template import RequestContext, Template
from django.test import RequestFactory, TestCase
from bookmarks.middlewares import LinkdingMiddleware
from bookmarks.models import BookmarkSearch, UserProfile
from bookma... | tags) | self.assertEqual | variable | bookmarks/tests/test_tag_cloud_template.py | assertTagGroups | TagCloudTemplateTest | 48 | null |
sissbruecker/linkding | import datetime
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponse
from django.template import RequestContext, Template
from django.test import RequestFactory, TestCase
from django.urls import reverse
from django.utils import formats, timezone
from bookmarks.middlewares import L... | tags) | self.assertIsNone | variable | bookmarks/tests/test_bookmarks_list_template.py | inline_bookmark_description_test | BookmarkListTemplateTest | 329 | null |
sissbruecker/linkding | from bs4 import TemplateString
from bs4.element import CData, NavigableString
from django.test import TestCase
from django.urls import reverse
from bookmarks.models import Bookmark, Tag
from bookmarks.tests.helpers import BookmarkFactoryMixin, HtmlTestMixin
class TagsMergeViewTestCase(TestCase, BookmarkFactoryMixin, ... | [other_tag]) | self.assertCountEqual | collection | bookmarks/tests/test_tags_merge_view.py | test_merge_tags_complex | TagsMergeViewTestCase | 106 | null |
sissbruecker/linkding | import datetime
import re
from django.test import TestCase, override_settings
from django.urls import reverse
from django.utils import formats, timezone
from bookmarks.models import BookmarkAsset, UserProfile
from bookmarks.tests.helpers import BookmarkFactoryMixin, HtmlTestMixin
class BookmarkDetailsModalTestCase(T... | date) | self.assertIsNotNone | variable | bookmarks/tests/test_bookmark_details_modal.py | test_date_added | BookmarkDetailsModalTestCase | 434 | null |
sissbruecker/linkding | import datetime
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponse
from django.template import RequestContext, Template
from django.test import RequestFactory, TestCase
from django.urls import reverse
from django.utils import formats, timezone
from bookmarks.middlewares import L... | 1) | self.assertEqual | numeric_literal | bookmarks/tests/test_bookmarks_list_template.py | test_bookmark_tag_query_string | BookmarkListTemplateTest | 487 | null |
sissbruecker/linkding | from unittest import mock
import waybackpy
from django.contrib.auth.models import User
from django.test import TestCase, override_settings
from huey.contrib.djhuey import HUEY as huey
from waybackpy.exceptions import WaybackError
from bookmarks.models import BookmarkAsset, UserProfile
from bookmarks.services import t... | 0) | self.assertEqual | numeric_literal | bookmarks/tests/test_bookmarks_tasks.py | test_create_web_archive_snapshot_should_skip_if_snapshot_exists | BookmarkTasksTestCase | 107 | null |
sissbruecker/linkding | from django.test import TestCase
from django.urls import reverse
from bookmarks.tests.helpers import BookmarkFactoryMixin, HtmlTestMixin
class BundlePreviewViewTestCase(TestCase, BookmarkFactoryMixin, HtmlTestMixin):
def setUp(self) -> None:
user = self.get_or_create_test_user()
self.client.force_... | 1) | self.assertEqual | numeric_literal | bookmarks/tests/test_bundles_preview_view.py | test_preview_renders_bookmark_in_preview_mode | BundlePreviewViewTestCase | 81 | null |
sissbruecker/linkding | from unittest.mock import patch
from django.test import TestCase, override_settings
from django.utils import timezone
from bookmarks.models import Bookmark, Tag, parse_tag_string
from bookmarks.services import tasks
from bookmarks.services.importer import ImportOptions, import_netscape_html
from bookmarks.tests.helpe... | 1) | self.assertEqual | numeric_literal | bookmarks/tests/test_importer.py | test_import_with_some_invalid_bookmarks | ImporterTestCase | 223 | null |
sissbruecker/linkding | import urllib.parse
from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import reverse
from bookmarks.models import Bookmark, BookmarkSearch, UserProfile
from bookmarks.tests.helpers import (
BookmarkFactoryMixin,
BookmarkListTestMixin,
TagCloudTestMixin,
)
class... | feed) | self.assertIsNotNone | variable | bookmarks/tests/test_bookmark_shared_view.py | test_includes_public_shared_rss_feed | BookmarkSharedViewTestCase | 660 | null |
sissbruecker/linkding | from django.test import TestCase
from bookmarks.services import auto_tagging
class AutoTaggingTestCase(TestCase):
def test_auto_tag_by_domain_and_path(self):
script = """
example.com/one one
example.com/two two
test.com test
"""
url = "https://example.c... | {"one"}) | self.assertEqual | collection | bookmarks/tests/test_auto_tagging.py | test_auto_tag_by_domain_and_path | AutoTaggingTestCase | 92 | null |
sissbruecker/linkding | from django.urls import reverse
from rest_framework import status
from bookmarks.models import BookmarkBundle
from bookmarks.tests.helpers import BookmarkFactoryMixin, LinkdingApiTestCase
class BundlesApiTestCase(LinkdingApiTestCase, BookmarkFactoryMixin):
def assertBundle(self, bundle: BookmarkBundle, data: dict... | data["order"]) | self.assertEqual | complex_expr | bookmarks/tests/test_bundles_api.py | assertBundle | BundlesApiTestCase | 16 | null |
sissbruecker/linkding | from django.test import TestCase
from django.urls import reverse
from bookmarks.models import Bookmark
from bookmarks.tests.helpers import BookmarkFactoryMixin
class BookmarkNewViewTestCase(TestCase, BookmarkFactoryMixin):
def setUp(self) -> None:
user = self.get_or_create_test_user()
self.client.... | 1) | self.assertEqual | numeric_literal | bookmarks/tests/test_bookmark_new_view.py | test_should_create_new_bookmark | BookmarkNewViewTestCase | 33 | null |
sissbruecker/linkding | import gzip
import logging
import os
import random
import shutil
import tempfile
from datetime import datetime
from unittest import TestCase
from bs4 import BeautifulSoup
from django.conf import settings
from django.test import override_settings
from django.utils import timezone
from django.utils.crypto import get_ran... | len(tags)) | self.assertEqual | func_call | bookmarks/tests/helpers.py | assertVisibleTags | TagCloudTestMixin | 345 | null |
sissbruecker/linkding | from django.urls import reverse
from rest_framework import status
from bookmarks.models import BookmarkBundle
from bookmarks.tests.helpers import BookmarkFactoryMixin, LinkdingApiTestCase
class BundlesApiTestCase(LinkdingApiTestCase, BookmarkFactoryMixin):
def assertBundle(self, bundle: BookmarkBundle, data: dict... | "") | self.assertEqual | string_literal | bookmarks/tests/test_bundles_api.py | test_create_bundle_fields_can_be_empty | BundlesApiTestCase | 177 | null |
sissbruecker/linkding | from django.test import TestCase
from django.urls import reverse
from bookmarks.models import ApiToken, FeedToken
from bookmarks.tests.helpers import BookmarkFactoryMixin, HtmlTestMixin
class SettingsIntegrationsViewTestCase(TestCase, BookmarkFactoryMixin, HtmlTestMixin):
def setUp(self) -> None:
user = s... | self.user) | self.assertEqual | complex_expr | bookmarks/tests/test_settings_integrations_view.py | test_create_api_token | SettingsIntegrationsViewTestCase | 38 | null |
sissbruecker/linkding | from django.test import TestCase
from django.urls import reverse
from bookmarks.models import Bookmark
from bookmarks.tests.helpers import BookmarkFactoryMixin
class BookmarkNewViewTestCase(TestCase, BookmarkFactoryMixin):
def setUp(self) -> None:
user = self.get_or_create_test_user()
self.client.... | bookmark.unread) | self.assertTrue | complex_expr | bookmarks/tests/test_bookmark_new_view.py | test_should_create_new_unread_bookmark | BookmarkNewViewTestCase | 61 | null |
sissbruecker/linkding | import io
import os.path
import tempfile
import time
from pathlib import Path
from unittest import mock
from django.conf import settings
from django.test import TestCase, override_settings
from bookmarks.services import favicon_loader
mock_icon_data = b"mock_icon"
class FaviconLoaderTestCase(TestCase):
def setU... | folder.exists()) | self.assertFalse | func_call | bookmarks/tests/test_favicon_loader.py | test_load_favicon_creates_folder_if_not_exists | FaviconLoaderTestCase | 86 | null |
sissbruecker/linkding | from unittest.mock import patch
from urllib.parse import quote
from django.urls import reverse
from playwright.sync_api import expect
from bookmarks.models import Bookmark
from bookmarks.services import website_loader
from bookmarks.tests_e2e.helpers import LinkdingE2ETestCase
mock_website_metadata = website_loader.... | Bookmark.objects.count()) | self.assertEqual | func_call | bookmarks/tests_e2e/e2e_test_new_bookmark_form.py | test_ctrl_enter_submits_form_from_description | BookmarkFormE2ETestCase | 320 | null |
sissbruecker/linkding | from django.http import QueryDict
from django.test import TestCase
from bookmarks.models import BookmarkSearch
from bookmarks.tests.helpers import BookmarkFactoryMixin
class BookmarkSearchModelTest(TestCase, BookmarkFactoryMixin):
def test_from_request(self):
# no params
query_dict = QueryDict()
... | "") | self.assertEqual | string_literal | bookmarks/tests/test_bookmark_search_model.py | test_from_request | BookmarkSearchModelTest | 19 | null |
sissbruecker/linkding | from django.test import TestCase
from django.urls import reverse
from bookmarks.models import Bookmark
from bookmarks.tests.helpers import BookmarkFactoryMixin
class BookmarkNewViewTestCase(TestCase, BookmarkFactoryMixin):
def setUp(self) -> None:
user = self.get_or_create_test_user()
self.client.... | self.user) | self.assertEqual | complex_expr | bookmarks/tests/test_bookmark_new_view.py | test_should_create_new_bookmark | BookmarkNewViewTestCase | 36 | null |
sissbruecker/linkding | from django.test import TestCase
from django.urls import reverse
from bookmarks.tests.helpers import BookmarkFactoryMixin
class CustomCssViewTestCase(TestCase, BookmarkFactoryMixin):
def setUp(self) -> None:
user = self.get_or_create_test_user()
self.client.force_login(user)
def test_with_cus... | css) | self.assertEqual | variable | bookmarks/tests/test_custom_css_view.py | test_with_custom_css | CustomCssViewTestCase | 28 | null |
sissbruecker/linkding | from django.urls import reverse
from rest_framework import status
from bookmarks.models import BookmarkBundle
from bookmarks.tests.helpers import BookmarkFactoryMixin, LinkdingApiTestCase
class BundlesApiTestCase(LinkdingApiTestCase, BookmarkFactoryMixin):
def assertBundle(self, bundle: BookmarkBundle, data: dict... | 0) | self.assertEqual | numeric_literal | bookmarks/tests/test_bundles_api.py | test_create_bundle | BundlesApiTestCase | 119 | null |
sissbruecker/linkding | import io
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import override_settings
from django.urls import reverse
from rest_framework import status
from bookmarks.models import BookmarkAsset
from bookmarks.tests.helpers import BookmarkFactoryMixin, LinkdingApiTestCase
class BookmarkAs... | "image/png") | self.assertEqual | string_literal | bookmarks/tests/test_bookmark_assets_api.py | test_asset_download_with_uploaded_asset | BookmarkAssetsApiTestCase | 181 | null |
sissbruecker/linkding | import datetime
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponse
from django.template import RequestContext, Template
from django.test import RequestFactory, TestCase
from django.urls import reverse
from django.utils import formats, timezone
from bookmarks.middlewares import L... | style) | self.assertIn | variable | bookmarks/tests/test_bookmarks_list_template.py | test_bookmark_description_max_lines | BookmarkListTemplateTest | 449 | null |
sissbruecker/linkding | from unittest.mock import patch
from django.test import TestCase
from django.utils import timezone
from bookmarks.utils import (
humanize_absolute_date,
humanize_relative_date,
normalize_url,
parse_timestamp,
)
class UtilsTestCase(TestCase):
def test_humanize_absolute_date(self):
test_cas... | result) | self.assertEqual | variable | bookmarks/tests/test_utils.py | test_humanize_absolute_date | UtilsTestCase | 50 | null |
sissbruecker/linkding | from django.test import TestCase
from bookmarks.models import parse_tag_string
from bookmarks.services.parser import NetscapeBookmark, parse
from bookmarks.tests.helpers import BookmarkHtmlTag, ImportTestMixin
class ParserTestCase(TestCase, ImportTestMixin):
def assertTagsEqual(
self, bookmarks: list[Nets... | "") | self.assertEqual | string_literal | bookmarks/tests/test_parser.py | test_notes | ParserTestCase | 246 | null |
sissbruecker/linkding | from django.test import TestCase
from bookmarks.models import UserProfile
from bookmarks.services.search_query_parser import (
AndExpression,
NotExpression,
OrExpression,
SearchExpression,
SearchQueryParseError,
SearchQueryTokenizer,
SpecialKeywordExpression,
TagExpression,
TermExpr... | 8) | self.assertEqual | numeric_literal | bookmarks/tests/test_search_query_parser.py | test_case_insensitive_operators | SearchQueryTokenizerTest | 128 | null |
sissbruecker/linkding | from urllib.parse import urlencode
from django.test import TestCase
from django.urls import reverse
from bookmarks.models import BookmarkBundle
from bookmarks.tests.helpers import BookmarkFactoryMixin, HtmlTestMixin
class BundleNewViewTestCase(TestCase, BookmarkFactoryMixin, HtmlTestMixin):
def setUp(self) -> No... | 1) | self.assertEqual | numeric_literal | bookmarks/tests/test_bundles_new_view.py | test_should_create_new_bundle | BundleNewViewTestCase | 32 | null |
sissbruecker/linkding | from bs4 import BeautifulSoup
from django.template import RequestContext, Template
from django.test import RequestFactory, TestCase
from bookmarks.models import BookmarkSearch
from bookmarks.tests.helpers import BookmarkFactoryMixin, HtmlTestMixin
class BookmarkSearchTagTest(TestCase, BookmarkFactoryMixin, HtmlTestMi... | option.has_attr("selected")) | self.assertTrue | func_call | bookmarks/tests/test_bookmark_search_tag.py | assertSelect | BookmarkSearchTagTest | 55 | null |
sissbruecker/linkding | from django.test import TestCase
from bookmarks.services import auto_tagging
class AutoTaggingTestCase(TestCase):
def test_auto_tag_by_domain(self):
script = """
example.com example
test.com test
"""
url = "https://example.com/"
tags = auto_tagging.get_tags... | {"example"}) | self.assertEqual | collection | bookmarks/tests/test_auto_tagging.py | test_auto_tag_by_domain | AutoTaggingTestCase | 16 | null |
sissbruecker/linkding | import io
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import override_settings
from django.urls import reverse
from rest_framework import status
from bookmarks.models import BookmarkAsset
from bookmarks.tests.helpers import BookmarkFactoryMixin, LinkdingApiTestCase
class BookmarkAs... | data["id"]) | self.assertEqual | complex_expr | bookmarks/tests/test_bookmark_assets_api.py | assertAsset | BookmarkAssetsApiTestCase | 17 | null |
sissbruecker/linkding | from unittest.mock import patch
from django.test import TestCase, override_settings
from django.utils import timezone
from bookmarks.models import Bookmark, Tag, parse_tag_string
from bookmarks.services import tasks
from bookmarks.services.importer import ImportOptions, import_netscape_html
from bookmarks.tests.helpe... | 5) | self.assertEqual | numeric_literal | bookmarks/tests/test_importer.py | test_synchronize | ImporterTestCase | 139 | null |
sissbruecker/linkding | import io
import os.path
import tempfile
import time
from pathlib import Path
from unittest import mock
from django.conf import settings
from django.test import TestCase, override_settings
from bookmarks.services import favicon_loader
mock_icon_data = b"mock_icon"
class FaviconLoaderTestCase(TestCase):
def setU... | self.count_icons()) | self.assertEqual | func_call | bookmarks/tests/test_favicon_loader.py | test_load_favicon_creates_single_icon_for_same_base_url | FaviconLoaderTestCase | 99 | null |
sissbruecker/linkding | import datetime
from django.test import TestCase
from django.utils import timezone
from bookmarks.models import Tag
from bookmarks.services.tags import get_or_create_tag, get_or_create_tags
from bookmarks.tests.helpers import BookmarkFactoryMixin
class TagServiceTestCase(TestCase, BookmarkFactoryMixin):
def setU... | "Book") | self.assertEqual | string_literal | bookmarks/tests/test_tags_service.py | test_get_or_create_tag_should_create_new_tag | TagServiceTestCase | 21 | null |
sissbruecker/linkding | from django.test import TestCase
from bookmarks.models import UserProfile
from bookmarks.services.search_query_parser import (
AndExpression,
NotExpression,
OrExpression,
SearchExpression,
SearchQueryParseError,
SearchQueryTokenizer,
SpecialKeywordExpression,
TagExpression,
TermExpr... | 1) | self.assertEqual | numeric_literal | bookmarks/tests/test_search_query_parser.py | test_empty_query | SearchQueryTokenizerTest | 50 | null |
sissbruecker/linkding | import datetime
import gzip
import os
from datetime import timedelta
from pathlib import Path
from unittest import mock
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase, override_settings
from django.utils import timezone
from bookmarks.models import BookmarkAsset
from bo... | "") | self.assertEqual | string_literal | bookmarks/tests/test_assets_service.py | test_create_snapshot_asset | AssetServiceTestCase | 82 | null |
sissbruecker/linkding | import datetime
import re
from django.test import TestCase, override_settings
from django.urls import reverse
from django.utils import formats, timezone
from bookmarks.models import BookmarkAsset, UserProfile
from bookmarks.tests.helpers import BookmarkFactoryMixin, HtmlTestMixin
class BookmarkDetailsModalTestCase(T... | 3) | self.assertEqual | numeric_literal | bookmarks/tests/test_bookmark_details_modal.py | test_reader_mode_link | BookmarkDetailsModalTestCase | 219 | null |
sissbruecker/linkding | import importlib
from django.test import TestCase, override_settings
from django.urls import reverse
class ContextPathTestCase(TestCase):
def setUp(self):
self.urls_module = importlib.import_module("bookmarks.urls")
def tearDown(self):
importlib.reload(self.urls_module)
@override_setting... | url) | self.assertEqual | variable | bookmarks/tests/test_context_path.py | test_route_with_context_path | ContextPathTestCase | 38 | null |
sissbruecker/linkding | from django.test import TestCase
from bookmarks.forms import BookmarkSearchForm
from bookmarks.models import BookmarkSearch
from bookmarks.tests.helpers import BookmarkFactoryMixin
class BookmarkSearchFormTest(TestCase, BookmarkFactoryMixin):
def test_initial_values(self):
# no params
search = Boo... | bundle.id) | self.assertEqual | complex_expr | bookmarks/tests/test_bookmark_search_form.py | test_initial_values | BookmarkSearchFormTest | 33 | null |
sissbruecker/linkding | from django.test import TestCase
from django.urls import reverse
from bookmarks.tests.helpers import BookmarkFactoryMixin
class CustomCssViewTestCase(TestCase, BookmarkFactoryMixin):
def setUp(self) -> None:
user = self.get_or_create_test_user()
self.client.force_login(user)
def test_with_emp... | "") | self.assertEqual | string_literal | bookmarks/tests/test_custom_css_view.py | test_with_empty_css | CustomCssViewTestCase | 17 | null |
sissbruecker/linkding | from django.http import QueryDict
from django.test import TestCase
from bookmarks.models import BookmarkSearch
from bookmarks.tests.helpers import BookmarkFactoryMixin
class BookmarkSearchModelTest(TestCase, BookmarkFactoryMixin):
def test_modified_params(self):
# no params
bookmark_search = Book... | 0) | self.assertEqual | numeric_literal | bookmarks/tests/test_bookmark_search_model.py | test_modified_params | BookmarkSearchModelTest | 181 | null |
sissbruecker/linkding | from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import reverse
from bookmarks.models import build_tag_string
from bookmarks.tests.helpers import BookmarkFactoryMixin
class BookmarkEditViewTestCase(TestCase, BookmarkFactoryMixin):
def setUp(self) -> None:
user ... | 2) | self.assertEqual | numeric_literal | bookmarks/tests/test_bookmark_edit_view.py | test_should_edit_bookmark | BookmarkEditViewTestCase | 52 | null |
sissbruecker/linkding | from django.test import TestCase, override_settings
from django.urls import include, path
from bookmarks.tests.helpers import BookmarkFactoryMixin, HtmlTestMixin
from bookmarks.urls import urlpatterns as base_patterns
urlpatterns = base_patterns + [path("oidc/", include("mozilla_django_oidc.urls"))]
class LoginViewT... | oidc_login_link.get("data-turbo")) | self.assertEqual | func_call | bookmarks/tests/test_login_view.py | test_should_show_oidc_login_when_enabled | LoginViewTestCase | 43 | null |
sissbruecker/linkding | import io
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import override_settings
from django.urls import reverse
from rest_framework import status
from bookmarks.models import BookmarkAsset
from bookmarks.tests.helpers import BookmarkFactoryMixin, LinkdingApiTestCase
class BookmarkAs... | 3) | self.assertEqual | numeric_literal | bookmarks/tests/test_bookmark_assets_api.py | test_asset_list | BookmarkAssetsApiTestCase | 49 | null |
sissbruecker/linkding | import io
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import override_settings
from django.urls import reverse
from rest_framework import status
from bookmarks.models import BookmarkAsset
from bookmarks.tests.helpers import BookmarkFactoryMixin, LinkdingApiTestCase
class BookmarkAs... | self.has_asset_file(asset)) | self.assertFalse | func_call | bookmarks/tests/test_bookmark_assets_api.py | test_delete_asset | BookmarkAssetsApiTestCase | 318 | null |
sissbruecker/linkding | from urllib.parse import urlencode
from django.test import TestCase
from django.urls import reverse
from bookmarks.models import BookmarkBundle
from bookmarks.tests.helpers import BookmarkFactoryMixin, HtmlTestMixin
class BundleNewViewTestCase(TestCase, BookmarkFactoryMixin, HtmlTestMixin):
def setUp(self) -> No... | 6) | self.assertEqual | numeric_literal | bookmarks/tests/test_bundles_new_view.py | test_should_increment_order_for_subsequent_bundles | BundleNewViewTestCase | 64 | null |
sissbruecker/linkding | import datetime
from django.test import TestCase
from django.utils import timezone
from bookmarks.models import Tag
from bookmarks.services.tags import get_or_create_tag, get_or_create_tags
from bookmarks.tests.helpers import BookmarkFactoryMixin
class TagServiceTestCase(TestCase, BookmarkFactoryMixin):
def setU... | self.user) | self.assertEqual | complex_expr | bookmarks/tests/test_tags_service.py | test_get_or_create_tag_should_create_new_tag | TagServiceTestCase | 22 | null |
sissbruecker/linkding | from django.test import TestCase
from django.urls import reverse
from bookmarks.models import BookmarkBundle
from bookmarks.tests.helpers import BookmarkFactoryMixin
from bookmarks.utils import app_version
class BundleIndexViewTestCase(TestCase, BookmarkFactoryMixin):
def setUp(self) -> None:
user = self.... | len(expected_bundles)) | self.assertEqual | func_call | bookmarks/tests/test_bundles_index_view.py | assertBundleOrder | BundleIndexViewTestCase | 124 | null |
sissbruecker/linkding | from django.test import TestCase
from bookmarks.models import UserProfile
from bookmarks.services.search_query_parser import (
AndExpression,
NotExpression,
OrExpression,
SearchExpression,
SearchQueryParseError,
SearchQueryTokenizer,
SpecialKeywordExpression,
TagExpression,
TermExpr... | 3) | self.assertEqual | numeric_literal | bookmarks/tests/test_search_query_parser.py | test_operator_as_part_of_term | SearchQueryTokenizerTest | 153 | null |
sissbruecker/linkding | from bs4 import BeautifulSoup
from django.template import RequestContext, Template
from django.test import RequestFactory, TestCase
from bookmarks.models import BookmarkSearch
from bookmarks.tests.helpers import BookmarkFactoryMixin, HtmlTestMixin
class BookmarkSearchTagTest(TestCase, BookmarkFactoryMixin, HtmlTestMi... | value) | self.assertEqual | variable | bookmarks/tests/test_bookmark_search_tag.py | assertHiddenInput | BookmarkSearchTagTest | 34 | null |
sissbruecker/linkding | import datetime
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponse
from django.template import RequestContext, Template
from django.test import RequestFactory, TestCase
from django.urls import reverse
from django.utils import formats, timezone
from bookmarks.middlewares import L... | 3) | self.assertEqual | numeric_literal | bookmarks/tests/test_bookmarks_list_template.py | test_bookmark_tag_ordering | BookmarkListTemplateTest | 472 | null |
sissbruecker/linkding | from django.test import TestCase
from django.urls import reverse
from bookmarks.models import Tag
from bookmarks.tests.helpers import BookmarkFactoryMixin, HtmlTestMixin
class TagsIndexViewTestCase(TestCase, BookmarkFactoryMixin, HtmlTestMixin):
def setUp(self) -> None:
self.user = self.get_or_create_test... | len(tags)) | self.assertEqual | func_call | bookmarks/tests/test_tags_index_view.py | assertRows | TagsIndexViewTestCase | 26 | null |
sissbruecker/linkding | import datetime
from unittest.mock import patch
from django.test import TestCase
from django.utils import timezone
from bookmarks.models import Bookmark, Tag
from bookmarks.services import tasks, website_loader
from bookmarks.services.bookmarks import (
archive_bookmark,
archive_bookmarks,
create_bookmark... | 2) | self.assertEqual | numeric_literal | bookmarks/tests/test_bookmarks_service.py | test_create_should_update_first_existing_bookmark_for_multiple_duplicates | BookmarkServiceTestCase | 149 | null |
sissbruecker/linkding | from django.test import TestCase
from django.urls import reverse
from bookmarks.models import ApiToken, FeedToken
from bookmarks.tests.helpers import BookmarkFactoryMixin, HtmlTestMixin
class SettingsIntegrationsViewTestCase(TestCase, BookmarkFactoryMixin, HtmlTestMixin):
def setUp(self) -> None:
user = s... | "API Token") | self.assertEqual | string_literal | bookmarks/tests/test_settings_integrations_view.py | test_create_api_token_with_empty_name | SettingsIntegrationsViewTestCase | 49 | null |
sissbruecker/linkding | import datetime
from unittest.mock import patch
from django.test import TestCase
from django.utils import timezone
from bookmarks.models import Bookmark, Tag
from bookmarks.services import tasks, website_loader
from bookmarks.services.bookmarks import (
archive_bookmark,
archive_bookmarks,
create_bookmark... | 3) | self.assertEqual | numeric_literal | bookmarks/tests/test_bookmarks_service.py | test_refresh_bookmarks_metadata | BookmarkServiceTestCase | 1,038 | null |
sissbruecker/linkding | from django.urls import reverse
from rest_framework import status
from bookmarks.models import BookmarkBundle
from bookmarks.tests.helpers import BookmarkFactoryMixin, LinkdingApiTestCase
class BundlesApiTestCase(LinkdingApiTestCase, BookmarkFactoryMixin):
def assertBundle(self, bundle: BookmarkBundle, data: dict... | 2) | self.assertEqual | numeric_literal | bookmarks/tests/test_bundles_api.py | test_bundle_list_only_returns_own_bundles | BundlesApiTestCase | 57 | null |
sissbruecker/linkding | from django.test import TestCase
from django.urls import reverse
from bookmarks.tests.helpers import BookmarkFactoryMixin
class BundleEditViewTestCase(TestCase, BookmarkFactoryMixin):
def setUp(self) -> None:
user = self.get_or_create_test_user()
self.client.force_login(user)
def create_form_... | response.content.decode()) | self.assertIn | func_call | bookmarks/tests/test_bundles_edit_view.py | test_should_show_correct_preview_after_posting_invalid_data | BundleEditViewTestCase | 161 | null |
sissbruecker/linkding | from django.test import TestCase
from bookmarks.models import parse_tag_string
class TagTestCase(TestCase):
def test_parse_tag_string_handles_invalid_input(self):
self.assertListEqual(parse_tag_string(None), | []) | self.assertListEqual | collection | bookmarks/tests/test_tags_model.py | test_parse_tag_string_handles_invalid_input | TagTestCase | 32 | null |
sissbruecker/linkding | import datetime
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponse
from django.template import RequestContext, Template
from django.test import RequestFactory, TestCase
from django.urls import reverse
from django.utils import formats, timezone
from bookmarks.middlewares import L... | "#tag1") | self.assertEqual | string_literal | bookmarks/tests/test_bookmarks_list_template.py | test_bookmark_tag_ordering | BookmarkListTemplateTest | 473 | null |
sissbruecker/linkding | import io
import os
import tempfile
from pathlib import Path
from unittest import mock
from django.conf import settings
from django.test import TestCase
from bookmarks.services import preview_image_loader
mock_image_data = b"mock_image"
class PreviewImageLoaderTestCase(TestCase):
def setUp(self) -> None:
... | file) | self.assertIsNotNone | variable | bookmarks/tests/test_preview_image_loader.py | test_load_preview_image | PreviewImageLoaderTestCase | 93 | null |
sissbruecker/linkding | from unittest import mock
from django.test import TestCase
from bookmarks.services import website_loader
class WebsiteLoaderTestCase(TestCase):
def setUp(self):
# clear cached metadata before test run
website_loader._load_website_metadata_cached.cache_clear()
def render_html_document(
... | len(content)) | self.assertEqual | func_call | bookmarks/tests/test_website_loader.py | test_load_page_returns_content | WebsiteLoaderTestCase | 69 | null |
sissbruecker/linkding | from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import reverse
from bookmarks.models import build_tag_string
from bookmarks.tests.helpers import BookmarkFactoryMixin
class BookmarkEditViewTestCase(TestCase, BookmarkFactoryMixin):
def setUp(self) -> None:
user ... | bookmark.shared) | self.assertTrue | complex_expr | bookmarks/tests/test_bookmark_edit_view.py | test_should_edit_shared_state | BookmarkEditViewTestCase | 90 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.