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
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: ...
folder.exists())
self.assertFalse
func_call
bookmarks/tests/test_preview_image_loader.py
test_load_preview_image_creates_folder_if_not_exists
PreviewImageLoaderTestCase
186
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...
2)
self.assertEqual
numeric_literal
bookmarks/tests/test_bookmark_details_modal.py
test_reader_mode_link
BookmarkDetailsModalTestCase
187
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...
0)
self.assertEqual
numeric_literal
bookmarks/tests/test_bundles_new_view.py
test_should_increment_order_for_subsequent_bundles
BundleNewViewTestCase
49
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....
"tag2")
self.assertEqual
string_literal
bookmarks/tests/test_bookmark_new_view.py
test_should_create_new_bookmark
BookmarkNewViewTestCase
46
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: ...
data)
self.assertEqual
variable
bookmarks/tests/test_preview_image_loader.py
assertImageExists
PreviewImageLoaderTestCase
82
null
sissbruecker/linkding
import datetime import operator from django.db.models import QuerySet from django.test import TestCase from django.utils import timezone from bookmarks import queries from bookmarks.models import BookmarkSearch, UserProfile from bookmarks.tests.helpers import BookmarkFactoryMixin, random_sentence from bookmarks.utils...
[])
self.assertCountEqual
collection
bookmarks/tests/test_queries.py
test_query_bookmarks_untagged_should_not_be_combinable_with_tags
QueriesBasicTestCase
434
null
sissbruecker/linkding
from django.test import TestCase from bookmarks.services import auto_tagging class AutoTaggingTestCase(TestCase): def test_auto_tag_by_domain_work_with_idn_domains(self): script = """ रजिस्ट्री.भारत tag1 """ url = "https://www.xn--81bg3cc2b2bk5hb.xn--h2brj9c/" tags = ...
{"tag1"})
self.assertEqual
collection
bookmarks/tests/test_auto_tagging.py
test_auto_tag_by_domain_work_with_idn_domains
AutoTaggingTestCase
71
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...
html_tag.href)
self.assertEqual
complex_expr
bookmarks/tests/test_parser.py
assertTagsEqual
ParserTestCase
15
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_should_use_current_dat...
"Today")
self.assertEqual
string_literal
bookmarks/tests/test_utils.py
test_humanize_absolute_date_should_use_current_date_as_default
UtilsTestCase
54
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...
asset)
self.assertIsNotNone
variable
bookmarks/tests/test_assets_service.py
test_create_snapshot_asset
AssetServiceTestCase
79
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...
len(radios) == 0)
self.assertTrue
func_call
bookmarks/tests/test_bookmark_search_tag.py
assertNoRadioGroup
BookmarkSearchTagTest
72
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,...
list_item.text.strip())
self.assertEqual
func_call
bookmarks/tests/test_bookmark_index_view.py
assertVisibleBundles
BookmarkIndexViewTestCase
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...
asset.gzip)
self.assertTrue
complex_expr
bookmarks/tests/test_bookmark_assets_api.py
test_upload_asset
BookmarkAssetsApiTestCase
257
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["search"])
self.assertEqual
complex_expr
bookmarks/tests/test_bundles_api.py
assertBundle
BundlesApiTestCase
12
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...
6)
self.assertEqual
numeric_literal
bookmarks/tests/test_bookmarks_tasks.py
test_schedule_refresh_favicons_should_update_favicon_for_all_bookmarks
BookmarkTasksTestCase
294
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...
"text/css")
self.assertEqual
string_literal
bookmarks/tests/test_custom_css_view.py
test_with_empty_css
CustomCssViewTestCase
15
null
sissbruecker/linkding
from django.test import TestCase from bookmarks.services import auto_tagging class AutoTaggingTestCase(TestCase): def test_auto_tag_by_domain_handles_invalid_urls(self): script = """ example.com example test.com test """ url = "https://" tags = auto_taggin...
set([]))
self.assertEqual
func_call
bookmarks/tests/test_auto_tagging.py
test_auto_tag_by_domain_handles_invalid_urls
AutoTaggingTestCase
26
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_query_params(self): # no params search = BookmarkSearch()...
{})
self.assertEqual
collection
bookmarks/tests/test_bookmark_search_model.py
test_query_params
BookmarkSearchModelTest
99
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...
1)
self.assertEqual
numeric_literal
bookmarks/tests/test_bookmarks_service.py
test_create_should_update_existing_bookmark_with_same_url
BookmarkServiceTestCase
87
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
collection
bookmarks/tests/test_parser.py
test_no_bookmarks
ParserTestCase
67
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, ...
[])
self.assertCountEqual
collection
bookmarks/tests/test_tags_merge_view.py
test_merge_tags_complex
TagsMergeViewTestCase
109
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,...
form)
self.assertIsNotNone
variable
bookmarks/tests/test_bookmark_index_view.py
assertBulkActionForm
BookmarkIndexViewTestCase
34
null
sissbruecker/linkding
from django.test import TestCase from django.urls import reverse from bookmarks.tests.helpers import BookmarkFactoryMixin class TagsEditViewTestCase(TestCase, BookmarkFactoryMixin): def setUp(self) -> None: self.user = self.get_or_create_test_user() self.client.force_login(self.user) def test...
"tag1")
self.assertEqual
string_literal
bookmarks/tests/test_tags_edit_view.py
test_show_error_for_empty_name
TagsEditViewTestCase
53
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...
"Token 2")
self.assertEqual
string_literal
bookmarks/tests/test_settings_integrations_view.py
test_list_api_tokens
SettingsIntegrationsViewTestCase
106
null
sissbruecker/linkding
import datetime from django.core.exceptions import ValidationError from django.test import TestCase, override_settings from django.test.client import RequestFactory from bookmarks.forms import BookmarkForm from bookmarks.models import Bookmark from bookmarks.tests.helpers import BookmarkFactoryMixin ENABLED_URL_VALI...
0)
self.assertEqual
numeric_literal
bookmarks/tests/test_bookmark_validation.py
_run_bookmark_form_url_validity_checks
BookmarkValidationTestCase
114
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...
2)
self.assertEqual
numeric_literal
bookmarks/tests/test_search_query_parser.py
test_single_term
SearchQueryTokenizerTest
62
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...
str(link_element))
self.assertIn
func_call
bookmarks/tests/test_tag_cloud_template.py
assertTagGroups
TagCloudTemplateTest
56
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,...
feed)
self.assertIsNone
variable
bookmarks/tests/test_bookmark_index_view.py
test_does_not_include_rss_feed
BookmarkIndexViewTestCase
594
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...
True)
self.assertEqual
bool_literal
bookmarks/tests/test_parser.py
test_private_flag
ParserTestCase
216
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...
True)
self.assertEqual
bool_literal
bookmarks/tests/test_bookmarks_api.py
test_update_bookmark_unread_flag
BookmarksApiTestCase
785
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["status"])
self.assertEqual
complex_expr
bookmarks/tests/test_bookmark_assets_api.py
assertAsset
BookmarkAssetsApiTestCase
26
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,...
feed)
self.assertIsNone
variable
bookmarks/tests/test_bookmark_archived_view.py
test_does_not_include_rss_feed
BookmarkArchivedViewTestCase
601
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...
len(radios) > 0)
self.assertTrue
func_call
bookmarks/tests/test_bookmark_search_tag.py
assertRadioGroup
BookmarkSearchTagTest
61
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...
html_tag.title)
self.assertEqual
complex_expr
bookmarks/tests/test_parser.py
assertTagsEqual
ParserTestCase
16
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...
form)
self.assertIsNotNone
variable
bookmarks/tests/test_login_view.py
test_should_show_login_form_by_default
LoginViewTestCase
54
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....
2)
self.assertEqual
numeric_literal
bookmarks/tests/test_bookmark_new_view.py
test_should_create_new_bookmark
BookmarkNewViewTestCase
43
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...
4)
self.assertEqual
numeric_literal
bookmarks/tests/test_importer.py
test_import
ImporterTestCase
81
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...
"user123")
self.assertEqual
string_literal
bookmarks/tests/test_bookmark_search_form.py
test_initial_values
BookmarkSearchFormTest
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...
html)
self.assertIn
variable
bookmarks/tests/test_bookmarks_list_template.py
test_empty_state_with_invalid_query
BookmarkListTemplateTest
1,086
null
sissbruecker/linkding
from django.urls import reverse from playwright.sync_api import expect from bookmarks.models import Bookmark from bookmarks.tests_e2e.helpers import LinkdingE2ETestCase class BookmarkPageBulkEditE2ETestCase(LinkdingE2ETestCase): def setup_test_data(self): self.setup_numbered_bookmarks(50) self.set...
checkboxes.count())
self.assertEqual
func_call
bookmarks/tests_e2e/e2e_test_bookmark_page_bulk_edit.py
test_select_all_toggles_all_checkboxes
BookmarkPageBulkEditE2ETestCase
193
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(bookmarks))
self.assertEqual
func_call
bookmarks/tests/helpers.py
assertVisibleBookmarks
BookmarkListTestMixin
318
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...
0)
self.assertEqual
numeric_literal
bookmarks/tests/test_importer.py
test_import
ImporterTestCase
83
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...
"Token 1")
self.assertEqual
string_literal
bookmarks/tests/test_settings_integrations_view.py
test_list_api_tokens
SettingsIntegrationsViewTestCase
110
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...
["q", "sort"])
self.assertCountEqual
collection
bookmarks/tests/test_bookmark_search_model.py
test_modified_params
BookmarkSearchModelTest
195
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....
html)
self.assertNotIn
variable
bookmarks/tests/test_bundles_index_view.py
test_renders_user_owned_bundles_only
BundleIndexViewTestCase
58
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_hidden_fields(self): # no modified params sea...
0)
self.assertEqual
numeric_literal
bookmarks/tests/test_bookmark_search_form.py
test_hidden_fields
BookmarkSearchFormTest
61
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....
i)
self.assertEqual
variable
bookmarks/tests/test_bundles_index_view.py
assertBundleOrder
BundleIndexViewTestCase
127
null
sissbruecker/linkding
import datetime from unittest.mock import patch from django.test import TestCase from django.urls import reverse from bookmarks.models import Bookmark from bookmarks.tests.helpers import BookmarkFactoryMixin class SettingsExportViewTestCase(TestCase, BookmarkFactoryMixin): def setUp(self) -> None: user =...
text)
self.assertIn
variable
bookmarks/tests/test_settings_export_view.py
test_should_only_export_user_bookmarks
SettingsExportViewTestCase
54
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...
1)
self.assertEqual
numeric_literal
bookmarks/tests/test_bookmarks_api.py
test_create_bookmark
BookmarksApiTestCase
440
null
sissbruecker/linkding
from django.test import TestCase from django.urls import reverse from bookmarks.tests.helpers import BookmarkFactoryMixin class TagsEditViewTestCase(TestCase, BookmarkFactoryMixin): def setUp(self) -> None: self.user = self.get_or_create_test_user() self.client.force_login(self.user) def test...
"TAG")
self.assertEqual
string_literal
bookmarks/tests/test_tags_edit_view.py
test_allow_case_changes
TagsEditViewTestCase
30
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, ...
self.get_text(target_tag_group))
self.assertIn
func_call
bookmarks/tests/test_tags_merge_view.py
test_can_only_merge_own_tags
TagsMergeViewTestCase
122
null
sissbruecker/linkding
import datetime from django.core.exceptions import ValidationError from django.test import TestCase, override_settings from django.test.client import RequestFactory from bookmarks.forms import BookmarkForm from bookmarks.models import Bookmark from bookmarks.tests.helpers import BookmarkFactoryMixin ENABLED_URL_VALI...
1)
self.assertEqual
numeric_literal
bookmarks/tests/test_bookmark_validation.py
test_bookmark_form_should_validate_required_fields
BookmarkValidationTestCase
70
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...
len(html_tags))
self.assertEqual
func_call
bookmarks/tests/test_parser.py
assertTagsEqual
ParserTestCase
12
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...
len(groups))
self.assertEqual
func_call
bookmarks/tests/test_tag_cloud_template.py
assertTagGroups
TagCloudTemplateTest
42
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....
bundle.id)
self.assertEqual
complex_expr
bookmarks/tests/test_bundles_index_view.py
assertBundleOrder
BundleIndexViewTestCase
126
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,...
form)
self.assertIsNotNone
variable
bookmarks/tests/test_bookmark_archived_view.py
assertBulkActionForm
BookmarkArchivedViewTestCase
34
null
sissbruecker/linkding
from unittest.mock import patch from django.contrib.auth.models import User from django.core.files.uploadedfile import SimpleUploadedFile from django.forms import model_to_dict from django.http import HttpResponse from django.test import TestCase, override_settings from django.urls import reverse from bookmarks.model...
1)
self.assertEqual
numeric_literal
bookmarks/tests/test_bookmark_action_view.py
test_create_html_snapshot
BookmarkActionViewTestCase
179
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_archived_view.py
assertBulkActionForm
BookmarkArchivedViewTestCase
35
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...
3)
self.assertEqual
numeric_literal
bookmarks/tests/test_bookmarks_tasks.py
test_schedule_bookmarks_without_favicons_should_load_favicon_for_all_bookmarks_without_favicon
BookmarkTasksTestCase
242
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...
[])
self.assertCountEqual
collection
bookmarks/tests/test_bookmarks_api.py
test_check_returns_no_auto_tags_if_none_configured
BookmarksApiTestCase
1,108
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...
3)
self.assertEqual
numeric_literal
bookmarks/tests/test_importer.py
test_import_with_some_invalid_bookmarks
ImporterTestCase
222
null
sissbruecker/linkding
from django.test import TestCase from django.urls import reverse from bookmarks.models import GlobalSettings from bookmarks.tests.helpers import BookmarkFactoryMixin, HtmlTestMixin class LayoutTestCase(TestCase, BookmarkFactoryMixin, HtmlTestMixin): def setUp(self) -> None: user = self.get_or_create_test_...
link)
self.assertIsNone
variable
bookmarks/tests/test_layout.py
test_does_not_link_custom_css_when_empty
LayoutTestCase
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.url)
self.assertEqual
complex_expr
bookmarks/tests_e2e/e2e_test_new_bookmark_form.py
test_ctrl_enter_submits_form_from_description
BookmarkFormE2ETestCase
322
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...
search_field.get("value"))
self.assertIsNone
func_call
bookmarks/tests/test_bundles_new_view.py
test_should_not_prefill_when_no_query_parameter
BundleNewViewTestCase
111
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...
6)
self.assertEqual
numeric_literal
bookmarks/tests/test_importer.py
test_synchronize
ImporterTestCase
201
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.unread)
self.assertTrue
complex_expr
bookmarks/tests/test_bookmark_edit_view.py
test_should_edit_unread_state
BookmarkEditViewTestCase
73
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...
url)
self.assertEqual
variable
bookmarks/tests/test_bookmarks_list_template.py
assertFavicon
BookmarkListTemplateTest
151
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, ...
[target_tag])
self.assertCountEqual
collection
bookmarks/tests/test_tags_merge_view.py
test_merge_tags
TagsMergeViewTestCase
56
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") ...
"new-name")
self.assertEqual
string_literal
bookmarks/tests_e2e/e2e_test_tag_management.py
test_edit_tag
TagManagementE2ETestCase
122
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...
"python ai")
self.assertEqual
string_literal
bookmarks/tests/test_bundles_new_view.py
test_should_prefill_form_from_search_query_parameters
BundleNewViewTestCase
90
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...
4)
self.assertEqual
numeric_literal
bookmarks/tests/test_bookmarks_tasks.py
test_schedule_bookmarks_without_favicons_should_load_favicon_for_all_bookmarks_without_favicon
BookmarkTasksTestCase
241
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...
"")
self.assertEqual
string_literal
bookmarks/tests/test_bundles_new_view.py
test_should_ignore_special_search_commands
BundleNewViewTestCase
102
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.objects.count())
self.assertEqual
func_call
bookmarks/tests/test_create_initial_superuser_command.py
test_create_with_password
TestCreateInitialSuperuserCommand
18
null
sissbruecker/linkding
import os from django.contrib.staticfiles.testing import LiveServerTestCase from playwright.sync_api import BrowserContext, Page, expect, sync_playwright from bookmarks.tests.helpers import BookmarkFactoryMixin SCREENSHOT_DIR = "test-results/screenshots" os.environ.setdefault("DJANGO_ALLOW_ASYNC_UNSAFE", "true") c...
count)
self.assertEqual
variable
bookmarks/tests_e2e/helpers.py
assertReloads
LinkdingE2ETestCase
93
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...
"#tag2")
self.assertEqual
string_literal
bookmarks/tests/test_bookmarks_list_template.py
test_bookmark_tag_ordering
BookmarkListTemplateTest
474
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.user)
self.assertEqual
complex_expr
bookmarks/tests/test_bundles_api.py
test_create_bundle
BundlesApiTestCase
118
null
allmonday/pydantic-resolve
from __future__ import annotations from typing import List import asyncio from pydantic import BaseModel from pydantic_resolve import Resolver import pytest @pytest.mark.asyncio async def test_resolve_object(): stu = Student(name="martin") result = await Resolver().resolve(stu) expected = { 'name':...
expected
assert
variable
tests/resolver/test_1_pydantic_resolve.py
test_resolve_object
29
null
allmonday/pydantic-resolve
from pydantic_resolve.graphql import SchemaBuilder from tests.graphql.fixtures.entities import BaseEntity class TestSchemaBuilder: def setup_method(self): """设置测试环境""" self.er_diagram = BaseEntity.get_diagram() self.builder = SchemaBuilder(self.er_diagram) def test_map_python_type_to_...
gql_type
assert
variable
tests/graphql/test_schema_builder.py
test_map_python_type_to_gql
TestSchemaBuilder
64
null
allmonday/pydantic-resolve
from pydantic_resolve.graphql import SchemaBuilder from tests.graphql.fixtures.entities import BaseEntity class TestSchemaBuilder: def setup_method(self): """设置测试环境""" self.er_diagram = BaseEntity.get_diagram() self.builder = SchemaBuilder(self.er_diagram) def test_build_schema(self):...
schema
assert
variable
tests/graphql/test_schema_builder.py
test_build_schema
TestSchemaBuilder
22
null
allmonday/pydantic-resolve
from pydantic import BaseModel from pydantic_resolve import Resolver import pytest @pytest.mark.asyncio async def test_without_annotation_param(): items: list[Item] = [ A(id=1, name='item1'), B(id=2, name='item2'), A(id=3, name='item3'), ] with pytest.raises(
Exception)
pytest.raises
variable
tests/resolver/test_46_annotation_param.py
test_without_annotation_param
46
null
allmonday/pydantic-resolve
import pytest from typing import List from collections import Counter, defaultdict from aiodataloader import DataLoader from pydantic import ConfigDict, BaseModel from sqlalchemy import select from sqlalchemy.ext.asyncio import async_sessionmaker from sqlalchemy.ext.asyncio import create_async_engine from sqlalchemy.or...
expected_2
assert
variable
tests/resolver/test_10_sqlalchemy_query_with_change.py
test_sqlite_and_dataloader
194
null
allmonday/pydantic-resolve
import pytest from typing import Optional, List from pydantic import BaseModel from pydantic_resolve import ( ErDiagram, Entity, Relationship, QueryConfig, MutationConfig, query, mutation, ) from pydantic_resolve.graphql import SchemaBuilder async def get_all_users(limit: int = 10) -> List...
1
assert
numeric_literal
tests/graphql/test_query_mutation_config.py
test_method_callable_without_cls
TestErDiagramBinding
190
null
allmonday/pydantic-resolve
from __future__ import annotations from pydantic import BaseModel from typing import List, Annotated from pydantic_resolve import Resolver, Collector, LoaderDepend, SendTo, DefineSubset, SubsetConfig import pytest async def c_loader_fn(keys): return [[C(detail=f'{k}-1'), C(detail=f'{k}-2')] for k in keys] @pytest...
['x', 'y', 'x', 'y']
assert
collection
tests/resolver/test_53_send_to.py
test_collector_1
70
null
allmonday/pydantic-resolve
import pytest from pydantic import BaseModel from typing import Optional, List from pydantic_resolve import base_entity, query, mutation, config_global_resolver from pydantic_resolve.graphql import GraphQLHandler, SchemaBuilder def setup_global_resolver(): """Set up global resolver for this test module.""" co...
schema
assert
variable
tests/graphql/test_input_types.py
test_input_type_generated_in_schema
TestInputTypeSchemaGeneration
139
null
allmonday/pydantic-resolve
from __future__ import annotations from typing import List import asyncio from pydantic import BaseModel from pydantic_resolve import Resolver import pytest @pytest.mark.asyncio async def test_type_definition(): stu = Student() result = await Resolver().resolve(stu) expected = { 'new_books': ['book...
expected
assert
variable
tests/resolver/test_3_tuple_list.py
test_type_definition
28
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import ( config_resolver, Entity, Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ErDiagram, ensure_subset, Loader ) from aiodataloader import DataLoad...
"a"
assert
string_literal
tests/er_diagram/test_er_diagram.py
test_resolver_factory_with_er_configs_inherit
159
null
allmonday/pydantic-resolve
import pytest from pydantic import BaseModel from typing import Optional from pydantic_resolve import Resolver import asyncio import time @pytest.mark.asyncio async def test_resolve_object(): t = time.time() s = Service() result = await Resolver().resolve(s) expected = { "service_detail_1": { ...
expected
assert
variable
tests/resolver/test_2_resolve_object.py
test_resolve_object
72
null
allmonday/pydantic-resolve
import pytest from pydantic_resolve.graphql import QueryParser, QueryParseError from tests.graphql.fixtures.entities import BaseEntity class TestQueryParser: def setup_method(self): """设置测试环境""" self.er_diagram = BaseEntity.get_diagram() self.parser = QueryParser(self.er_diagram) def ...
parsed.field_tree['users'].arguments
assert
complex_expr
tests/graphql/test_query_parser.py
test_parse_query_with_arguments
TestQueryParser
36
null
allmonday/pydantic-resolve
from __future__ import annotations import pytest from typing import Optional, List from pydantic import BaseModel from aiodataloader import DataLoader from pydantic_resolve.analysis import Analytic from pydantic_resolve import LoaderDepend, LoaderFieldNotProvidedError from pydantic_resolve.loader_manager import validat...
None
assert
none_literal
tests/core/test_field_validate_and_create_loader_instance.py
test_instance_7
168
null
allmonday/pydantic-resolve
from pydantic_resolve.utils.openapi import model_config from pydantic import BaseModel, Field from pydantic_resolve import Resolver from pydantic.json_schema import GenerateJsonSchema as GenerateJsonSchema import pytest from typing import Annotated @pytest.mark.asyncio async def test_schema_config_required_false(): ...
{'name'}
assert
collection
tests/utils/test_model_config.py
test_schema_config_required_false
48
null
allmonday/pydantic-resolve
from __future__ import annotations from typing import List import pytest from collections import Counter from aiodataloader import DataLoader from pydantic import ConfigDict, BaseModel from sqlalchemy import select from sqlalchemy.ext.asyncio import async_sessionmaker from sqlalchemy.ext.asyncio import create_async_eng...
expected
assert
variable
tests/resolver/test_17_mapper_deep.py
test_sqlite_and_dataloader
148
null
allmonday/pydantic-resolve
from typing import get_origin def test_module_path_syntax_with_list(): """ Test that module path syntax works with list generic. """ from tests.er_diagram.circular.entities.user import UserEntity from tests.er_diagram.circular.entities.post import PostEntity from tests.er_diagram.circular.entit...
PostEntity
assert
variable
tests/er_diagram/circular/test_circular_import.py
test_module_path_syntax_with_list
69
null
allmonday/pydantic-resolve
from pydantic import BaseModel from typing import List from pydantic_resolve import Resolver, LoaderDepend from aiodataloader import DataLoader import pytest from pydantic_resolve.exceptions import GlobalLoaderFieldOverlappedError async def loader_fn_a(keys): return [ k**2 for k in keys ] @pytest.mark.asyncio asy...
5
assert
numeric_literal
tests/resolver/test_33_global_loader_filter.py
test_case_0
51
null
allmonday/pydantic-resolve
from __future__ import annotations import pytest from typing import Optional, Annotated from pydantic import BaseModel from pydantic_resolve import Resolver, ExposeAs, DefineSubset, SubsetConfig @pytest.mark.asyncio async def test_expose_as(): a = A(name='a_name') a = await Resolver().resolve(a) assert a....
'a_name'
assert
string_literal
tests/resolver/test_52_expose_as.py
test_expose_as
32
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ensure_subset, base_entity from aiodataloader import DataLoader BASE_ENTITY = base_entity()...
1
assert
numeric_literal
tests/er_diagram/test_er_diagram_inline_short.py
test_resolver_factory_with_er_configs_inherit_2
156
null
allmonday/pydantic-resolve
import pytest from typing import List from collections import Counter, defaultdict from aiodataloader import DataLoader from pydantic import ConfigDict, BaseModel from sqlalchemy import select from sqlalchemy.ext.asyncio import async_sessionmaker from sqlalchemy.ext.asyncio import create_async_engine from sqlalchemy.or...
expected_1
assert
variable
tests/resolver/test_10_sqlalchemy_query_with_change.py
test_sqlite_and_dataloader
193
null
allmonday/pydantic-resolve
from pydantic import BaseModel from pydantic_resolve.analysis import _scan_post_method, _scan_post_default_handler from pydantic_resolve import Collector def test_scan_post_method_3(): class A(BaseModel): a: str def post_a(self, context, ancestor_context, ...
'c_name'
assert
string_literal
tests/core/test_scan_post_method.py
test_scan_post_method_3
57
null
allmonday/pydantic-resolve
import pytest from demo.graphql.entities_v2 import ( diagram_v2, UserEntityV2, PostEntityV2, init_db_v2, ) from pydantic_resolve.graphql import GraphQLHandler from pydantic_resolve import config_global_resolver def handler(): """创建 GraphQLHandler 实例""" # 重新初始化数据库,确保测试状态干净 init_db_v2() #...
3
assert
numeric_literal
demo/graphql/test_entities_v2.py
test_diagram_has_configs
TestErDiagramConfiguration
320
null
allmonday/pydantic-resolve
from __future__ import annotations from typing import List import pytest from collections import Counter from aiodataloader import DataLoader from pydantic import ConfigDict, BaseModel from sqlalchemy import select from sqlalchemy.ext.asyncio import async_sessionmaker from sqlalchemy.ext.asyncio import create_async_eng...
2
assert
numeric_literal
tests/resolver/test_17_mapper_deep.py
test_sqlite_and_dataloader
154
null
allmonday/pydantic-resolve
import pytest from pydantic_resolve import config_global_resolver, query from pydantic_resolve.graphql import GraphQLHandler from pydantic import BaseModel from typing import List, Optional, Dict, Any class TestGraphQLIntegration: def setup_method(self): """设置测试环境""" # 创建简单的 ERD(只用于测试) fr...
2
assert
numeric_literal
tests/graphql/test_e2e.py
test_simple_query_execution
TestGraphQLIntegration
54
null