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 |
|---|---|---|---|---|---|---|---|---|---|
temporalio/samples-python | import uuid
import pytest
from temporalio.client import Client, WorkflowUpdateFailedError
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from message_passing.introduction.starter import TASK_QUEUE
from message_passing.introduction.workflows import (
GetLanguagesInput,
... | [ Language.ARABIC, Language.CHINESE, Language.ENGLISH, Language.FRENCH, Language.HINDI, Language.PORTUGUESE, Language.SPANISH, ] | assert | collection | tests/message_passing/introduction/test_introduction_sample.py | test_queries | 37 | null | |
temporalio/samples-python | import sys
import unittest.mock
from collections import abc
import pytest
import sentry_sdk
import temporalio.activity
import temporalio.workflow
from sentry_sdk.integrations.asyncio import AsyncioIntegration
from temporalio.client import Client
from temporalio.worker import Worker
from temporalio.worker.workflow_san... | 0 | assert | numeric_literal | tests/sentry/test_interceptor.py | test_sentry_interceptor_reports_no_errors_when_workflow_succeeds | 81 | null | |
temporalio/samples-python | import uuid
from enum import Enum
import pytest
from temporalio import client, worker
from temporalio.testing import WorkflowEnvironment
from message_passing.waiting_for_handlers_and_compensation import (
WorkflowExitType,
WorkflowInput,
)
from message_passing.waiting_for_handlers_and_compensation.activities ... | client.WorkflowFailureError) | pytest.raises | complex_expr | tests/message_passing/waiting_for_handlers_and_compensation/waiting_for_handlers_and_compensation_test.py | test_waiting_for_handlers_and_compensation | 102 | null | |
temporalio/samples-python | import asyncio
import uuid
from typing import Callable, Sequence
import pytest
from temporalio.client import Client, WorkflowUpdateFailedError
from temporalio.exceptions import ApplicationError
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from message_passing.safe_message_ha... | 24 | assert | numeric_literal | tests/message_passing/safe_message_handlers/workflow_test.py | test_update_failure | 170 | null | |
temporalio/samples-python | import pytest
from temporalio.testing import ActivityEnvironment
from hello.hello_activity_choice import (
order_apples,
order_bananas,
order_cherries,
order_oranges,
)
activity_test_data = [
(order_apples, 5, "Ordered 5 Apples..."),
(order_bananas, 5, "Ordered 5 Bananas..."),
(order_cherr... | expected_result | assert | variable | tests/hello/hello_activity_choice_test.py | test_order_fruit | 31 | null | |
temporalio/samples-python | import uuid
from enum import Enum
import pytest
from temporalio import client, worker
from temporalio.testing import WorkflowEnvironment
from message_passing.waiting_for_handlers_and_compensation import (
WorkflowExitType,
WorkflowInput,
)
from message_passing.waiting_for_handlers_and_compensation.activities ... | client.WorkflowUpdateFailedError) | pytest.raises | complex_expr | tests/message_passing/waiting_for_handlers_and_compensation/waiting_for_handlers_and_compensation_test.py | test_waiting_for_handlers_and_compensation | 88 | null | |
temporalio/samples-python | import asyncio
import uuid
from typing import Callable, Sequence
import pytest
from temporalio.client import Client, WorkflowUpdateFailedError
from temporalio.exceptions import ApplicationError
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from message_passing.safe_message_ha... | 2 | assert | numeric_literal | tests/message_passing/safe_message_handlers/workflow_test.py | test_safe_message_handlers | 66 | null | |
temporalio/samples-python | import asyncio
import sys
import pytest
from temporalio.client import Client
from temporalio.testing import WorkflowEnvironment
import nexus_multiple_args.caller.app
import nexus_multiple_args.caller.workflows
import nexus_multiple_args.handler.worker
from tests.helpers.nexus import create_nexus_endpoint, delete_nexu... | ( "Hello Nexus 👋", "¡Hola! Nexus 👋", ) | assert | collection | tests/nexus_multiple_args/nexus_multiple_args_test.py | test_nexus_multiple_args | 41 | null | |
temporalio/samples-python | import random
import uuid
from typing import Dict, List
from unittest import mock
import pytest
from temporalio import activity, exceptions
from temporalio.client import Client, WorkflowFailureError
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from worker_specific_task_queue... | WorkflowFailureError) | pytest.raises | variable | tests/activity_sticky_queues/activity_sticky_worker_workflow_test.py | test_processing_fails_gracefully | 69 | null | |
temporalio/samples-python | from enum import Enum
import pytest
from temporalio import client, worker
from temporalio.testing import WorkflowEnvironment
from message_passing.waiting_for_handlers import WorkflowExitType, WorkflowInput
from message_passing.waiting_for_handlers.activities import (
activity_executed_by_update_handler,
)
from me... | client.WorkflowUpdateFailedError) | pytest.raises | complex_expr | tests/message_passing/waiting_for_handlers/waiting_for_handlers_test.py | test_waiting_for_handlers | 73 | null | |
temporalio/samples-python | import uuid
from concurrent.futures import ThreadPoolExecutor
from temporalio import activity
from temporalio.client import Client
from temporalio.worker import Worker
from custom_metric.worker import StartTwoActivitiesWorkflow
_TASK_QUEUE = "custom-metric-task-queue"
activity_counter = 0
async def test_custom_met... | None | assert | none_literal | tests/custom_metric/workflow_test.py | test_custom_metric_workflow | 33 | null | |
temporalio/samples-python | import uuid
import pytest
from temporalio.client import Client, WorkflowUpdateFailedError
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from message_passing.introduction.starter import TASK_QUEUE
from message_passing.introduction.workflows import (
GetLanguagesInput,
... | [Language.CHINESE, Language.ENGLISH] | assert | collection | tests/message_passing/introduction/test_introduction_sample.py | test_queries | 34 | null | |
temporalio/samples-python | import asyncio
from collections import defaultdict
from typing import Any, Optional, Sequence
from temporalio import activity
from temporalio.client import Client, WorkflowFailureError, WorkflowHandle
from temporalio.common import WorkflowIDConflictPolicy
from temporalio.worker import Worker
from resource_pool.pool_c... | {"r_a": None, "r_b": None, "r_c": None} | assert | collection | tests/resource_pool/workflow_test.py | test_resource_pool_workflow | 79 | null | |
temporalio/samples-python | import uuid
from datetime import datetime
from ipaddress import IPv4Address
from temporalio.client import Client
from temporalio.worker import Worker
from pydantic_converter_v1.converter import pydantic_data_converter
from pydantic_converter_v1.worker import (
MyPydanticModel,
MyWorkflow,
my_activity,
... | result | assert | variable | tests/pydantic_converter_v1/workflow_test.py | test_workflow_with_pydantic_model | 46 | null | |
temporalio/samples-python | import uuid
from temporalio.client import Client, WorkflowExecutionStatus
from temporalio.worker import Worker
from hello.hello_signal import GreetingWorkflow
async def test_signal_workflow(client: Client):
task_queue_name = str(uuid.uuid4())
async with Worker(client, task_queue=task_queue_name, workflows=[G... | await handle.result() | assert | func_call | tests/hello/hello_signal_test.py | test_signal_workflow | 21 | null | |
temporalio/samples-python | import uuid
from temporalio import activity
from temporalio.client import Client
from temporalio.exceptions import ApplicationError
from temporalio.worker import Worker
from context_propagation.interceptor import ContextPropagationInterceptor
from context_propagation.shared import user_id
from context_propagation.wor... | "test-user" | assert | string_literal | tests/context_propagation/workflow_test.py | say_hello_activity_mock | 18 | null | |
temporalio/samples-python | import asyncio
import sys
import pytest
from temporalio.client import Client
from temporalio.testing import WorkflowEnvironment
import hello_nexus.caller.app
import hello_nexus.caller.workflows
import hello_nexus.handler.worker
from tests.helpers.nexus import create_nexus_endpoint, delete_nexus_endpoint
async def te... | [ "Hello world from sync operation!", "Hello world from workflow run operation!", ] | assert | collection | tests/hello_nexus/hello_nexus_test.py | test_nexus_service_basic | 39 | null | |
temporalio/samples-python | from pathlib import Path
from unittest import mock
from worker_specific_task_queues import tasks
RETURNED_PATH = "valid/path"
tasks._get_delay_secs = mock.MagicMock(return_value=0.0001)
tasks._get_local_path = mock.MagicMock(return_value=Path(RETURNED_PATH))
async def test_download_activity():
worker_id = "an-id... | want | assert | variable | tests/activity_sticky_queues/activity_sticky_queues_activity_test.py | test_download_activity | 19 | null | |
temporalio/samples-python | import asyncio
import uuid
from typing import Callable, Sequence
import pytest
from temporalio.client import Client, WorkflowUpdateFailedError
from temporalio.exceptions import ApplicationError
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from message_passing.safe_message_ha... | 0 | assert | numeric_literal | tests/message_passing/safe_message_handlers/workflow_test.py | test_safe_message_handlers | 83 | null | |
temporalio/samples-python | import pytest
from temporalio import common
from temporalio.client import Client, WithStartWorkflowOperation
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from message_passing.update_with_start.lazy_initialization.workflows import (
ShoppingCartItem,
ShoppingCartWorkfl... | 1797 | assert | numeric_literal | tests/message_passing/lazy_initialization/test_lazy_initialization.py | test_shopping_cart_workflow | 49 | null | |
temporalio/samples-python | import uuid
from datetime import datetime
from ipaddress import IPv4Address
from temporalio.client import Client
from temporalio.contrib.pydantic import pydantic_data_converter
from temporalio.worker import Worker
from pydantic_converter.worker import MyPydanticModel, MyWorkflow, my_activity
async def test_workflow_... | result | assert | variable | tests/pydantic_converter/workflow_test.py | test_workflow_with_pydantic_model | 40 | null | |
temporalio/samples-python | import asyncio
from collections import defaultdict
from typing import Any, Optional, Sequence
from temporalio import activity
from temporalio.client import Client, WorkflowFailureError, WorkflowHandle
from temporalio.common import WorkflowIDConflictPolicy
from temporalio.worker import Worker
from resource_pool.pool_c... | resource | assert | variable | tests/resource_pool/workflow_test.py | test_resource_pool_workflow | 51 | null | |
temporalio/samples-python | import asyncio
import uuid
from typing import Type
import pytest
from temporalio import workflow
from temporalio.client import Client
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
import nexus_sync_operations.handler.service_handler
import nexus_sync_operations.handler.worker... | Language.ENGLISH | assert | complex_expr | tests/nexus_sync_operations/nexus_sync_operations_test.py | run | TestCallerWorkflow | 44 | null |
temporalio/samples-python | from enum import Enum
import pytest
from temporalio import client, worker
from temporalio.testing import WorkflowEnvironment
from message_passing.waiting_for_handlers import WorkflowExitType, WorkflowInput
from message_passing.waiting_for_handlers.activities import (
activity_executed_by_update_handler,
)
from me... | client.WorkflowFailureError) | pytest.raises | complex_expr | tests/message_passing/waiting_for_handlers/waiting_for_handlers_test.py | test_waiting_for_handlers | 79 | null | |
temporalio/samples-python | from pathlib import Path
from unittest import mock
from worker_specific_task_queues import tasks
RETURNED_PATH = "valid/path"
tasks._get_delay_secs = mock.MagicMock(return_value=0.0001)
tasks._get_local_path = mock.MagicMock(return_value=Path(RETURNED_PATH))
async def test_clean_up_activity():
with mock.patch.ob... | RETURNED_PATH) | assert_* | variable | tests/activity_sticky_queues/activity_sticky_queues_activity_test.py | test_clean_up_activity | 35 | null | |
temporalio/samples-python | import uuid
from datetime import timedelta
from temporalio import activity
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from sleep_for_days.starter import TASK_QUEUE
from sleep_for_days.workflows import SendEmailInput, SleepForDaysWorkflow
async def test_sleep_for_days_work... | 1 | assert | numeric_literal | tests/sleep_for_days/workflow_test.py | test_sleep_for_days_workflow | 43 | null | |
temporalio/samples-python | import uuid
import pytest
from temporalio.client import Client
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from polling.infrequent.activities import compose_greeting
from polling.infrequent.workflows import GreetingWorkflow
async def test_infrequent_polling_workflow(client... | "Hello, Temporal!" | assert | string_literal | tests/polling/infrequent/workflow_test.py | test_infrequent_polling_workflow | 31 | null | |
temporalio/samples-python | import sys
import unittest.mock
from collections import abc
import pytest
import sentry_sdk
import temporalio.activity
import temporalio.workflow
from sentry_sdk.integrations.asyncio import AsyncioIntegration
from temporalio.client import Client
from temporalio.worker import Worker
from temporalio.worker.workflow_san... | "Exception" | assert | string_literal | tests/sentry/test_interceptor.py | test_sentry_interceptor_captures_errors | 109 | null | |
temporalio/samples-python | import uuid
from temporalio.client import Client
from temporalio.worker import Worker
from custom_converter.shared import (
GreetingInput,
GreetingOutput,
greeting_data_converter,
)
from custom_converter.workflow import GreetingWorkflow
async def test_workflow_with_custom_converter(client: Client):
#... | "Hello, Temporal" | assert | string_literal | tests/custom_converter/workflow_test.py | test_workflow_with_custom_converter | 28 | null | |
temporalio/samples-python | import asyncio
import uuid
from typing import Callable, Sequence
import pytest
from temporalio.client import Client, WorkflowUpdateFailedError
from temporalio.exceptions import ApplicationError
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from message_passing.safe_message_ha... | result_2.nodes_assigned | assert | complex_expr | tests/message_passing/safe_message_handlers/workflow_test.py | test_update_idempotency | 124 | null | |
temporalio/samples-python | import uuid
import pytest
from temporalio.client import Client, WorkflowExecutionStatus
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from hello.hello_update import GreetingWorkflow
async def test_update_workflow(client: Client, env: WorkflowEnvironment):
task_queue_name... | update_result | assert | variable | tests/hello/hello_update_test.py | test_update_workflow | 23 | null | |
temporalio/samples-python | import uuid
from concurrent.futures import ThreadPoolExecutor
from temporalio import activity
from temporalio.client import Client
from temporalio.worker import Worker
from hello.hello_activity import (
ComposeGreetingInput,
GreetingWorkflow,
compose_greeting,
)
async def test_execute_workflow(client: Cl... | await client.execute_workflow( GreetingWorkflow.run, "World", id=str(uuid.uuid4()), task_queue=task_queue_name, ) | assert | func_call | tests/hello/hello_activity_test.py | test_execute_workflow | 25 | null | |
temporalio/samples-python | import sys
import unittest.mock
from collections import abc
import pytest
import sentry_sdk
import temporalio.activity
import temporalio.workflow
from sentry_sdk.integrations.asyncio import AsyncioIntegration
from temporalio.client import Client
from temporalio.worker import Worker
from temporalio.worker.workflow_san... | "broken_activity" | assert | string_literal | tests/sentry/test_interceptor.py | test_sentry_interceptor_captures_errors | 134 | null | |
temporalio/samples-python | import uuid
from temporalio import activity
from temporalio.client import Client
from temporalio.exceptions import ApplicationError
from temporalio.worker import Worker
from context_propagation.interceptor import ContextPropagationInterceptor
from context_propagation.shared import user_id
from context_propagation.wor... | "Mock for some-name" | assert | string_literal | tests/context_propagation/workflow_test.py | test_workflow_with_context_propagator | 46 | null | |
temporalio/samples-python | import asyncio
import uuid
from concurrent.futures import ThreadPoolExecutor
import pytest
from temporalio.client import Client, WorkflowExecutionStatus, WorkflowFailureError
from temporalio.exceptions import CancelledError
from temporalio.worker import Worker
from hello.hello_cancellation import (
CancellationWo... | (await handle.describe()).status | assert | collection | tests/hello/hello_cancellation_test.py | test_cancel_workflow | 44 | null | |
temporalio/samples-python | import uuid
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from hello.hello_query import GreetingWorkflow
async def test_query_workflow():
task_queue_name = str(uuid.uuid4())
# start manual time skipping
async with await WorkflowEnvironment.start_time_skipping() a... | await handle.query(GreetingWorkflow.greeting) | assert | func_call | tests/hello/hello_query_test.py | test_query_workflow | 23 | null | |
temporalio/samples-python | import uuid
from temporalio import workflow
from temporalio.client import Client
from temporalio.worker import Worker
from hello.hello_child_workflow import (
ComposeGreetingInput,
ComposeGreetingWorkflow,
GreetingWorkflow,
)
async def test_child_workflow(client: Client):
task_queue_name = str(uuid.u... | await client.execute_workflow( GreetingWorkflow.run, "World", id=str(uuid.uuid4()), task_queue=task_queue_name, ) | assert | func_call | tests/hello/hello_child_test.py | test_child_workflow | 21 | null | |
temporalio/samples-python | import asyncio
import uuid
from typing import Type
import pytest
from temporalio import workflow
from temporalio.client import Client
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
import nexus_sync_operations.handler.service_handler
import nexus_sync_operations.handler.worker... | Language.ARABIC | assert | complex_expr | tests/nexus_sync_operations/nexus_sync_operations_test.py | run | TestCallerWorkflow | 66 | null |
temporalio/samples-python | import uuid
from datetime import timedelta
from temporalio import activity
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from sleep_for_days.starter import TASK_QUEUE
from sleep_for_days.workflows import SendEmailInput, SleepForDaysWorkflow
async def test_sleep_for_days_work... | timedelta(days=90) | assert | func_call | tests/sleep_for_days/workflow_test.py | test_sleep_for_days_workflow | 53 | null | |
temporalio/samples-python | import pytest
from temporalio import common
from temporalio.client import Client, WithStartWorkflowOperation
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from message_passing.update_with_start.lazy_initialization.workflows import (
ShoppingCartItem,
ShoppingCartWorkfl... | [ (ShoppingCartItem(sku="item-1", quantity=2), 1198), (ShoppingCartItem(sku="item-2", quantity=1), 599), ] | assert | collection | tests/message_passing/lazy_initialization/test_lazy_initialization.py | test_shopping_cart_workflow | 56 | null | |
temporalio/samples-python | import asyncio
import uuid
from typing import Type
import pytest
from temporalio import workflow
from temporalio.client import Client
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
import nexus_sync_operations.handler.service_handler
import nexus_sync_operations.handler.worker... | Language.CHINESE | assert | complex_expr | tests/nexus_sync_operations/nexus_sync_operations_test.py | run | TestCallerWorkflow | 55 | null |
mootdx/mootdx | import unittest
from unittest import mock
import pytest
from mootdx.consts import MARKET_BJ
from mootdx.consts import MARKET_SH
from mootdx.consts import MARKET_SZ
from mootdx.utils import get_config_path
from mootdx.utils import get_stock_market
from mootdx.utils import md5sum
from mootdx.utils import to_data
data ... | to_data({}).empty) | self.assertTrue | func_call | tests/utils/test_utils.py | test_to_data_empty | TestToData | 44 | null |
mootdx/mootdx | import unittest
from mootdx.reader import Reader
from tests.conftest import is_empty
class TestExReader(unittest.TestCase):
reader = None
def setUp(self):
self.reader = Reader.factory(market='ext', tdxdir='tests/fixtures')
def tearDown(self):
pass
def test_daily(self):
data ... | True | assert | bool_literal | tests/reader/test_reader_ext.py | test_daily | TestExReader | 24 | null |
mootdx/mootdx | import unittest
from unittest import mock
import pytest
from mootdx.consts import MARKET_BJ
from mootdx.consts import MARKET_SH
from mootdx.consts import MARKET_SZ
from mootdx.utils import get_config_path
from mootdx.utils import get_stock_market
from mootdx.utils import md5sum
from mootdx.utils import to_data
data ... | '.mootdx' in config) | self.assertTrue | string_literal | tests/utils/test_utils.py | test_platform_windows | TestConfigPath | 55 | null |
mootdx/mootdx | import unittest
from unittest import mock
import pytest
from mootdx.consts import MARKET_BJ
from mootdx.consts import MARKET_SH
from mootdx.consts import MARKET_SZ
from mootdx.utils import get_config_path
from mootdx.utils import get_stock_market
from mootdx.utils import md5sum
from mootdx.utils import to_data
data ... | to_data([]).empty) | self.assertTrue | func_call | tests/utils/test_utils.py | test_to_data_empty | TestToData | 45 | null |
mootdx/mootdx | import glob
import unittest
from pathlib import Path
import pytest
from mootdx.affair import Affair
from mootdx.logger import logger
class TestAffair(unittest.TestCase):
files = []
downdir = 'tests/fixtures/tmp'
def setup_class(self) -> None:
logger.info('获取文件列表')
self.files = [x['filen... | csv_file.exists()) | self.assertTrue | func_call | tests/test_affairs.py | test_parse_export | TestAffair | 37 | null |
mootdx/mootdx | import unittest
from mootdx.quotes import Quotes
from mootdx.tools.reversion import reversion
from mootdx.utils.adjust import get_xdxr
class TestReversion(unittest.TestCase):
client = None
symbol = '600000'
def setup_class(self):
self.client = Quotes.factory(market='std', timeout=10) # 标准市场
... | False | assert | bool_literal | tests/tools/test_reversion.py | test_get_xdxr | TestReversion | 25 | null |
mootdx/mootdx | import glob
from pathlib import Path
import pytest
from mootdx.logger import logger
from mootdx.tools.customize import Customize
tdxdir = 'tests/fixtures'
def setup_module():
logger.debug('setup_module')
blocknew = Path(tdxdir, 'T0002', 'blocknew')
blocknew.exists() or blocknew.mkdir(parents=True)
def ... | False | assert | bool_literal | tests/tools/test_customize.py | test_block_search | 62 | null | |
mootdx/mootdx | import glob
import unittest
from pathlib import Path
import pytest
from mootdx.affair import Affair
from mootdx.logger import logger
class TestAffair(unittest.TestCase):
files = []
downdir = 'tests/fixtures/tmp'
def setup_class(self) -> None:
logger.info('获取文件列表')
self.files = [x['filen... | data) | self.assertIsNone | variable | tests/test_affairs.py | test_parse_err | TestAffair | 28 | null |
mootdx/mootdx | import glob
from pathlib import Path
import pytest
from mootdx.logger import logger
from mootdx.tools.customize import Customize
tdxdir = 'tests/fixtures'
def setup_module():
logger.debug('setup_module')
blocknew = Path(tdxdir, 'T0002', 'blocknew')
blocknew.exists() or blocknew.mkdir(parents=True)
def ... | Exception) | pytest.raises | variable | tests/tools/test_customize.py | test_block_create | 41 | null | |
mootdx/mootdx | import unittest
from unittest import mock
import pytest
from mootdx.consts import MARKET_BJ
from mootdx.consts import MARKET_SH
from mootdx.consts import MARKET_SZ
from mootdx.utils import get_config_path
from mootdx.utils import get_stock_market
from mootdx.utils import md5sum
from mootdx.utils import to_data
data ... | to_data('aaa').empty) | self.assertTrue | func_call | tests/utils/test_utils.py | test_to_data_empty | TestToData | 46 | null |
mootdx/mootdx | import unittest
from mootdx.quotes import Quotes
from mootdx.tools.reversion import reversion
from mootdx.utils.adjust import get_xdxr
class TestReversion(unittest.TestCase):
client = None
symbol = '600000'
def setup_class(self):
self.client = Quotes.factory(market='std', timeout=10) # 标准市场
... | xdxr.columns | assert | complex_expr | tests/tools/test_reversion.py | test_get_xdxr | TestReversion | 26 | null |
mootdx/mootdx | import os
import pytest
def remove_dep_cli():
os.system('pip uninstall -y click prettytable')
yield
os.system('pip install click prettytable')
def remove_dep_holiday():
os.system('pip uninstall -y py_mini_racer')
yield
os.system('pip install py_mini_racer')
@pytest.mark.skip(reason='暂时不做重复测试... | -1 | assert | numeric_literal | tests/test_useless.py | test_dep_command | 26 | null | |
mootdx/mootdx | import unittest
from pathlib import Path
from mootdx import get_config_path
from mootdx.utils.adjust import get_xdxr
class XDXRTestCase(unittest.TestCase):
symbol = '600000'
def test_no_cache(self):
Path(get_config_path(f'xdxr/{self.symbol}.plk')).unlink()
xdxr = get_xdxr(symbol=self.symbol)
... | False | assert | bool_literal | tests/test_xdxr.py | test_no_cache | XDXRTestCase | 15 | null |
mootdx/mootdx | import datetime
import os
import time
import unittest
from datetime import timedelta
from pathlib import Path
import pytest
from mootdx import get_config_path
from mootdx.contrib.adjust import get_adjust_year
from mootdx.utils.adjust import get_xdxr
class TestAdjustUtil(unittest.TestCase):
symbol = '600036'
... | xdxr_file.exists()) | self.assertFalse | func_call | tests/test_adjust.py | test_get_xdxr | TestAdjustUtil | 52 | null |
mootdx/mootdx | import os
import pytest
def remove_dep_cli():
os.system('pip uninstall -y click prettytable')
yield
os.system('pip install click prettytable')
def remove_dep_holiday():
os.system('pip uninstall -y py_mini_racer')
yield
os.system('pip install py_mini_racer')
@pytest.mark.skip(reason='暂时不做重复测试... | DeprecationWarning | assert | variable | tests/test_useless.py | test_dep_command | 30 | null | |
mootdx/mootdx | import pytest
from mootdx.reader import Reader
from tests.conftest import is_empty
def reader():
return Reader.factory(market='std', tdxdir='tests/fixtures')
@pytest.mark.parametrize(
'symbol,adjust,empty', [
('127021', '', False),
('000000', '', True),
('sh881478', '', False),
... | empty | assert | variable | tests/reader/test_reader_std.py | test_daily | 24 | null | |
mootdx/mootdx | import datetime
import os
import time
import unittest
from datetime import timedelta
from pathlib import Path
import pytest
from mootdx import get_config_path
from mootdx.contrib.adjust import get_adjust_year
from mootdx.utils.adjust import get_xdxr
class TestAdjust(unittest.TestCase):
def test_adjust_before0(se... | data.empty) | self.assertFalse | complex_expr | tests/test_adjust.py | test_adjust_before0 | TestAdjust | 19 | null |
mootdx/mootdx | import unittest
from unittest import mock
import pytest
from mootdx.consts import MARKET_BJ
from mootdx.consts import MARKET_SH
from mootdx.consts import MARKET_SZ
from mootdx.utils import get_config_path
from mootdx.utils import get_stock_market
from mootdx.utils import md5sum
from mootdx.utils import to_data
data ... | md5sum('./README.md')) | self.assertIsNotNone | func_call | tests/utils/test_utils.py | test_md5sum_success | TestMd5sum | 32 | null |
mootdx/mootdx | import unittest
from datetime import datetime
import pytest
from mootdx.consts import MARKET_SH
from mootdx.exceptions import MootdxValidationException
from mootdx.logger import logger
from mootdx.quotes import Quotes
class TestStdQuotes(unittest.TestCase):
client = None
def setup_class(self):
self.... | True) | self.assertEqual | bool_literal | tests/quotes/test_quotes_std.py | test_retry_last_value | TestStdQuotes | 98 | null |
mootdx/mootdx | import datetime
import os
import time
import unittest
from datetime import timedelta
from pathlib import Path
import pytest
from mootdx import get_config_path
from mootdx.contrib.adjust import get_adjust_year
from mootdx.utils.adjust import get_xdxr
class TestAdjustUtil(unittest.TestCase):
symbol = '600036'
... | xdxr_time) | self.assertEqual | variable | tests/test_adjust.py | test_get_xdxr | TestAdjustUtil | 58 | null |
mootdx/mootdx | import unittest
from mootdx.reader import ReaderBase
class TestReaderBase(unittest.TestCase):
def test_find_path(self):
reader = ReaderBase('tests/fixtures')
result = reader.find_path(symbol='sh000001', subdir='minline', suffix=['lc1', '1'], debug=True)
assert ('sh', 'sh000001', ['lc1', '... | result | assert | variable | tests/reader/test_reader_base.py | test_find_path | TestReaderBase | 11 | null |
mootdx/mootdx | import pytest
@pytest.mark.skip(reason='暂时不做重复测试')
def test_quotes(quotes):
quotes.close()
assert quotes.xdxr(symbol='600036').empty is | False | assert | bool_literal | tests/test_reconnect.py | test_quotes | 7 | null | |
mootdx/mootdx | import unittest
import pytest
from mootdx.quotes import Quotes
class TestStdQuotes(unittest.TestCase):
client = None
server = ('39.100.68.59', 7709)
def test_server(self):
client = Quotes.factory(market='std', server=self.server, verbose=2, timeout=10) # 标准市场
assert client.server == | self.server | assert | complex_expr | tests/quotes/test_quotes_base.py | test_server | TestStdQuotes | 15 | null |
mootdx/mootdx | import unittest
from unittest import mock
import pytest
from mootdx.consts import MARKET_BJ
from mootdx.consts import MARKET_SH
from mootdx.consts import MARKET_SZ
from mootdx.utils import get_config_path
from mootdx.utils import get_stock_market
from mootdx.utils import md5sum
from mootdx.utils import to_data
data ... | market | assert | variable | tests/utils/test_utils.py | test_stock_market | 24 | null | |
mootdx/mootdx | import unittest
from unittest import mock
import pytest
from mootdx.consts import MARKET_BJ
from mootdx.consts import MARKET_SH
from mootdx.consts import MARKET_SZ
from mootdx.utils import get_config_path
from mootdx.utils import get_stock_market
from mootdx.utils import md5sum
from mootdx.utils import to_data
data ... | to_data(None).empty) | self.assertTrue | func_call | tests/utils/test_utils.py | test_to_data_empty | TestToData | 43 | null |
mootdx/mootdx | import unittest
from unittest import mock
import pytest
from mootdx.consts import MARKET_BJ
from mootdx.consts import MARKET_SH
from mootdx.consts import MARKET_SZ
from mootdx.utils import get_config_path
from mootdx.utils import get_stock_market
from mootdx.utils import md5sum
from mootdx.utils import to_data
data ... | not to_data([{'aa': 'aa'}]).empty) | self.assertTrue | func_call | tests/utils/test_utils.py | test_to_data_list | TestToData | 37 | null |
mootdx/mootdx | import unittest
from datetime import datetime
import pytest
from mootdx.consts import MARKET_SH
from mootdx.exceptions import MootdxValidationException
from mootdx.logger import logger
from mootdx.quotes import Quotes
class TestStdQuotes(unittest.TestCase):
client = None
def setup_class(self):
self.... | data) | self.assertTrue | variable | tests/quotes/test_quotes_std.py | test_F10C | TestStdQuotes | 69 | null |
mootdx/mootdx | import glob
import unittest
from pathlib import Path
import pytest
from mootdx.affair import Affair
from mootdx.logger import logger
class TestAffair(unittest.TestCase):
files = []
downdir = 'tests/fixtures/tmp'
def setup_class(self) -> None:
logger.debug('setup_class: 获取文件列表')
self.fil... | Path(self.downdir, self.files[-1]).exists()) | self.assertTrue | func_call | tests/financial/test_affairs.py | test_fetch_one | TestAffair | 43 | null |
mootdx/mootdx | import os
import pytest
def remove_dep_cli():
os.system('pip uninstall -y click prettytable')
yield
os.system('pip install click prettytable')
def remove_dep_holiday():
os.system('pip uninstall -y py_mini_racer')
yield
os.system('pip install py_mini_racer')
@pytest.mark.skip(reason='暂时不做重复测试... | SystemExit) | pytest.raises | variable | tests/test_useless.py | test_dep_command | 22 | null | |
mootdx/mootdx | import unittest
from unittest import mock
import pytest
from mootdx.consts import MARKET_BJ
from mootdx.consts import MARKET_SH
from mootdx.consts import MARKET_SZ
from mootdx.utils import get_config_path
from mootdx.utils import get_stock_market
from mootdx.utils import md5sum
from mootdx.utils import to_data
data ... | to_data(123).empty) | self.assertTrue | func_call | tests/utils/test_utils.py | test_to_data_empty | TestToData | 47 | null |
mootdx/mootdx | import unittest
from datetime import datetime
import pytest
from mootdx.consts import MARKET_SH
from mootdx.exceptions import MootdxValidationException
from mootdx.logger import logger
from mootdx.quotes import Quotes
class TestStdRaises(unittest.TestCase):
client = None
def setup_class(self):
self.... | '市场代码错误, 目前只支持沪深市场' | assert | string_literal | tests/quotes/test_quotes_std.py | test_stocks_raises | TestStdRaises | 132 | null |
mootdx/mootdx | import unittest
from unittest import mock
import pytest
from mootdx.consts import MARKET_BJ
from mootdx.consts import MARKET_SH
from mootdx.consts import MARKET_SZ
from mootdx.utils import get_config_path
from mootdx.utils import get_stock_market
from mootdx.utils import md5sum
from mootdx.utils import to_data
data ... | md5sum('/ad/sd/sd')) | self.assertIsNone | func_call | tests/utils/test_utils.py | test_md5sum_error | TestMd5sum | 29 | null |
mootdx/mootdx | import glob
import unittest
from pathlib import Path
import pytest
from mootdx.affair import Affair
from mootdx.logger import logger
class TestAffair(unittest.TestCase):
files = []
downdir = 'tests/fixtures/tmp'
def setup_class(self) -> None:
logger.info('获取文件列表')
self.files = [x['filen... | Path(self.downdir, self.files[-1]).exists()) | self.assertTrue | func_call | tests/test_affairs.py | test_fetch_one | TestAffair | 41 | null |
mootdx/mootdx | import datetime
import unittest
from pathlib import Path
from unittest import mock
import freezegun
import pandas as pd
from mootdx.cache import file_cache
NUM_SAMPLES = 10
DUMMY_TIME = datetime.datetime(2012, 1, 1, tzinfo=datetime.timezone.utc)
number_of_times_called = 0
def sample_function() -> pd.DataFrame:
... | expected_df) | assert_* | variable | tests/cache/test_file.py | test_caches_if_not_exists | TestCacheFile | 39 | null |
mootdx/mootdx | import glob
import unittest
from pathlib import Path
import pytest
from mootdx.affair import Affair
from mootdx.logger import logger
class TestAffair(unittest.TestCase):
files = []
downdir = 'tests/fixtures/tmp'
def setup_class(self) -> None:
logger.debug('setup_class: 获取文件列表')
self.fil... | csv_file.exists()) | self.assertTrue | func_call | tests/financial/test_affairs.py | test_parse_export | TestAffair | 39 | null |
mootdx/mootdx | import glob
import unittest
from pathlib import Path
import pytest
from mootdx.affair import Affair
from mootdx.logger import logger
class TestAffair(unittest.TestCase):
files = []
downdir = 'tests/fixtures/tmp'
def setup_class(self) -> None:
logger.debug('setup_class: 获取文件列表')
self.fil... | data) | self.assertIsNone | variable | tests/financial/test_affairs.py | test_parse_err | TestAffair | 29 | null |
mootdx/mootdx | import unittest
from unittest import mock
import pytest
from mootdx.consts import MARKET_BJ
from mootdx.consts import MARKET_SH
from mootdx.consts import MARKET_SZ
from mootdx.utils import get_config_path
from mootdx.utils import get_stock_market
from mootdx.utils import md5sum
from mootdx.utils import to_data
data ... | not to_data({'abc': 123}).empty) | self.assertTrue | func_call | tests/utils/test_utils.py | test_to_data_dict | TestToData | 40 | null |
mootdx/mootdx | import glob
from pathlib import Path
import pytest
from mootdx.logger import logger
from mootdx.tools.customize import Customize
tdxdir = 'tests/fixtures'
def setup_module():
logger.debug('setup_module')
blocknew = Path(tdxdir, 'T0002', 'blocknew')
blocknew.exists() or blocknew.mkdir(parents=True)
def ... | None | assert | none_literal | tests/tools/test_customize.py | test_block_remove | 71 | null | |
mootdx/mootdx | import unittest
from mootdx.reader import Reader
from tests.conftest import is_empty
class TestExReader(unittest.TestCase):
reader = None
def setUp(self):
self.reader = Reader.factory(market='ext', tdxdir='tests/fixtures')
def tearDown(self):
pass
def test_daily(self):
data ... | False | assert | bool_literal | tests/reader/test_reader_ext.py | test_daily | TestExReader | 21 | null |
django-crispy-forms/django-crispy-forms | import pytest
from django import forms
from crispy_forms.bootstrap import AppendedText
from crispy_forms.exceptions import DynamicError
from crispy_forms.helper import FormHelper, FormHelpersException
from crispy_forms.layout import HTML, Div, Field, Fieldset, Layout, MultiField, Pointer
from .forms import SampleForm... | "password1" | assert | string_literal | tests/test_dynamic_api.py | test_wrap_all_fields | 23 | null | |
django-crispy-forms/django-crispy-forms | import re
import django
import pytest
from django import forms
from django.forms.models import formset_factory
from django.middleware.csrf import _get_new_csrf_string
from django.template import Context, Template, TemplateSyntaxError
from django.urls import reverse
from crispy_forms.bootstrap import AppendedText, Fie... | 3 | assert | numeric_literal | tests/test_form_helper.py | test_error_text_inline | 459 | null | |
django-crispy-forms/django-crispy-forms | import django
import pytest
from django import forms
from django.forms.models import formset_factory, modelformset_factory
from django.shortcuts import render
from django.template import Context, Template
from django.test.html import parse_html
from django.test.utils import override_settings
from django.utils.translati... | 1 | assert | numeric_literal | tests/test_layout.py | test_context_pollution | 133 | null | |
django-crispy-forms/django-crispy-forms | import re
import django
import pytest
from django import forms
from django.forms.models import formset_factory
from django.middleware.csrf import _get_new_csrf_string
from django.template import Context, Template, TemplateSyntaxError
from django.urls import reverse
from crispy_forms.bootstrap import AppendedText, Fie... | html | assert | variable | tests/test_form_helper.py | test_inputs | 37 | null | |
django-crispy-forms/django-crispy-forms | from django import forms
from django.template import Context, Template
from django.utils.translation import activate, deactivate
from django.utils.translation import gettext as _
from crispy_forms.bootstrap import (
Accordion,
AccordionGroup,
Alert,
AppendedText,
Container,
InlineCheckboxes,
... | 2 | assert | numeric_literal | tests/test_layout_objects.py | test_multiwidget_field | 62 | null | |
django-crispy-forms/django-crispy-forms | from django import forms
from django.template import Context, Template
from django.utils.translation import activate, deactivate
from django.utils.translation import gettext as _
from crispy_forms.bootstrap import (
Accordion,
AccordionGroup,
Alert,
AppendedText,
Container,
InlineCheckboxes,
... | 0 | assert | numeric_literal | tests/test_layout_objects.py | test_accordion_active_false_not_rendered | TestBootstrapLayoutObjects | 220 | null |
django-crispy-forms/django-crispy-forms | import django
import pytest
from django import forms
from django.conf import settings
from django.template.base import Template
from django.template.context import Context
from django.test import override_settings
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout
from crispy_forms.templ... | [3, 2] | assert | collection | tests/test_utils.py | test_list_difference | 23 | null | |
django-crispy-forms/django-crispy-forms | import django
import pytest
from django import forms
from django.forms.models import formset_factory, modelformset_factory
from django.shortcuts import render
from django.template import Context, Template
from django.test.html import parse_html
from django.test.utils import override_settings
from django.utils.translati... | 6 | assert | numeric_literal | tests/test_layout.py | test_layout_fieldset_row_html_with_unicode_fieldnames | 183 | null | |
django-crispy-forms/django-crispy-forms | import django
import pytest
from django import forms
from django.conf import settings
from django.template.base import Template
from django.template.context import Context
from django.test import override_settings
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout
from crispy_forms.templ... | [3] | assert | collection | tests/test_utils.py | test_list_intersection | 19 | null | |
django-crispy-forms/django-crispy-forms | import pytest
from django import forms
from crispy_forms.bootstrap import AppendedText
from crispy_forms.exceptions import DynamicError
from crispy_forms.helper import FormHelper, FormHelpersException
from crispy_forms.layout import HTML, Div, Field, Fieldset, Layout, MultiField, Pointer
from .forms import SampleForm... | "extra" | assert | string_literal | tests/test_dynamic_api.py | test_formhelper__getitem__ | 353 | null | |
django-crispy-forms/django-crispy-forms | import re
import django
import pytest
from django import forms
from django.forms.models import formset_factory
from django.middleware.csrf import _get_new_csrf_string
from django.template import Context, Template, TemplateSyntaxError
from django.urls import reverse
from crispy_forms.bootstrap import AppendedText, Fie... | 2 | assert | numeric_literal | tests/test_form_helper.py | test_helper_custom_field_template | 422 | null | |
django-crispy-forms/django-crispy-forms | import django
import pytest
from django import forms
from django.conf import settings
from django.template.base import Template
from django.template.context import Context
from django.test import override_settings
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout
from crispy_forms.templ... | 2 | assert | numeric_literal | tests/test_utils.py | test_optgroup_filter_nested | 139 | null | |
django-crispy-forms/django-crispy-forms | import pytest
from django.forms.boundfield import BoundField
from django.forms.formsets import formset_factory
from django.template import Context, Template
from crispy_forms.exceptions import CrispyError
from crispy_forms.templatetags.crispy_forms_field import crispy_addon
from .forms import SampleForm
def test_as_... | html | assert | variable | tests/test_tags.py | test_as_crispy_errors_form_with_non_field_errors | 53 | null | |
django-crispy-forms/django-crispy-forms | import pytest
from django import forms
from crispy_forms.bootstrap import AppendedText
from crispy_forms.exceptions import DynamicError
from crispy_forms.helper import FormHelper, FormHelpersException
from crispy_forms.layout import HTML, Div, Field, Fieldset, Layout, MultiField, Pointer
from .forms import SampleForm... | "replaced" | assert | string_literal | tests/test_dynamic_api.py | test_formhelper__setitem__ | 361 | null | |
django-crispy-forms/django-crispy-forms | import pytest
from django import forms
from crispy_forms.bootstrap import AppendedText
from crispy_forms.exceptions import DynamicError
from crispy_forms.helper import FormHelper, FormHelpersException
from crispy_forms.layout import HTML, Div, Field, Fieldset, Layout, MultiField, Pointer
from .forms import SampleForm... | "email" | assert | string_literal | tests/test_dynamic_api.py | test_wrap_all_fields | 22 | null | |
django-crispy-forms/django-crispy-forms | import pytest
from django import forms
from crispy_forms.bootstrap import AppendedText
from crispy_forms.exceptions import DynamicError
from crispy_forms.helper import FormHelper, FormHelpersException
from crispy_forms.layout import HTML, Div, Field, Fieldset, Layout, MultiField, Pointer
from .forms import SampleForm... | 1 | assert | numeric_literal | tests/test_dynamic_api.py | test_formhelper__delitem__and__len__ | 369 | null | |
django-crispy-forms/django-crispy-forms | import django
import pytest
from django import forms
from django.conf import settings
from django.template.base import Template
from django.template.context import Context
from django.test import override_settings
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout
from crispy_forms.templ... | "" | assert | string_literal | tests/test_utils.py | test_render_field_with_none_field | 28 | null | |
django-crispy-forms/django-crispy-forms | import django
import pytest
from django import forms
from django.conf import settings
from django.template.base import Template
from django.template.context import Context
from django.test import override_settings
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout
from crispy_forms.templ... | 0 | assert | numeric_literal | tests/test_utils.py | test_optgroup_filter_nested | 96 | null | |
django-crispy-forms/django-crispy-forms | import django
import pytest
from django import forms
from django.conf import settings
from django.template.base import Template
from django.template.context import Context
from django.test import override_settings
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout
from crispy_forms.templ... | 1 | assert | numeric_literal | tests/test_utils.py | test_optgroup_filter_nested | 123 | null | |
django-crispy-forms/django-crispy-forms | import django
import pytest
from django import forms
from django.forms.models import formset_factory, modelformset_factory
from django.shortcuts import render
from django.template import Context, Template
from django.test.html import parse_html
from django.test.utils import override_settings
from django.utils.translati... | ["email"] | assert | collection | tests/test_layout.py | test_default_layout_two | 296 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.