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
piccolo-orm/piccolo
from unittest import TestCase from piccolo.apps.migrations.auto import MigrationManager, SchemaSnapshot class TestSchemaSnaphot(TestCase): def test_drop_table(self): """ Test dropping tables. """ manager_1 = MigrationManager() manager_1.add_table(class_name="Manager", tabl...
len(snapshot) == 1)
self.assertTrue
func_call
tests/apps/migrations/auto/test_schema_snapshot.py
test_drop_table
TestSchemaSnaphot
40
null
piccolo-orm/piccolo
from __future__ import annotations import sys from typing import TYPE_CHECKING from unittest import TestCase from unittest.mock import MagicMock, call, patch from piccolo.apps.migrations.commands.backwards import backwards from piccolo.apps.migrations.commands.forwards import forwards from piccolo.apps.migrations.tab...
0)
self.assertNotEqual
numeric_literal
tests/apps/migrations/commands/test_forwards_backwards.py
test_forwards_backwards_all_migrations
TestForwardsBackwards
59
null
piccolo-orm/piccolo
from unittest import TestCase from unittest.mock import MagicMock, patch from piccolo.columns.column_types import ( JSON, JSONB, Array, Email, ForeignKey, Secret, Varchar, ) from piccolo.table import TABLENAME_WARNING, Table from tests.example_apps.music.tables import Band class TestMetaCl...
hasattr(TableA, "id"))
self.assertTrue
func_call
tests/table/test_metaclass.py
test_id_column
TestMetaClass
159
null
piccolo-orm/piccolo
import sys import pytest from piccolo.engine import engine_finder from piccolo.testing.test_case import ( AsyncTableTest, AsyncTransactionTest, TableTest, ) from tests.example_apps.music.tables import Band, Manager class TestAsyncTransaction(AsyncTransactionTest): async def test_transaction_exists(s...
db.transaction_exists())
self.assertTrue
func_call
tests/testing/test_test_case.py
test_transaction_exists
TestAsyncTransaction
47
null
piccolo-orm/piccolo
from unittest import TestCase from piccolo.apps.migrations.auto.diffable_table import ( DiffableTable, compare_dicts, ) from piccolo.columns import OnDelete, Varchar class TestCompareDicts(TestCase): def test_dict_value(self): """ Make sure dictionary values work correctly. """ ...
{})
self.assertEqual
collection
tests/apps/migrations/auto/test_diffable_table.py
test_dict_value
TestCompareDicts
46
null
piccolo-orm/piccolo
import asyncio import math from unittest import TestCase from piccolo.columns import Varchar from piccolo.engine.finder import engine_finder from piccolo.engine.postgres import AsyncBatch, PostgresEngine from piccolo.table import Table from piccolo.utils.sync import run_sync from tests.base import AsyncMock, DBTestCas...
dict)
self.assertEqual
variable
tests/table/test_batch.py
_check_results
TestBatchSelect
22
null
piccolo-orm/piccolo
import decimal from typing import Optional, cast from unittest import TestCase import pydantic import pydantic_core import pytest from pydantic import ValidationError from piccolo.columns import ( JSON, JSONB, UUID, Array, Email, Integer, Numeric, Secret, Text, Time, Timest...
dict)
self.assertIsInstance
variable
tests/utils/test_pydantic.py
test_all
TestExcludeColumns
463
null
piccolo-orm/piccolo
import asyncio import random from io import StringIO from typing import Optional from unittest import IsolatedAsyncioTestCase, TestCase from unittest.mock import MagicMock, patch from piccolo.apps.migrations.auto.migration_manager import MigrationManager from piccolo.apps.migrations.commands.base import BaseMigrationM...
False
assert
bool_literal
tests/apps/migrations/auto/test_migration_manager.py
run
TestWrapInTransaction
1,129
null
piccolo-orm/piccolo
from unittest import TestCase from piccolo.columns import Varchar from piccolo.table import Table from piccolo.table_reflection import TableStorage from piccolo.utils.sync import run_sync from tests.base import engines_only from tests.example_apps.music.tables import Band, Manager class TestTableStorage(TestCase): ...
col_2._meta.null)
self.assertEqual
complex_expr
tests/utils/test_table_reflection.py
_compare_table_columns
TestTableStorage
41
null
piccolo-orm/piccolo
import json from unittest import TestCase from piccolo.table import create_db_tables_sync, drop_db_tables_sync from tests.base import DBTestCase from tests.example_apps.music.tables import Band, Instrument, RecordingStudio class TestOutputList(DBTestCase): def test_output_as_list(self): self.insert_row() ...
["Pythonistas"])
self.assertEqual
collection
tests/table/test_output.py
test_output_as_list
TestOutputList
14
null
piccolo-orm/piccolo
import decimal import uuid import warnings from enum import Enum from unittest import TestCase import pytest from piccolo.apps.migrations.auto.serialisation import ( CanConflictWithGlobalNames, Import, UniqueGlobalNameConflictWarning, UniqueGlobalNames, UniqueGlobalNamesMeta, serialise_params,...
[])
self.assertEqual
collection
tests/apps/migrations/auto/test_serialisation.py
test_custom_enum_instance
TestSerialiseParams
346
null
piccolo-orm/piccolo
import asyncio import random from io import StringIO from typing import Optional from unittest import IsolatedAsyncioTestCase, TestCase from unittest.mock import MagicMock, patch from piccolo.apps.migrations.auto.migration_manager import MigrationManager from piccolo.apps.migrations.commands.base import BaseMigrationM...
OnDelete.no_action)
self.assertEqual
complex_expr
tests/apps/migrations/auto/test_migration_manager.py
test_alter_fk_on_delete_on_update
TestMigrationManager
624
null
piccolo-orm/piccolo
import dataclasses import datetime from typing import Any from unittest import TestCase import pytest from piccolo.columns.base import Column from piccolo.columns.column_types import ( Date, Integer, Interval, Text, Timestamp, Timestamptz, Varchar, ) from piccolo.querystring import QuerySt...
datetime.datetime)
self.assertIsInstance
complex_expr
tests/table/test_update.py
test_update
TestAutoUpdate
654
null
piccolo-orm/piccolo
from typing import cast from piccolo.testing.test_case import TableTest from tests.base import DBTestCase from tests.example_apps.music.tables import ( Band, Concert, Manager, RecordingStudio, Venue, ) class TestRefresh(DBTestCase): def setUp(self): super().setUp() self.insert_...
"Guido!!!")
self.assertEqual
string_literal
tests/table/test_refresh.py
test_refresh_with_prefetch
TestRefresh
61
null
piccolo-orm/piccolo
import enum from piccolo.columns.column_types import Array, Varchar from piccolo.table import Table from piccolo.testing.test_case import TableTest from tests.example_apps.music.tables import Shirt class TestChoices(TableTest): tables = [Shirt] def _insert_shirts(self): Shirt.insert( Shir...
None
assert
none_literal
tests/columns/test_choices.py
test_default
TestChoices
32
null
piccolo-orm/piccolo
from __future__ import annotations from unittest import TestCase from unittest.mock import MagicMock, call, patch from piccolo.apps.migrations.auto.schema_differ import ( DiffableTable, RenameColumn, RenameColumnCollection, RenameTable, RenameTableCollection, SchemaDiffer, ) from piccolo.colum...
[rename_column])
self.assertListEqual
collection
tests/apps/migrations/auto/test_schema_differ.py
test_for_table_class_name
TestRenameColumnCollection
536
null
piccolo-orm/piccolo
import decimal import uuid import warnings from enum import Enum from unittest import TestCase import pytest from piccolo.apps.migrations.auto.serialisation import ( CanConflictWithGlobalNames, Import, UniqueGlobalNameConflictWarning, UniqueGlobalNames, UniqueGlobalNamesMeta, serialise_params,...
"TimeNow()")
self.assertEqual
string_literal
tests/apps/migrations/auto/test_serialisation.py
test_time
TestSerialiseParams
176
null
piccolo-orm/piccolo
import asyncio import random from io import StringIO from typing import Optional from unittest import IsolatedAsyncioTestCase, TestCase from unittest.mock import MagicMock, patch from piccolo.apps.migrations.auto.migration_manager import MigrationManager from piccolo.apps.migrations.commands.base import BaseMigrationM...
[Band])
self.assertListEqual
collection
tests/apps/migrations/auto/test_migration_manager.py
test_single_table
TestSortTableClasses
69
null
piccolo-orm/piccolo
import asyncio import random from io import StringIO from typing import Optional from unittest import IsolatedAsyncioTestCase, TestCase from unittest.mock import MagicMock, patch from piccolo.apps.migrations.auto.migration_manager import MigrationManager from piccolo.apps.migrations.commands.base import BaseMigrationM...
True
assert
bool_literal
tests/apps/migrations/auto/test_migration_manager.py
run
TestWrapInTransaction
1,113
null
piccolo-orm/piccolo
from __future__ import annotations import ast import asyncio from typing import cast from unittest import TestCase from unittest.mock import MagicMock, patch from piccolo.apps.schema.commands.exceptions import GenerateError from piccolo.apps.schema.commands.generate import ( OutputSchema, generate, get_ou...
col_2.length)
self.assertEqual
complex_expr
tests/apps/schema/commands/test_generate.py
_compare_table_columns
TestGenerate
62
null
piccolo-orm/piccolo
import asyncio import enum import json import unittest from piccolo.columns import ( Array, Decimal, ForeignKey, Integer, LazyTableReference, Numeric, Real, Timestamp, Timestamptz, Varchar, ) from piccolo.table import Table, create_db_tables_sync, drop_db_tables_sync from piccol...
dict)
self.assertIsInstance
variable
tests/testing/test_model_builder.py
test_json
TestModelBuilder
229
null
piccolo-orm/piccolo
from __future__ import annotations from typing import Any, Union from unittest import TestCase import pytest from piccolo.columns import BigInt, Integer, Numeric, Varchar from piccolo.columns.base import Column from piccolo.columns.column_types import ForeignKey, Text from piccolo.schema import SchemaManager from pi...
[])
self.assertEqual
collection
tests/table/test_alter.py
test_rename
TestRenameTable
78
null
piccolo-orm/piccolo
import string from unittest import TestCase from piccolo.utils.list import batch, flatten class TestFlatten(TestCase): def test_flatten(self): self.assertListEqual(flatten(["a", ["b", "c"]]),
["a", "b", "c"])
self.assertListEqual
collection
tests/utils/test_list.py
test_flatten
TestFlatten
9
null
piccolo-orm/piccolo
from unittest import TestCase from piccolo.apps.migrations.auto.diffable_table import ( DiffableTable, compare_dicts, ) from piccolo.columns import OnDelete, Varchar class TestCompareDicts(TestCase): def test_dict_value(self): """ Make sure dictionary values work correctly. """ ...
{"b": {"x": 1}})
self.assertEqual
collection
tests/apps/migrations/auto/test_diffable_table.py
test_dict_value
TestCompareDicts
51
null
piccolo-orm/piccolo
from typing import cast from piccolo.testing.test_case import TableTest from tests.base import DBTestCase from tests.example_apps.music.tables import ( Band, Concert, Manager, RecordingStudio, Venue, ) class TestRefreshWithPrefetch(TableTest): tables = [Manager, Band, Concert, Venue] def...
band.manager)
self.assertIsNone
complex_expr
tests/table/test_refresh.py
test_foreign_key_set_to_null
TestRefreshWithPrefetch
246
null
piccolo-orm/piccolo
from unittest import TestCase from unittest.mock import AsyncMock, MagicMock, patch from piccolo.apps.user.commands.list import list_users from piccolo.apps.user.tables import BaseUser from piccolo.utils.sync import run_sync class TestList(TestCase): def setUp(self): BaseUser.create_table(if_not_exists=Tr...
output
assert
variable
tests/apps/user/commands/test_list.py
test_list
TestList
30
null
piccolo-orm/piccolo
from unittest import TestCase from piccolo.apps.migrations.auto import MigrationManager, SchemaSnapshot class TestSchemaSnaphot(TestCase): def test_add_column(self): """ Test adding columns. """ manager = MigrationManager() manager.add_table(class_name="Manager", tablename...
len(snapshot[0].columns) == 1)
self.assertTrue
func_call
tests/apps/migrations/auto/test_schema_snapshot.py
test_add_column
TestSchemaSnaphot
84
null
piccolo-orm/piccolo
import json from unittest import TestCase from piccolo.table import create_db_tables_sync, drop_db_tables_sync from tests.base import DBTestCase from tests.example_apps.music.tables import Band, Instrument, RecordingStudio class TestOutputList(DBTestCase): def test_output_as_list(self): self.insert_row() ...
[])
self.assertEqual
collection
tests/table/test_output.py
test_output_as_list
TestOutputList
23
null
piccolo-orm/piccolo
import decimal import uuid import warnings from enum import Enum from unittest import TestCase import pytest from piccolo.apps.migrations.auto.serialisation import ( CanConflictWithGlobalNames, Import, UniqueGlobalNameConflictWarning, UniqueGlobalNames, UniqueGlobalNamesMeta, serialise_params,...
True
assert
bool_literal
tests/apps/migrations/auto/test_serialisation.py
test_is_conflicting_name
TestUniqueGlobals
83
null
piccolo-orm/piccolo
from __future__ import annotations from typing import Optional from unittest import IsolatedAsyncioTestCase, TestCase from piccolo.engine import Engine, engine_finder from piccolo.engine.cockroach import CockroachTransaction from piccolo.table import ( Table, create_db_tables, create_db_tables_sync, d...
None
assert
none_literal
piccolo/testing/test_case.py
asyncSetUp
AsyncTransactionTest
114
null
piccolo-orm/piccolo
from unittest import TestCase from piccolo.apps.migrations.auto.diffable_table import ( DiffableTable, compare_dicts, ) from piccolo.columns import OnDelete, Varchar class TestCompareDicts(TestCase): def test_none_values(self): """ Make sure there are no edge cases when using None values....
{"b": 1})
self.assertEqual
collection
tests/apps/migrations/auto/test_diffable_table.py
test_none_values
TestCompareDicts
60
null
piccolo-orm/piccolo
import datetime import decimal import uuid from unittest import TestCase from piccolo.apps.fixtures.commands.shared import ( FixtureConfig, create_pydantic_fixture_model, ) class TestShared(TestCase): def test_shared(self): pydantic_model = create_pydantic_fixture_model( fixture_config...
1)
self.assertEqual
numeric_literal
tests/apps/fixtures/commands/test_shared.py
test_shared
TestShared
59
null
piccolo-orm/piccolo
import asyncio from tests.base import DBTestCase from tests.example_apps.music.tables import Band class TestAwait(DBTestCase): def test_await(self): """ Test awaiting a query directly - it should proxy to Query.run(). """ async def get_all(): return await Band.select()...
list)
self.assertIsInstance
variable
tests/query/test_await.py
test_await
TestAwait
18
null
piccolo-orm/piccolo
import decimal from typing import Optional, cast from unittest import TestCase import pydantic import pydantic_core import pytest from pydantic import ValidationError from piccolo.columns import ( JSON, JSONB, UUID, Array, Email, Integer, Numeric, Secret, Text, Time, Timest...
"id")
self.assertEqual
string_literal
tests/utils/test_pydantic.py
test_target_column
TestForeignKeyColumn
189
null
piccolo-orm/piccolo
import os import shutil import tempfile from unittest import TestCase from piccolo.apps.app.commands.new import ( get_app_module, module_exists, new, validate_app_name, ) class TestModuleExists(TestCase): def test_module_exists(self): self.assertEqual(module_exists("sys"),
True)
self.assertEqual
bool_literal
tests/apps/app/commands/test_new.py
test_module_exists
TestModuleExists
16
null
piccolo-orm/piccolo
import asyncio import random from io import StringIO from typing import Optional from unittest import IsolatedAsyncioTestCase, TestCase from unittest.mock import MagicMock, patch from piccolo.apps.migrations.auto.migration_manager import MigrationManager from piccolo.apps.migrations.commands.base import BaseMigrationM...
[Manager, Band])
self.assertListEqual
collection
tests/apps/migrations/auto/test_migration_manager.py
test_sort_table_classes
TestSortTableClasses
30
null
piccolo-orm/piccolo
from piccolo.columns.column_types import Integer, Varchar from piccolo.table import Table from piccolo.testing.test_case import TableTest class TestReservedColumnNames(TableTest): tables = [Concert] def test_common_operations(self): # Save / Insert concert = Concert(name="Royal Albert Hall", ...
[{"order": 1}])
self.assertEqual
collection
tests/columns/test_reserved_column_names.py
test_common_operations
TestReservedColumnNames
30
null
piccolo-orm/piccolo
from unittest import TestCase from unittest.mock import MagicMock, patch from piccolo.columns.column_types import ( JSON, JSONB, Array, Email, ForeignKey, Secret, Varchar, ) from piccolo.table import TABLENAME_WARNING, Table from tests.example_apps.music.tables import Band class TestMetaCl...
"band")
self.assertEqual
string_literal
tests/table/test_metaclass.py
test_tablename
TestMetaClass
19
null
piccolo-orm/piccolo
from typing import Any from piccolo.columns.column_types import Boolean from piccolo.table import Table from piccolo.testing.test_case import TableTest class TestBoolean(TableTest): tables = [MyTable] def test_return_type(self) -> None: for value in (True, False, None, ...): kwargs: dict[...
None
assert
none_literal
tests/columns/test_boolean.py
test_return_type
TestBoolean
33
null
piccolo-orm/piccolo
from enum import Enum from unittest import TestCase from piccolo.columns.choices import Choice from piccolo.columns.column_types import Integer, Varchar from piccolo.table import Table from tests.example_apps.music.tables import Band, Manager class TestSecretParameter(TestCase): def test_secret_parameter(self): ...
secret)
self.assertEqual
variable
tests/columns/test_base.py
test_secret_parameter
TestSecretParameter
45
null
piccolo-orm/piccolo
from __future__ import annotations import asyncio import sys from typing import Optional from unittest import TestCase from unittest.mock import MagicMock import pytest from piccolo.apps.schema.commands.generate import RowMeta from piccolo.engine.cockroach import CockroachEngine from piccolo.engine.finder import eng...
None
assert
none_literal
tests/base.py
create_tables
DBTestCase
236
null
piccolo-orm/piccolo
import datetime from decimal import Decimal from unittest import TestCase from piccolo.columns.column_types import ( Array, BigInt, Date, Integer, Numeric, Time, Timestamp, Timestamptz, ) from piccolo.querystring import QueryString from piccolo.table import Table from piccolo.testing.te...
3)
self.assertEqual
numeric_literal
tests/columns/test_array.py
test_get_dimensions
TestGetDimensions
440
null
piccolo-orm/piccolo
from enum import Enum from unittest import TestCase from piccolo.columns.choices import Choice from piccolo.columns.column_types import Integer, Varchar from piccolo.table import Table from tests.example_apps.music.tables import Band, Manager class TestCopy(TestCase): def test_copy(self): """ Try ...
id(new_column._meta))
self.assertNotEqual
func_call
tests/columns/test_base.py
test_copy
TestCopy
22
null
piccolo-orm/piccolo
import asyncio import enum import json import unittest from piccolo.columns import ( Array, Decimal, ForeignKey, Integer, LazyTableReference, Numeric, Real, Timestamp, Timestamptz, Varchar, ) from piccolo.table import Table, create_db_tables_sync, drop_db_tables_sync from piccol...
model.manager)
self.assertIsNone
complex_expr
tests/testing/test_model_builder.py
test_recursive_foreign_key
TestModelBuilder
161
null
piccolo-orm/piccolo
import decimal from typing import Optional, cast from unittest import TestCase import pydantic import pydantic_core import pytest from pydantic import ValidationError from piccolo.columns import ( JSON, JSONB, UUID, Array, Email, Integer, Numeric, Secret, Text, Time, Timest...
{})
self.assertEqual
collection
tests/utils/test_pydantic.py
test_exclude_all_manually
TestExcludeColumns
490
null
piccolo-orm/piccolo
from unittest.mock import Mock from tests.base import AsyncMock, DBTestCase from tests.example_apps.music.tables import Band def identity(x): """Returns the input. Used as the side effect for mock callbacks.""" return x def get_name(results): return results["name"] async def uppercase(name): """Asyn...
"PYTHON")
self.assertEqual
string_literal
tests/table/test_callback.py
test_transform
TestCallbackTransformDataSelect
201
null
piccolo-orm/piccolo
import time from enum import Enum from unittest import TestCase import pytest from piccolo.columns.column_types import JSON, JSONB, Array, Integer, Varchar from piccolo.table import Table from piccolo.utils.sql_values import convert_to_sql_value class TestConvertToSQLValue(TestCase): def test_convert_enum(self)...
"r")
self.assertEqual
string_literal
tests/utils/test_sql_values.py
test_convert_enum
TestConvertToSQLValue
56
null
piccolo-orm/piccolo
from unittest import TestCase from piccolo.columns import Varchar from piccolo.table import Table from piccolo.table_reflection import TableStorage from piccolo.utils.sync import run_sync from tests.base import engines_only from tests.example_apps.music.tables import Band, Manager class TestTableStorage(TestCase): ...
col_2.length)
self.assertEqual
complex_expr
tests/utils/test_table_reflection.py
_compare_table_columns
TestTableStorage
45
null
piccolo-orm/piccolo
from unittest import TestCase from piccolo.columns import Varchar from piccolo.table import Table from piccolo.table_reflection import TableStorage from piccolo.utils.sync import run_sync from tests.base import engines_only from tests.example_apps.music.tables import Band, Manager class TestTableStorage(TestCase): ...
type(col_2))
self.assertEqual
func_call
tests/utils/test_table_reflection.py
_compare_table_columns
TestTableStorage
38
null
piccolo-orm/piccolo
from unittest import TestCase from piccolo.schema import SchemaManager from piccolo.table import Table from tests.base import engines_skip class TestListTables(TestCase): def setUp(self): Band.create_table().run_sync() def tearDown(self): Band.alter().drop_table().run_sync() def test_lis...
None
assert
none_literal
tests/test_schema.py
test_list_tables
TestListTables
26
null
piccolo-orm/piccolo
import sys import pytest from piccolo.engine import engine_finder from piccolo.testing.test_case import ( AsyncTableTest, AsyncTransactionTest, TableTest, ) from tests.example_apps.music.tables import Band, Manager class TestAsyncTableTest(AsyncTableTest): tables = [Band, Manager] async def tes...
await Manager.table_exists())
self.assertTrue
func_call
tests/testing/test_test_case.py
test_tables_created
TestAsyncTableTest
35
null
piccolo-orm/piccolo
import asyncio import datetime import decimal import uuid from unittest import TestCase from piccolo.utils.encoding import JSONDict from tests.base import engines_skip from piccolo.columns.column_types import ( JSON, JSONB, UUID, Array, BigInt, Boolean, Bytea, Date, DoublePrecision...
value)
self.assertAlmostEqual
variable
tests/columns/m2m/test_m2m.py
test_select_all
TestM2MComplexSchema
352
null
piccolo-orm/piccolo
import asyncio import random from io import StringIO from typing import Optional from unittest import IsolatedAsyncioTestCase, TestCase from unittest.mock import MagicMock, patch from piccolo.apps.migrations.auto.migration_manager import MigrationManager from piccolo.apps.migrations.commands.base import BaseMigrationM...
tables)
self.assertListEqual
variable
tests/apps/migrations/auto/test_migration_manager.py
test_long_chain
TestSortTableClasses
115
null
piccolo-orm/piccolo
import datetime from decimal import Decimal from unittest import TestCase from piccolo.columns.column_types import ( Array, BigInt, Date, Integer, Numeric, Time, Timestamp, Timestamptz, ) from piccolo.querystring import QueryString from piccolo.table import Table from piccolo.testing.te...
2)
self.assertEqual
numeric_literal
tests/columns/test_array.py
test_get_dimensions
TestGetDimensions
439
null
piccolo-orm/piccolo
from typing import TYPE_CHECKING, Any, Optional from typing_extensions import assert_type from piccolo.columns import ForeignKey, Varchar from piccolo.testing.model_builder import ModelBuilder from piccolo.utils.sync import run_sync from .example_apps.music.tables import Band, Concert, Manager async def select_...
list)
assert_*
variable
tests/type_checking.py
select_list
79
null
piccolo-orm/piccolo
from unittest import TestCase from piccolo.apps.migrations.auto.diffable_table import ( DiffableTable, compare_dicts, ) from piccolo.columns import OnDelete, Varchar class TestDiffableTable(TestCase): def test_subtract(self): kwargs = {"class_name": "Manager", "tablename": "manager"} name...
{"unique": True})
self.assertEqual
collection
tests/apps/migrations/auto/test_diffable_table.py
test_subtract
TestDiffableTable
104
null
piccolo-orm/piccolo
import time # For time travel queries. from piccolo.query.mixins import ColumnsDelegate from tests.base import DBTestCase, engines_only from tests.example_apps.music.tables import Band class TestColumnsDelegate(DBTestCase): def test_list_unpacking(self): """ The ``ColumnsDelegate`` should unpack ...
[Band.name])
self.assertEqual
collection
tests/query/mixins/test_columns_delegate.py
test_list_unpacking
TestColumnsDelegate
24
null
piccolo-orm/piccolo
import datetime from unittest import TestCase from piccolo.columns import Boolean, Timestamp, Varchar from piccolo.table import Table class TestInheritance(TestCase): def setUp(self): Manager.create_table().run_sync() def tearDown(self): Manager.alter().drop_table().run_sync() def test_...
name)
self.assertEqual
variable
tests/table/test_inheritance.py
test_inheritance
TestInheritance
66
null
piccolo-orm/piccolo
from __future__ import annotations from typing import Any, Union from unittest import TestCase import pytest from piccolo.columns import BigInt, Integer, Numeric, Varchar from piccolo.columns.base import Column from piccolo.columns.column_types import ForeignKey, Text from piccolo.schema import SchemaManager from pi...
"1000")
self.assertEqual
string_literal
tests/table/test_alter.py
test_integer_to_varchar
TestSetColumnType
256
null
unionai-oss/pandera
import sys from unittest import mock import pandas as pd import pytest def test_dask_not_installed() -> None: """ Test that Pandera and its modules can be imported and continue to work without dask. """ with mock.patch.dict("sys.modules", {"dask": None}): with pytest.raises(ImportError): ...
sys.modules
assert
complex_expr
tests/dask/test_dask_not_installed.py
test_dask_not_installed
29
null
unionai-oss/pandera
import polars as pl import pytest import pandera.polars as pa from pandera.api.base.error_handler import ErrorCategory from pandera.api.polars.utils import get_lazyframe_schema from pandera.config import ( CONFIG, ValidationDepth, config_context, get_config_context, get_config_global, reset_con...
pl.Int64
assert
complex_expr
tests/polars/test_polars_config.py
test_coerce_validation_depth_none
180
null
unionai-oss/pandera
import ibis import ibis.expr.datatypes as dt import pytest from hypothesis import given, settings from hypothesis import strategies as st from ibis import _ from polars.testing import assert_frame_equal from polars.testing.parametric import dataframes import pandera.ibis as pa from pandera.engines import ibis_engine a...
coerced.to_polars())
assert_*
func_call
tests/ibis/test_ibis_dtypes.py
test_coerce_no_cast
58
null
unionai-oss/pandera
from contextlib import nullcontext as does_not_raise from typing import Optional import pyspark.sql.types as T import pytest from pyspark.sql import DataFrame import pandera import pandera.api.extensions as pax import pandera.pyspark as pa from pandera.api.pyspark.model import docstring_substitution from pandera.conf...
df_out.pandera.errors
assert
complex_expr
tests/pyspark/test_pyspark_model.py
test_dataframe_schema_unique_wrong_column
340
null
unionai-oss/pandera
import copy import pandas as pd import pytest from pandera.backends.pandas import error_formatters from pandera.pandas import ( Bool, Check, Column, DataFrameSchema, Float, Index, Int, SeriesSchema, String, errors, ) def test_check_groupby() -> None: """Tests uses of group...
errors.SchemaError)
pytest.raises
complex_expr
tests/pandas/test_checks.py
test_check_groupby
98
null
unionai-oss/pandera
import platform import tempfile from io import StringIO from pathlib import Path from unittest import mock import pandas as pd import pytest from packaging import version import pandera import pandera.api.extensions as pa_ext import pandera.typing as pat from pandera.api.pandas.container import DataFrameSchema from p...
schema
assert
variable
tests/io/test_pandas_io.py
test_serialize_deserialize_custom_datetime_checks
1,614
null
unionai-oss/pandera
import multiprocessing import pickle from typing import NoReturn, cast import numpy as np import pandas as pd import pytest from pandera.config import ValidationDepth, config_context from pandera.engines import numpy_engine, pandas_engine from pandera.errors import ( ParserError, ReducedPickleExceptionBase, ...
str(exc)
assert
func_call
tests/pandas/test_errors.py
_validate_error
TestSchemaError
186
null
unionai-oss/pandera
from contextlib import nullcontext as does_not_raise from typing import Optional import pyspark.sql.types as T import pytest from pyspark.sql import DataFrame import pandera import pandera.api.extensions as pax import pandera.pyspark as pa from pandera.api.pyspark.model import docstring_substitution from pandera.conf...
Model.to_schema()
assert
func_call
tests/pyspark/test_pyspark_model.py
test_schema_with_bare_types
49
null
unionai-oss/pandera
import ibis import ibis.expr.datatypes as dt import pytest from hypothesis import given, settings from hypothesis import strategies as st from ibis import _ from polars.testing import assert_frame_equal from polars.testing.parametric import dataframes import pandera.ibis as pa from pandera.engines import ibis_engine a...
to_dtype.type
assert
complex_expr
tests/ibis/test_ibis_dtypes.py
test_coerce_cast
77
null
unionai-oss/pandera
import platform import tempfile from io import StringIO from pathlib import Path from unittest import mock import pandas as pd import pytest from packaging import version import pandera import pandera.api.extensions as pa_ext import pandera.typing as pat from pandera.api.pandas.container import DataFrameSchema from p...
0
assert
numeric_literal
tests/io/test_pandas_io.py
test_enum_isin_json_serialization
2,108
null
unionai-oss/pandera
import datetime import operator import re from collections.abc import Callable from typing import Any, Optional from unittest.mock import MagicMock from warnings import catch_warnings import numpy as np import pandas as pd import pytest import pandera.pandas as pa from pandera.api.checks import Check from pandera.api...
data_type.tz
assert
complex_expr
tests/strategies/test_strategies.py
test_field_element_strategy
708
null
unionai-oss/pandera
import asyncio import pickle import typing from contextlib import nullcontext from copy import deepcopy import numpy as np import pandas as pd import pytest from pandera.engines.pandas_engine import Engine from pandera.pandas import ( Check, Column, DataFrameModel, DataFrameSchema, DateTime, F...
"foo"
assert
string_literal
tests/pandas/test_decorators.py
test_check_function_decorators
136
null
unionai-oss/pandera
import importlib import os import re import subprocess import sys from pathlib import Path import pytest import pandera.pandas as pa from tests.mypy.pandas_modules import pandas_dataframe test_module_dir = Path(os.path.dirname(__file__)) def _get_mypy_errors( module_name: str, stdout, ) -> list[dict[str, st...
(0, 1)
assert
collection
tests/mypy/test_pandas_static_type_checking.py
test_pandas_stubs_false_positives
226
null
unionai-oss/pandera
import platform from contextlib import nullcontext as does_not_raise from datetime import date, datetime from decimal import Decimal import pyspark.sql.types as T import pytest from pyspark.sql import DataFrame, Row import pandera.errors import pandera.pyspark as pa from pandera.config import PanderaConfig, Validatio...
expected
assert
variable
tests/pyspark/test_pyspark_container.py
test_pyspark_column_metadata
134
null
unionai-oss/pandera
import datetime import decimal from collections.abc import Sequence from decimal import Decimal from typing import Union import polars as pl import pytest from hypothesis import given, settings from hypothesis import strategies as st from polars.testing import assert_frame_equal from polars.testing.parametric import d...
pl.Decimal
assert
complex_expr
tests/polars/test_polars_dtypes.py
test_coerce_cast_special
180
null
unionai-oss/pandera
import pyspark.sql.types as T import pytest from pyspark.sql.types import StringType import pandera.pyspark as pa from pandera.api.base import error_handler from pandera.errors import SchemaError, SchemaErrorReason from pandera.pyspark import Column, DataFrameModel, DataFrameSchema, Field from tests.pyspark.conftest i...
expected["SCHEMA"]
assert
complex_expr
tests/pyspark/test_pyspark_error.py
test_pyspark_schema_data_checks
169
null
unionai-oss/pandera
from typing import Union from unittest.mock import patch import pandas as pd import pytest import pandera.api.pandas.container import pandera.pandas as pa from pandera.errors import BackendNotFoundError @pytest.mark.parametrize( "schema1, schema2, data, invalid_data", [ [ pa.DataFrameSche...
schema1
assert
variable
tests/pandas/test_pandas_accessor.py
test_dataframe_series_add_schema
47
null
unionai-oss/pandera
import copy import numpy as np import pandas as pd import pytest from pandas._testing import assert_frame_equal import pandera.pandas as pa from pandera.api.pandas.array import SeriesSchema from pandera.api.pandas.container import DataFrameSchema from pandera.api.parsers import Parser from pandera.typing import Serie...
1
assert
numeric_literal
tests/pandas/test_parsers.py
test_parser_called_once
115
null
unionai-oss/pandera
from collections.abc import Iterable from datetime import date, datetime from decimal import Decimal from typing import Any, cast import numpy as np import pandas as pd import pytest from pandas.testing import assert_series_equal import pandera.pandas as pa from pandera.engines import pandas_engine from pandera.error...
bool
assert
variable
tests/pandas/test_logical_dtypes.py
test_decimal_scale_zero_missing_violation
245
null
unionai-oss/pandera
import importlib import os import re import subprocess import sys from pathlib import Path import pytest import pandera.pandas as pa from tests.mypy.pandas_modules import pandas_dataframe test_module_dir = Path(os.path.dirname(__file__)) def _get_mypy_errors( module_name: str, stdout, ) -> list[dict[str, st...
expected["errcode"]
assert
complex_expr
tests/mypy/test_pandas_static_type_checking.py
test_mypy_pandas_dataframe
84
null
unionai-oss/pandera
import os import re import runpy from collections.abc import Iterable from copy import deepcopy from enum import Enum from typing import Any, Generic, Optional, TypeVar import numpy as np import pandas as pd import pytest from pandas._testing import assert_frame_equal import pandera.api.extensions as pax import pande...
4
assert
numeric_literal
tests/pandas/test_model.py
test_inherit_alias
1,455
null
unionai-oss/pandera
import io import sys from unittest.mock import MagicMock, patch import ibis import pytest import pandera.ibis as pa from pandera.typing.formats import Formats from pandera.typing.ibis import Table, ibis_version class TestTable: def test_to_format_callable(self): """Test to_format with a callable.""" ...
t)
assert_*
variable
tests/ibis/test_ibis_typing.py
test_to_format_callable
TestTable
313
null
unionai-oss/pandera
import sys from datetime import datetime from typing import Optional import polars as pl import pytest from hypothesis import given from hypothesis import strategies as st from polars.testing.parametric import column, dataframes import pandera.engines.polars_engine as pe from pandera.errors import SchemaError from pa...
schema
assert
variable
tests/polars/test_polars_model.py
test_model_schema_equivalency_with_optional
138
null
unionai-oss/pandera
from typing import Optional import ibis.expr.datatypes as dt import pytest from pandera.ibis import Column, DataFrameModel, DataFrameSchema def t_model_basic(): class BasicModel(DataFrameModel): string_col: str int_col: int return BasicModel def t_schema_basic(): return DataFrameSchema(...
schema
assert
variable
tests/ibis/test_ibis_model.py
test_model_schema_equivalency_with_optional
51
null
unionai-oss/pandera
import pandas as pd import pytest from pandera import ( Column, DataFrameSchema, Float, Hypothesis, Int, String, errors, ) pytestmark = pytest.mark.skipif( not SCIPY_INSTALLED, reason='needs "hypotheses" module dependencies' ) def test_hypothesis(): """Tests the different API call...
errors.SchemaError)
pytest.raises
complex_expr
tests/hypotheses/test_hypotheses.py
test_hypothesis
240
null
unionai-oss/pandera
import numpy as np import pandas as pd import pytest import pandera.pandas as pa import pandera.schema_statistics.pandas as schema_statistics from pandera import dtypes from pandera.engines import pandas_engine DEFAULT_FLOAT = pandas_engine.Engine.dtype(float) DEFAULT_INT = pandas_engine.Engine.dtype(int) NUMERIC_TY...
name
assert
variable
tests/pandas/test_schema_statistics.py
test_infer_dataframe_statistics
108
null
unionai-oss/pandera
import re import typing from unittest.mock import MagicMock import numpy as np import pandas as pd import pyspark import pyspark.pandas as ps import pytest from packaging import version import pandera.pandas as pa from pandera import dtypes, extensions, system from pandera.engines import numpy_engine, pandas_engine f...
{"col1"}
assert
collection
tests/pyspark/test_schemas_on_pyspark_pandas.py
test_strict_filter
746
null
unionai-oss/pandera
import copy import pandas as pd import pytest from pandera.backends.pandas import error_formatters from pandera.pandas import ( Bool, Check, Column, DataFrameSchema, Float, Index, Int, SeriesSchema, String, errors, ) def test_check_groupby() -> None: """Tests uses of group...
{"col1", "col2"}
assert
collection
tests/pandas/test_checks.py
test_check_groupby
72
null
unionai-oss/pandera
import dataclasses import datetime import inspect import re import sys from decimal import Decimal from typing import Any, NamedTuple import hypothesis import numpy as np import pandas as pd import pytest from _pytest.mark.structures import ParameterSet from _pytest.python import Metafunc from hypothesis import strate...
2
assert
numeric_literal
tests/pandas/test_dtypes.py
test_numpy_string
569
null
unionai-oss/pandera
import os import re import runpy from collections.abc import Iterable from copy import deepcopy from enum import Enum from typing import Any, Generic, Optional, TypeVar import numpy as np import pandas as pd import pytest from pandas._testing import assert_frame_equal import pandera.api.extensions as pax import pande...
0
assert
numeric_literal
tests/pandas/test_model.py
test_inherit_field_checks
668
null
unionai-oss/pandera
import datetime import operator import re from collections.abc import Callable from typing import Any, Optional from unittest.mock import MagicMock from warnings import catch_warnings import numpy as np import pandas as pd import pytest import pandera.pandas as pa from pandera.api.checks import Check from pandera.api...
value
assert
variable
tests/strategies/test_strategies.py
test_check_strategy_continuous
160
null
unionai-oss/pandera
import re from typing import Any, Optional import numpy as np import pandas as pd import pytest import pandera.pandas as pa from pandera.dtypes import DataType from pandera.typing import DataFrame, Index, Series def _test_literal_pandas_dtype( model: type[pa.DataFrameModel], pandas_dtype: DataType ): schema ...
expected.type.type
assert
complex_expr
tests/pandas/test_typing.py
_test_annotated_dtype
208
null
unionai-oss/pandera
from typing import cast import dask.dataframe as dd import pandas as pd import pytest import pandera.pandas as pa from pandera.typing.dask import DataFrame, Series def test_series_schema() -> None: """ Test that SeriesSchema based pandera validation works with Dask Series. """ integer_schema = pa.Ser...
dseries.compute())
assert_*
func_call
tests/dask/test_dask.py
test_series_schema
82
null
unionai-oss/pandera
import pandas as pd from joblib import Parallel, delayed from pandera.pandas import Column, DataFrameSchema schema = DataFrameSchema({"a": Column("int64")}, coerce=True) def test_polars_parallel(): def fn(): return schema.validate(pd.DataFrame({"a": [1]})) results = Parallel(2)([delayed(fn)() for _ ...
"int64"
assert
string_literal
tests/pandas/test_pandas_parallel.py
test_polars_parallel
18
null
unionai-oss/pandera
import datetime import decimal from collections.abc import Sequence from decimal import Decimal from typing import Union import polars as pl import pytest from hypothesis import given, settings from hypothesis import strategies as st from polars.testing import assert_frame_equal from polars.testing.parametric import d...
result)
assert_*
variable
tests/polars/test_polars_dtypes.py
test_polars_object_coercible
331
null
unionai-oss/pandera
import geopandas as gpd import pandas as pd import pytest from shapely.geometry import Point, Polygon import pandera.pandas as pa from pandera.engines.geopandas_engine import Geometry from pandera.typing import Series from pandera.typing.geopandas import GeoDataFrame, GeoSeries @pytest.mark.parametrize( "data,inv...
pa.errors.SchemaError)
pytest.raises
complex_expr
tests/geopandas/test_geopandas.py
test_schema_model
61
null
unionai-oss/pandera
import dataclasses import datetime import inspect import re import sys from decimal import Decimal from typing import Any, NamedTuple import hypothesis import numpy as np import pandas as pd import pytest from _pytest.mark.structures import ParameterSet from _pytest.python import Metafunc from hypothesis import strate...
str(pd_dtype)
assert
func_call
tests/pandas/test_dtypes.py
test_datatype_alias
292
null
unionai-oss/pandera
from collections.abc import Iterable from contextlib import nullcontext from typing import Optional, Union import ibis import ibis.expr.datatypes as dt import pytest from ibis.common.exceptions import IbisTypeError import pandera.ibis as pa from pandera.backends.base import CoreCheckResult from pandera.backends.ibis....
data.columns
assert
complex_expr
tests/ibis/test_ibis_components.py
test_get_regex_columns
102
null
unionai-oss/pandera
import datetime as dt from typing import Any, Optional import hypothesis import hypothesis.extra.pandas as pd_st import hypothesis.strategies as st import numpy as np import pandas as pd import pyarrow import pytest import pytz from hypothesis import given from pandera.engines import pandas_engine from pandera.errors...
timezone
assert
variable
tests/pandas/test_pandas_engine.py
test_pandas_datetimetz_dtype
214
null
unionai-oss/pandera
import io import sys from unittest.mock import MagicMock, patch import polars as pl import pytest import pandera.polars as pa from pandera.engines import PYDANTIC_V2 from pandera.errors import SchemaInitError from pandera.typing.formats import Formats from pandera.typing.polars import DataFrame, Series, polars_versio...
csv_data)
assert_*
variable
tests/polars/test_polars_typing.py
test_from_format_csv
TestDataFrame
186
null
unionai-oss/pandera
from typing import cast import dask.dataframe as dd import pandas as pd import pytest import pandera.pandas as pa from pandera.typing.dask import DataFrame, Series def test_model_validation() -> None: """ Test that model based pandera validation works with Dask DataFrames. """ df = pd.DataFrame( ...
pa.errors.SchemaError)
pytest.raises
complex_expr
tests/dask/test_dask.py
test_model_validation
35
null