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
mozillazg/python-pinyin
from __future__ import unicode_literals import pytest from pypinyin import pinyin, load_phrases_dict from pypinyin.contrib import mmseg seg_test = mmseg.Seg(mmseg.PrefixSet()) seg_test._prefix_set.train([ 'a', 'ab', 'abc', 'abcd', 'abd', 'ac', 'acd', 'aff', 'agf', 'agfgef', ...
['人员']
assert
collection
tests/contrib/test_mmseg.py
test_phrases
134
null
mozillazg/python-pinyin
from __future__ import unicode_literals import sys from pypinyin.compat import SUPPORT_UCS4 from pypinyin import runner from pypinyin.tools import toneconvert from pytest import mark def test_runner_default(): options = runner.get_parser().parse_args(['你好']) assert options.func == 'pinyin' assert options....
['你好']
assert
collection
tests/test_cmd.py
test_runner_default
27
null
mozillazg/python-pinyin
from __future__ import unicode_literals import pytest from pypinyin import ( pinyin, slug, lazy_pinyin, load_single_dict, load_phrases_dict, NORMAL, TONE, TONE2, TONE3, INITIALS, FIRST_LETTER, FINALS, FINALS_TONE, FINALS_TONE2, FINALS_TONE3, BOPOMOFO, BOPOMOFO_FIRST, CYRILLIC, CYRILLIC_FIRST, Style ) ...
[]
assert
collection
tests/test_pinyin.py
test_others
126
null
mozillazg/python-pinyin
from __future__ import unicode_literals from pypinyin import lazy_pinyin from pypinyin.contrib.uv import V2UMixin from pypinyin.converter import DefaultConverter from pypinyin.core import Pinyin def test_v2u(): assert lazy_pinyin('战略') == ['zh
['zhan', 'lve']
assert
collection
tests/contrib/test_uv.py
test_v2u
18
null
mozillazg/python-pinyin
from __future__ import unicode_literals from pypinyin.constants import Style from pypinyin.core import ( Pinyin, to_fixed, handle_nopinyin, single_pinyin, phrase_pinyin) def test_to_fixed_for_compatibly(): assert to_fixed('cè', Style.INITIALS) == '
'c'
assert
string_literal
tests/test_core_cls.py
test_to_fixed_for_compatibly
46
null
mozillazg/python-pinyin
from __future__ import unicode_literals from pypinyin import lazy_pinyin from pypinyin.contrib.uv import V2UMixin from pypinyin.converter import DefaultConverter from pypinyin.core import Pinyin def test_v2u(): assert lazy_pinyin('战略') == ['zhan', 'lve'] assert my_pinyin.lazy_pinyin('战略') == ['zh
['zhan', 'lüe']
assert
collection
tests/contrib/test_uv.py
test_v2u
19
null
mozillazg/python-pinyin
from __future__ import unicode_literals import sys from pypinyin.compat import SUPPORT_UCS4 from pypinyin import runner from pypinyin.tools import toneconvert from pytest import mark def test_runner_custom(): options = runner.get_parser().parse_args([ '--func', 'slug', '--style', 'zhao', '--separator', ' ...
' '
assert
string_literal
tests/test_cmd.py
test_runner_custom
37
null
mozillazg/python-pinyin
from __future__ import unicode_literals from pypinyin.constants import Style from pypinyin.core import ( Pinyin, to_fixed, handle_nopinyin, single_pinyin, phrase_pinyin) def test_use_pre_seg_to_skip_seg(): class A(Pinyin): def pre_seg(self, hans, **kwargs): return ['a', 'b', 'c'] mypi...
[['a'], ['b'], ['c']]
assert
collection
tests/test_core_cls.py
test_use_pre_seg_to_skip_seg
17
null
mozillazg/python-pinyin
from __future__ import unicode_literals from pytest import mark from pypinyin import lazy_pinyin, Style from pypinyin.contrib.neutral_tone import NeutralToneWith5Mixin from pypinyin.contrib.uv import V2UMixin from pypinyin.converter import DefaultConverter from pypinyin.core import Pinyin def test_neutral_tone_with_...
['hao', 'le']
assert
collection
tests/contrib/test_neutral_tone.py
test_neutral_tone_with_5
53
null
mozillazg/python-pinyin
from __future__ import unicode_literals from pypinyin.constants import Style from pypinyin.converter import DefaultConverter def test_post_pinyin_return_value_phrase_pinyin(): class A(DefaultConverter): def post_pinyin(self, han, heteronym, pinyin, **kwargs): return { '北': [['z...
[['bei3'], ['jing1']]
assert
collection
tests/test_converter.py
test_post_pinyin_return_value_phrase_pinyin
85
null
mozillazg/python-pinyin
from __future__ import unicode_literals from pypinyin.constants import Style from pypinyin.converter import DefaultConverter def test_pre_convert_style_return_value(): class A(DefaultConverter): def pre_convert_style(self, han, orig_pinyin, style, strict, **kwargs): return 'test' han = '测...
[['test'], ['test']]
assert
collection
tests/test_converter.py
test_pre_convert_style_return_value
16
null
mozillazg/python-pinyin
from __future__ import unicode_literals import pytest from pypinyin import ( pinyin, slug, lazy_pinyin, load_single_dict, load_phrases_dict, NORMAL, TONE, TONE2, TONE3, INITIALS, FIRST_LETTER, FINALS, FINALS_TONE, FINALS_TONE2, FINALS_TONE3, BOPOMOFO, BOPOMOFO_FIRST, CYRILLIC, CYRILLIC_FIRST, Style ) ...
han[2]
assert
complex_expr
tests/test_pinyin.py
test_errors
226
null
mozillazg/python-pinyin
from __future__ import unicode_literals import copy import os import sys import pytest def cleanup(): _clean() try: yield finally: _clean() def _clean(): for module in copy.copy(sys.modules): if module.startswith('pypinyin'): sys.modules.pop(module, None) def te...
pypinyin.pinyin_dict.pinyin_dict
assert
complex_expr
tests/test_env.py
test_no_copy
43
null
rq/django-rq
from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from django_rq import get_queue from .fixtures import say_hello from .redis_config import REDIS_CONFIG_1 from .utils import get_queue_index class Unaut...
data)
self.assertIn
variable
tests/test_admin_integration.py
test_api_token_authentication
UnauthenticatedAdminURLTest
154
null
rq/django-rq
import sys from unittest import mock, skipIf from unittest.mock import MagicMock, patch from django.conf import settings from django.test import TestCase, override_settings from django_rq.connection_utils import ( get_connection, get_connection_by_index, get_redis_connection, get_unique_connection_con...
first_result)
self.assertEqual
variable
tests/test_connections.py
test_get_unique_connection_configs_deterministic_order
ConnectionTest
187
null
rq/django-rq
from typing import Any from django.test import TestCase from redis import Redis class DjangoRQTestCase(TestCase): def assert_connection_kwargs(self, connection: Redis, config: dict[str, Any]) -> None: """ Assert that connection pool kwargs match expected configuration. Args: ...
config['PORT'])
self.assertEqual
complex_expr
tests/base.py
assert_connection_kwargs
DjangoRQTestCase
36
null
rq/django-rq
from typing import Any from django.test import TestCase from redis import Redis class DjangoRQTestCase(TestCase): def assert_connection_kwargs(self, connection: Redis, config: dict[str, Any]) -> None: """ Assert that connection pool kwargs match expected configuration. Args: ...
value)
self.assertEqual
variable
tests/base.py
assert_connection_kwargs
DjangoRQTestCase
41
null
rq/django-rq
import datetime from unittest import TestCase, skip from unittest.mock import PropertyMock, patch from uuid import uuid4 from django.test import override_settings from rq.registry import ScheduledJobRegistry from django_rq.cron import DjangoCronScheduler from django_rq.queues import get_queue from django_rq.utils imp...
scheduler.connection)
self.assertIsNotNone
complex_expr
tests/test_django_rq_utils.py
test_get_cron_schedulers
UtilsTest
43
null
rq/django-rq
import datetime import sys import time from typing import Any, cast from unittest import mock, skipIf from unittest.mock import PropertyMock, patch from uuid import uuid4 import rq from django.core.exceptions import ImproperlyConfigured from django.conf import settings from django.core.management import call_command f...
500)
self.assertEqual
numeric_literal
tests/tests.py
test_default_timeout
QueuesTest
268
null
rq/django-rq
import datetime from unittest import TestCase, skip from unittest.mock import PropertyMock, patch from uuid import uuid4 from django.test import override_settings from rq.registry import ScheduledJobRegistry from django_rq.cron import DjangoCronScheduler from django_rq.queues import get_queue from django_rq.utils imp...
[job2])
self.assertEqual
collection
tests/test_django_rq_utils.py
test_get_jobs
UtilsTest
90
null
rq/django-rq
import sys from unittest import mock, skipIf from unittest.mock import MagicMock, patch from django.conf import settings from django.test import TestCase, override_settings from django_rq.connection_utils import ( get_connection, get_connection_by_index, get_redis_connection, get_unique_connection_con...
expected_config['DB'])
self.assertEqual
complex_expr
tests/test_connections.py
test_get_connection_by_index
ConnectionTest
219
null
rq/django-rq
import uuid from datetime import datetime from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.job import Job, JobStatus from rq.registry import ( DeferredJobRegistry, FailedJobRegistry, ...
1)
self.assertEqual
numeric_literal
tests/test_views.py
test_requeue_all_if_deleted_job
ViewTest
135
null
rq/django-rq
from django.core.exceptions import ImproperlyConfigured from django.db import transaction from django.test import TestCase, TransactionTestCase, override_settings from django.urls import reverse from django_rq import thread_queue from django_rq.queues import get_commit_mode, get_queue from tests.fixtures import say_he...
())
self.assertEqual
collection
tests/test_commit_modes.py
test_enqueue_autocommit_off
ThreadQueueTest
78
null
rq/django-rq
from contextlib import suppress from io import StringIO from unittest.mock import patch from django.contrib.auth.models import User from django.core.management import call_command from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.cron impo...
CronJob)
self.assertIsInstance
variable
tests/test_cron.py
test_first_register_initializes_connection
CronTest
36
null
rq/django-rq
from contextlib import suppress from io import StringIO from unittest.mock import patch from django.contrib.auth.models import User from django.core.management import call_command from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.cron impo...
Exception)
self.assertRaises
variable
tests/test_cron.py
test_rqcron_command_exceptions
CronCommandTest
138
null
rq/django-rq
from unittest import skipIf from unittest.mock import patch from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import NoReverseMatch, reverse from django_rq import get_queue, thread_queue from django_rq.workers import ...
200)
self.assertEqual
numeric_literal
tests/test_prometheus_metrics.py
assertMetricsContain
PrometheusTest
49
null
rq/django-rq
from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from django_rq import get_queue from .fixtures import say_hello from .redis_config import REDIS_CONFIG_1 from .utils import get_queue_index class Unaut...
[302, 403])
self.assertIn
collection
tests/test_admin_integration.py
test_requires_staff_authentication
UnauthenticatedAdminURLTest
143
null
rq/django-rq
import sys from unittest import mock, skipIf from unittest.mock import MagicMock, patch from django.conf import settings from django.test import TestCase, override_settings from django_rq.connection_utils import ( get_connection, get_connection_by_index, get_redis_connection, get_unique_connection_con...
config)
assert_*
variable
tests/test_connections.py
test_get_connection_default
ConnectionTest
31
null
rq/django-rq
import uuid from datetime import datetime from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.job import Job, JobStatus from rq.registry import ( DeferredJobRegistry, FailedJobRegistry, ...
job)
self.assertEqual
variable
tests/test_views.py
test_job_details
ViewTest
52
null
rq/django-rq
import datetime import sys import time from typing import Any, cast from unittest import mock, skipIf from unittest.mock import PropertyMock, patch from uuid import uuid4 import rq from django.core.exceptions import ImproperlyConfigured from django.conf import settings from django.core.management import call_command f...
int)
self.assertIsInstance
variable
tests/tests.py
test_worker_scheduler_pid_active
SchedulerPIDTest
637
null
rq/django-rq
import datetime from unittest import TestCase, skip from unittest.mock import PropertyMock, patch from uuid import uuid4 from django.test import override_settings from rq.registry import ScheduledJobRegistry from django_rq.cron import DjangoCronScheduler from django_rq.queues import get_queue from django_rq.utils imp...
1)
self.assertEqual
numeric_literal
tests/test_django_rq_utils.py
test_get_statistics
UtilsTest
72
null
rq/django-rq
import datetime import sys import time from typing import Any, cast from unittest import mock, skipIf from unittest.mock import PropertyMock, patch from uuid import uuid4 import rq from django.core.exceptions import ImproperlyConfigured from django.conf import settings from django.core.management import call_command f...
Job)
self.assertIs
variable
tests/tests.py
test_default_job_class
JobClassTest
501
null
rq/django-rq
import datetime import sys import time from typing import Any, cast from unittest import mock, skipIf from unittest.mock import PropertyMock, patch from uuid import uuid4 import rq from django.core.exceptions import ImproperlyConfigured from django.conf import settings from django.core.management import call_command f...
pid)
self.assertIsNotNone
variable
tests/tests.py
test_worker_scheduler_pid_active
SchedulerPIDTest
635
null
rq/django-rq
from django.core.exceptions import ImproperlyConfigured from django.db import transaction from django.test import TestCase, TransactionTestCase, override_settings from django.urls import reverse from django_rq import thread_queue from django_rq.queues import get_commit_mode, get_queue from tests.fixtures import say_he...
2)
self.assertEqual
numeric_literal
tests/test_commit_modes.py
test_nested_atomic_blocks
OnDbCommitTest
204
null
rq/django-rq
import sys from unittest import mock, skipIf from unittest.mock import MagicMock, patch from django.conf import settings from django.test import TestCase, override_settings from django_rq.connection_utils import ( get_connection, get_connection_by_index, get_redis_connection, get_unique_connection_con...
2)
self.assertEqual
numeric_literal
tests/test_connections.py
test_get_unique_connection_configs
ConnectionTest
107
null
rq/django-rq
import datetime import sys import time from typing import Any, cast from unittest import mock, skipIf from unittest.mock import PropertyMock, patch from uuid import uuid4 import rq from django.core.exceptions import ImproperlyConfigured from django.conf import settings from django.core.management import call_command f...
0)
self.assertEqual
numeric_literal
tests/tests.py
test_suspend_and_resume_commands
SuspendResumeTest
515
null
rq/django-rq
from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from django_rq import get_queue from .fixtures import say_hello from .redis_config import REDIS_CONFIG_1 from .utils import get_queue_index class Unaut...
302)
self.assertEqual
numeric_literal
tests/test_admin_integration.py
test_requires_staff_authentication
UnauthenticatedAdminURLTest
132
null
rq/django-rq
import datetime from unittest import TestCase, skip from unittest.mock import PropertyMock, patch from uuid import uuid4 from django.test import override_settings from rq.registry import ScheduledJobRegistry from django_rq.cron import DjangoCronScheduler from django_rq.queues import get_queue from django_rq.utils imp...
'async')
self.assertEqual
string_literal
tests/test_django_rq_utils.py
test_get_statistics
UtilsTest
71
null
rq/django-rq
from contextlib import suppress from io import StringIO from unittest.mock import patch from django.contrib.auth.models import User from django.core.management import call_command from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.cron impo...
SystemExit)
self.assertRaises
variable
tests/test_cron.py
test_rqcron_command_exceptions
CronCommandTest
133
null
rq/django-rq
import datetime from unittest import TestCase, skip from unittest.mock import PropertyMock, patch from uuid import uuid4 from django.test import override_settings from rq.registry import ScheduledJobRegistry from django_rq.cron import DjangoCronScheduler from django_rq.queues import get_queue from django_rq.utils imp...
initial_count)
self.assertGreater
variable
tests/test_django_rq_utils.py
test_get_cron_schedulers
UtilsTest
37
null
rq/django-rq
import uuid from datetime import datetime from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.job import Job, JobStatus from rq.registry import ( DeferredJobRegistry, FailedJobRegistry, ...
302)
self.assertEqual
numeric_literal
tests/test_views.py
test_statistics_json_view
ViewTest
355
null
rq/django-rq
from contextlib import suppress from io import StringIO from unittest.mock import patch from django.contrib.auth.models import User from django.core.management import call_command from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.cron impo...
"async")
self.assertEqual
string_literal
tests/test_cron.py
test_connection_validation
CronTest
61
null
rq/django-rq
import datetime import sys import time from typing import Any, cast from unittest import mock, skipIf from unittest.mock import PropertyMock, patch from uuid import uuid4 import rq from django.core.exceptions import ImproperlyConfigured from django.conf import settings from django.core.management import call_command f...
'url')
self.assertEqual
string_literal
tests/tests.py
test_get_queue_url
QueuesTest
96
null
rq/django-rq
import logging import os import signal import subprocess import sys import time import unittest from urllib.parse import urlunsplit import psycopg2 import requests from django.conf import settings DJANGO_SETTINGS_MODULE = "integration_test.settings" os.environ.setdefault("DJANGO_SETTINGS_MODULE", DJANGO_SETTINGS_MODU...
"Entries: {}".format(",".join(expected)))
self.assertEqual
string_literal
integration_test/_tests.py
assertEntries
IntegrationTest
105
null
rq/django-rq
import sys from unittest import mock, skipIf from unittest.mock import MagicMock, patch from django.conf import settings from django.test import TestCase, override_settings from django_rq.connection_utils import ( get_connection, get_connection_by_index, get_redis_connection, get_unique_connection_con...
sentinel_mock)
self.assertEqual
variable
tests/test_connections.py
test_get_connection_sentinel
ConnectionTest
55
null
rq/django-rq
import datetime from unittest import TestCase, skip from unittest.mock import PropertyMock, patch from uuid import uuid4 from django.test import override_settings from rq.registry import ScheduledJobRegistry from django_rq.cron import DjangoCronScheduler from django_rq.queues import get_queue from django_rq.utils imp...
0)
self.assertEqual
numeric_literal
tests/test_django_rq_utils.py
test_get_jobs
UtilsTest
97
null
rq/django-rq
from typing import Any from django.test import TestCase from redis import Redis class DjangoRQTestCase(TestCase): def assert_connection_kwargs(self, connection: Redis, config: dict[str, Any]) -> None: """ Assert that connection pool kwargs match expected configuration. Args: ...
config['HOST'])
self.assertEqual
complex_expr
tests/base.py
assert_connection_kwargs
DjangoRQTestCase
35
null
rq/django-rq
import uuid from datetime import datetime from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.job import Job, JobStatus from rq.registry import ( DeferredJobRegistry, FailedJobRegistry, ...
2)
self.assertEqual
numeric_literal
tests/test_views.py
test_requeue_all
ViewTest
113
null
rq/django-rq
import datetime import sys import time from typing import Any, cast from unittest import mock, skipIf from unittest.mock import PropertyMock, patch from uuid import uuid4 import rq from django.core.exceptions import ImproperlyConfigured from django.conf import settings from django.core.management import call_command f...
config)
assert_*
variable
tests/tests.py
test_get_queue_default
QueuesTest
88
null
rq/django-rq
import sys from unittest import mock, skipIf from unittest.mock import MagicMock, patch from django.conf import settings from django.test import TestCase, override_settings from django_rq.connection_utils import ( get_connection, get_connection_by_index, get_redis_connection, get_unique_connection_con...
config['MASTER_NAME'])
self.assertEqual
complex_expr
tests/test_connections.py
test_get_connection_sentinel
ConnectionTest
63
null
rq/django-rq
import uuid from datetime import datetime from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.job import Job, JobStatus from rq.registry import ( DeferredJobRegistry, FailedJobRegistry, ...
200)
self.assertEqual
numeric_literal
tests/test_views.py
test_job_details
ViewTest
57
null
rq/django-rq
import logging import os import signal import subprocess import sys import time import unittest from urllib.parse import urlunsplit import psycopg2 import requests from django.conf import settings DJANGO_SETTINGS_MODULE = "integration_test.settings" os.environ.setdefault("DJANGO_SETTINGS_MODULE", DJANGO_SETTINGS_MODU...
500)
self.assertEqual
numeric_literal
integration_test/_tests.py
assertFailure
IntegrationTest
100
null
rq/django-rq
import sys from unittest import mock, skipIf from unittest.mock import MagicMock, patch from django.conf import settings from django.test import TestCase, override_settings from django_rq.connection_utils import ( get_connection, get_connection_by_index, get_redis_connection, get_unique_connection_con...
sentinel_instances)
self.assertListEqual
variable
tests/test_connections.py
test_get_connection_sentinel
ConnectionTest
60
null
rq/django-rq
import datetime import sys import time from typing import Any, cast from unittest import mock, skipIf from unittest.mock import PropertyMock, patch from uuid import uuid4 import rq from django.core.exceptions import ImproperlyConfigured from django.conf import settings from django.core.management import call_command f...
60)
self.assertNotEqual
numeric_literal
tests/tests.py
test_job_decorator_queue_result_ttl
DecoratorTest
333
null
rq/django-rq
import datetime import sys import time from typing import Any, cast from unittest import mock, skipIf from unittest.mock import PropertyMock, patch from uuid import uuid4 import rq from django.core.exceptions import ImproperlyConfigured from django.conf import settings from django.core.management import call_command f...
False)
self.assertIs
bool_literal
tests/tests.py
test_scheduler_scheduler_pid_active
SchedulerPIDTest
595
null
rq/django-rq
from contextlib import suppress from io import StringIO from unittest.mock import patch from django.contrib.auth.models import User from django.core.management import call_command from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.cron impo...
[])
self.assertEqual
collection
tests/test_cron.py
test_django_cron_scheduler_init
CronTest
24
null
rq/django-rq
import datetime from unittest import TestCase, skip from unittest.mock import PropertyMock, patch from uuid import uuid4 from django.test import override_settings from rq.registry import ScheduledJobRegistry from django_rq.cron import DjangoCronScheduler from django_rq.queues import get_queue from django_rq.utils imp...
2)
self.assertEqual
numeric_literal
tests/test_django_rq_utils.py
test_get_jobs
UtilsTest
86
null
rq/django-rq
import uuid from datetime import datetime from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.job import Job, JobStatus from rq.registry import ( DeferredJobRegistry, FailedJobRegistry, ...
401)
self.assertEqual
numeric_literal
tests/test_views.py
test_statistics_json_view
ViewTest
358
null
rq/django-rq
from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from django_rq import get_queue from .fixtures import say_hello from .redis_config import REDIS_CONFIG_1 from .utils import get_queue_index class Authe...
200)
self.assertEqual
numeric_literal
tests/test_admin_integration.py
test_dashboard_url
AuthenticatedAdminURLTest
46
null
rq/django-rq
import datetime import sys import time from typing import Any, cast from unittest import mock, skipIf from unittest.mock import PropertyMock, patch from uuid import uuid4 import rq from django.core.exceptions import ImproperlyConfigured from django.conf import settings from django.core.management import call_command f...
1)
self.assertEqual
numeric_literal
tests/tests.py
test_get_worker_specified
WorkersTest
380
null
rq/django-rq
from django.core.exceptions import ImproperlyConfigured from django.db import transaction from django.test import TestCase, TransactionTestCase, override_settings from django.urls import reverse from django_rq import thread_queue from django_rq.queues import get_commit_mode, get_queue from tests.fixtures import say_he...
1)
self.assertEqual
numeric_literal
tests/test_commit_modes.py
test_commit
ThreadQueueTest
97
null
rq/django-rq
import datetime from unittest import TestCase, skip from unittest.mock import PropertyMock, patch from uuid import uuid4 from django.test import override_settings from rq.registry import ScheduledJobRegistry from django_rq.cron import DjangoCronScheduler from django_rq.queues import get_queue from django_rq.utils imp...
DjangoCronScheduler)
self.assertIsInstance
variable
tests/test_django_rq_utils.py
test_get_cron_schedulers
UtilsTest
42
null
rq/django-rq
import datetime import sys import time from typing import Any, cast from unittest import mock, skipIf from unittest.mock import PropertyMock, patch from uuid import uuid4 import rq from django.core.exceptions import ImproperlyConfigured from django.conf import settings from django.core.management import call_command f...
674)
self.assertEqual
numeric_literal
tests/tests.py
test_job_decorator_with_result_ttl
DecoratorTest
317
null
rq/django-rq
import uuid from datetime import datetime from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.job import Job, JobStatus from rq.registry import ( DeferredJobRegistry, FailedJobRegistry, ...
0)
self.assertEqual
numeric_literal
tests/test_views.py
test_scheduled_jobs_registry_removal
ViewTest
284
null
rq/django-rq
from contextlib import suppress from io import StringIO from unittest.mock import patch from django.contrib.auth.models import User from django.core.management import call_command from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.cron impo...
0)
self.assertGreaterEqual
numeric_literal
tests/test_cron.py
test_connection_index_property
CronTest
86
null
rq/django-rq
import datetime import sys import time from typing import Any, cast from unittest import mock, skipIf from unittest.mock import PropertyMock, patch from uuid import uuid4 import rq from django.core.exceptions import ImproperlyConfigured from django.conf import settings from django.core.management import call_command f...
5432)
self.assertEqual
numeric_literal
tests/tests.py
test_scheduler_default_result_ttl
SchedulerTest
494
null
rq/django-rq
from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from django_rq import get_queue from .fixtures import say_hello from .redis_config import REDIS_CONFIG_1 from .utils import get_queue_index class Unaut...
401)
self.assertEqual
numeric_literal
tests/test_admin_integration.py
test_api_token_authentication
UnauthenticatedAdminURLTest
158
null
rq/django-rq
from contextlib import suppress from io import StringIO from unittest.mock import patch from django.contrib.auth.models import User from django.core.management import call_command from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.cron impo...
"* * * * *")
self.assertEqual
string_literal
tests/test_cron.py
test_first_register_initializes_connection
CronTest
40
null
rq/django-rq
from unittest import skipIf from unittest.mock import patch from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import NoReverseMatch, reverse from django_rq import get_queue, thread_queue from django_rq.workers import ...
set(response.content.decode('utf-8').splitlines()))
self.assertLessEqual
func_call
tests/test_prometheus_metrics.py
assertMetricsContain
PrometheusTest
50
null
rq/django-rq
import logging import os import signal import subprocess import sys import time import unittest from urllib.parse import urlunsplit import psycopg2 import requests from django.conf import settings DJANGO_SETTINGS_MODULE = "integration_test.settings" os.environ.setdefault("DJANGO_SETTINGS_MODULE", DJANGO_SETTINGS_MODU...
"Enqueued")
self.assertEqual
string_literal
integration_test/_tests.py
enqueue
IntegrationTest
110
null
rq/django-rq
from contextlib import suppress from io import StringIO from unittest.mock import patch from django.contrib.auth.models import User from django.core.management import call_command from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.cron impo...
3)
self.assertEqual
numeric_literal
tests/test_cron.py
test_connection_validation
CronTest
60
null
rq/django-rq
from typing import Any from unittest.mock import patch from rq.exceptions import NoSuchJobError from rq.job import Job from django_rq.queues import get_connection, get_queue_by_index def _is_buggy_retry(kwargs: dict[str, Any]) -> bool: return ( Retry is not None and (retry := kwargs.get('retry'))...
connection_kwargs
assert
variable
tests/utils.py
get_queue_index
42
null
rq/django-rq
from django.core.exceptions import ImproperlyConfigured from django.db import transaction from django.test import TestCase, TransactionTestCase, override_settings from django.urls import reverse from django_rq import thread_queue from django_rq.queues import get_commit_mode, get_queue from tests.fixtures import say_he...
0)
self.assertEqual
numeric_literal
tests/test_commit_modes.py
test_commit
ThreadQueueTest
94
null
rq/django-rq
from typing import Any from unittest.mock import patch from rq.exceptions import NoSuchJobError from rq.job import Job from django_rq.queues import get_connection, get_queue_by_index def _is_buggy_retry(kwargs: dict[str, Any]) -> bool: return ( Retry is not None and (retry := kwargs.get('retry'))...
connection_kwargs['retry']._backoff.__dict__
assert
complex_expr
tests/utils.py
get_queue_index
52
null
rq/django-rq
import logging import os import signal import subprocess import sys import time import unittest from urllib.parse import urlunsplit import psycopg2 import requests from django.conf import settings DJANGO_SETTINGS_MODULE = "integration_test.settings" os.environ.setdefault("DJANGO_SETTINGS_MODULE", DJANGO_SETTINGS_MODU...
200)
self.assertEqual
numeric_literal
integration_test/_tests.py
assertEntries
IntegrationTest
104
null
rq/django-rq
import sys from unittest import mock, skipIf from unittest.mock import MagicMock, patch from django.conf import settings from django.test import TestCase, override_settings from django_rq.connection_utils import ( get_connection, get_connection_by_index, get_redis_connection, get_unique_connection_con...
1)
self.assertEqual
numeric_literal
tests/test_connections.py
test_get_connection_sentinel
ConnectionTest
56
null
rq/django-rq
import uuid from datetime import datetime from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.job import Job, JobStatus from rq.registry import ( DeferredJobRegistry, FailedJobRegistry, ...
[job])
self.assertEqual
collection
tests/test_views.py
test_jobs
ViewTest
42
null
rq/django-rq
from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from django_rq import get_queue from .fixtures import say_hello from .redis_config import REDIS_CONFIG_1 from .utils import get_queue_index class Authe...
'application/json')
self.assertEqual
string_literal
tests/test_admin_integration.py
test_stats_json_url
AuthenticatedAdminURLTest
54
null
rq/django-rq
from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from django_rq import get_queue from .fixtures import say_hello from .redis_config import REDIS_CONFIG_1 from .utils import get_queue_index class Unaut...
response.url)
self.assertIn
complex_expr
tests/test_admin_integration.py
test_requires_staff_authentication
UnauthenticatedAdminURLTest
133
null
rq/django-rq
from contextlib import suppress from io import StringIO from unittest.mock import patch from django.contrib.auth.models import User from django.core.management import call_command from django.test import TestCase, override_settings from django.test.client import Client from django.urls import reverse from rq.cron impo...
output)
self.assertIn
variable
tests/test_cron.py
test_rqcron_command
CronCommandTest
109
null
rq/django-rq
import sys from unittest import mock, skipIf from unittest.mock import MagicMock, patch from django.conf import settings from django.test import TestCase, override_settings from django_rq.connection_utils import ( get_connection, get_connection_by_index, get_redis_connection, get_unique_connection_con...
queueName)
self.assertEqual
variable
tests/test_connections.py
test_get_queue_django_redis_cache
RedisCacheTest
246
null
Lancetnik/Propan
from fast_depends.core import build_call_model from pydantic import Field from propan import PropanApp, RabbitBroker from propan.brokers._model.schemas import BaseHandler from propan.cli.docs.gen import get_app_schema def test_scheme_naming(): broker = RabbitBroker() app = PropanApp(broker) @broker.handl...
"PerfectArgument"
assert
string_literal
tests/asyncapi/handler/test_naming.py
test_scheme_naming
56
null
Lancetnik/Propan
from fast_depends.core import build_call_model from propan import Depends from propan.brokers._model.schemas import BaseHandler def test_multi_args(): def dep2(c: int): ... def dep(a: int, m=Depends(dep2)): ... def func(b: float, d=Depends(dep)): ... handler = BaseHandler(fu...
{ "properties": { "a": {"title": "A", "type": "integer"}, "b": {"title": "B", "type": "number"}, "c": {"title": "C", "type": "integer"}, }, "title": "FuncPayload", "type": "object", }
assert
collection
tests/asyncapi/handler/test_dependencies_arguments.py
test_multi_args
54
null
Lancetnik/Propan
import pytest import pydantic from propan.test.redis import build_message from main import healthcheck async def test_publish(test_broker): msg = build_message({ "msg": "ping" }, "ping") with pytest.raises(
pydantic.ValidationError)
pytest.raises
complex_expr
docs/docs_src/quickstart/testing/redis/6_reraise.py
test_publish
9
null
Lancetnik/Propan
from pathlib import Path import pytest from propan.cli.utils.imports import get_app_path, import_object @pytest.mark.parametrize( "test_input,exp_module,exp_app", ( ("module:app", "module", "app"), ("module.module.module:app", "module/module/module", "app"), ), ) def test_get_app_path(tes...
exp_app
assert
variable
tests/cli/utils/test_imports.py
test_get_app_path
25
null
Lancetnik/Propan
from typing import Callable, Type, TypeVar from unittest.mock import Mock from uuid import uuid4 import pytest from fastapi import APIRouter, Depends, FastAPI, Header from fastapi.testclient import TestClient from propan.types import AnyCallable Broker = TypeVar("Broker") class FastAPITestcase: router_class: Ty...
"3"
assert
string_literal
tests/fastapi/case.py
test
FastAPITestcase
79
null
Lancetnik/Propan
import asyncio from unittest.mock import Mock import pytest from propan.annotations import RabbitMessage from propan.brokers.rabbit import ( ExchangeType, RabbitBroker, RabbitExchange, RabbitQueue, ) from propan.test.rabbit import build_message from tests.brokers.base.testclient import BrokerTestclien...
await test_broker.publish( exchange=exch, callback=True, headers={"key": 2, "key2": 2} )
assert
func_call
tests/brokers/rabbit/test_test_client.py
test_header
TestRabbitTestclient
113
null
Lancetnik/Propan
import pytest from propan.test import TestKafkaBroker from main import broker async def test_publish(test_broker): r = await test_broker.publish("ping", "ping", callback=True) assert r ==
"pong"
assert
string_literal
docs/docs_src/quickstart/testing/kafka/3_conftest.py
test_publish
13
null
Lancetnik/Propan
from typing import Tuple import pytest from propan.cli.utils.parser import parse_cli_args APPLICATION = "module:app" ARG1 = ( "--k", "1", ) ARG2 = ( "-k2", "1", ) ARG3 = ("--k3",) ARG4 = ("--no-k4",) ARG5 = ( "--k5", "1", "1", ) ARG6 = ("--some-key",) @pytest.mark.parametrize( "args...
APPLICATION
assert
variable
tests/cli/utils/test_parser.py
test_custom_argument_parsing
41
null
Lancetnik/Propan
import pytest import pydantic from propan.test.nats import build_message from main import healthcheck async def test_publish(test_broker): msg = build_message({ "msg": "ping" }, "ping") with pytest.raises(
pydantic.ValidationError)
pytest.raises
complex_expr
docs/docs_src/quickstart/testing/nats/6_reraise.py
test_publish
9
null
Lancetnik/Propan
from propan.test.sqs import build_message from main import healthcheck async def test_publish(test_broker): msg = build_message("ping", "ping") assert (await healthcheck(msg)) ==
"pong"
assert
string_literal
docs/docs_src/quickstart/testing/sqs/5_build_message.py
test_publish
7
null
Lancetnik/Propan
from propan.test import TestRedisBroker from main import broker async def test_publish(): async with TestRedisBroker(broker) as test_broker: r = await test_broker.publish("ping", "ping", callback=True) assert r ==
"pong"
assert
string_literal
docs/docs_src/quickstart/testing/redis/2_test.py
test_publish
8
null
Lancetnik/Propan
import asyncio from unittest.mock import Mock import pytest from propan.brokers._model import BrokerAsyncUsecase class BrokerConsumeTestcase: @pytest.mark.asyncio async def test_consume_double( self, mock: Mock, queue: str, broker: BrokerAsyncUsecase, ): consume =...
2
assert
numeric_literal
tests/brokers/base/consume.py
test_consume_double
BrokerConsumeTestcase
65
null
Lancetnik/Propan
from pathlib import Path import pytest from propan.cli.utils.imports import get_app_path, import_object def test_import_wrong(): dir, app = get_app_path("tests:test_object") with pytest.raises(
FileNotFoundError)
pytest.raises
variable
tests/cli/utils/test_imports.py
test_import_wrong
10
null
Lancetnik/Propan
import asyncio from unittest.mock import Mock import pytest from propan.annotations import RabbitMessage from propan.brokers.rabbit import ( ExchangeType, RabbitBroker, RabbitExchange, RabbitQueue, ) from propan.test.rabbit import build_message from tests.brokers.base.testclient import BrokerTestclien...
await test_broker.publish( "", "logs.error", exchange=exch, callback=True )
assert
func_call
tests/brokers/rabbit/test_test_client.py
test_topic
TestRabbitTestclient
77
null
Lancetnik/Propan
import asyncio from unittest.mock import Mock import pytest from propan.annotations import RabbitMessage from propan.brokers.rabbit import ( ExchangeType, RabbitBroker, RabbitExchange, RabbitQueue, ) from propan.test.rabbit import build_message from tests.brokers.base.testclient import BrokerTestclien...
await test_broker.publish( "", queue + "1", exchange="test", callback=True )
assert
func_call
tests/brokers/rabbit/test_test_client.py
test_direct
TestRabbitTestclient
35
null
Lancetnik/Propan
from fast_depends.core import build_call_model from pydantic import Field from propan import PropanApp, RabbitBroker from propan.brokers._model.schemas import BaseHandler from propan.cli.docs.gen import get_app_schema def test_pydantic_field_rename(): def func(a: int = Field(title="MyField", description="MyField"...
result["title"]
assert
complex_expr
tests/asyncapi/handler/test_naming.py
test_pydantic_field_rename
17
null
Lancetnik/Propan
from contextlib import asynccontextmanager from typing import Any from unittest.mock import Mock import pytest from fastapi import Depends, FastAPI from fastapi.testclient import TestClient from propan._compat import RequestValidationError from propan.fastapi import KafkaRouter from propan.test import TestKafkaBroker...
router.broker
assert
complex_expr
tests/fastapi/test_base.py
test_nested_lifespan
45
null
Lancetnik/Propan
from propan.utils.classes import Singleton def test_drop(): s1 = Singleton() s1._drop() assert Singleton() is not
s1
assert
variable
tests/utils/test_classes.py
test_drop
11
null
Lancetnik/Propan
import pytest from pydantic import ValidationError from propan.utils import Context, ContextRepo, apply_types def test_context_getattr(context: ContextRepo): a = 1000 context.set_global("key", a) assert context.key is
a
assert
variable
tests/utils/context/test_main.py
test_context_getattr
11
null