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
allmonday/pydantic-resolve
from typing import get_origin def test_module_path_syntax_with_simple_class(): """ Test that module path syntax works with simple class reference. """ from tests.er_diagram.circular.entities.user import UserEntity from tests.er_diagram.circular.entities.post import PostEntity from tests.er_diag...
UserEntity
assert
variable
tests/er_diagram/circular/test_circular_import.py
test_module_path_syntax_with_simple_class
89
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import ( config_resolver, Entity, Relationship, LoadBy, ErDiagram ) from aiodataloader import DataLoader @pytest.mark.asyncio async def test_field_fn_with_valid_transformation(): """...
1
assert
numeric_literal
tests/er_diagram/test_field_fn_exceptions.py
test_field_fn_with_valid_transformation
325
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import Entity, Relationship, LoadBy, ErDiagram from aiodataloader import DataLoader @pytest.mark.asyncio async def test_resolver_factory_with_er_configs_inherit(): ...
None
assert
none_literal
tests/er_diagram/test_er_diagram_fk_none.py
test_resolver_factory_with_er_configs_inherit
65
null
allmonday/pydantic-resolve
from typing import get_origin def test_circular_import_error(): """ Test that module path syntax resolves cross-module references without circular import. - entities/user.py uses: list['tests.er_diagram.circular.entities.post:PostEntity'] - entities/post.py uses: 'tests.er_diagram.circular.entities.us...
None
assert
none_literal
tests/er_diagram/circular/test_circular_import.py
test_circular_import_error
32
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ensure_subset, base_entity from aiodataloader import DataLoader BASE_ENTITY = base_entity()...
"a"
assert
string_literal
tests/er_diagram/test_er_diagram_inline_short.py
test_resolver_factory_with_er_configs_inherit
131
null
allmonday/pydantic-resolve
from pydantic import BaseModel from pydantic_resolve.analysis import _scan_post_method, _scan_post_default_handler from pydantic_resolve import Collector def test_scan_post_method_3(): class A(BaseModel): a: str def post_a(self, context, ancestor_context, ...
'post_a'
assert
string_literal
tests/core/test_scan_post_method.py
test_scan_post_method_3
55
null
allmonday/pydantic-resolve
from typing import get_origin def test_circular_import_error(): """ Test that module path syntax resolves cross-module references without circular import. - entities/user.py uses: list['tests.er_diagram.circular.entities.post:PostEntity'] - entities/post.py uses: 'tests.er_diagram.circular.entities.us...
1
assert
numeric_literal
tests/er_diagram/circular/test_circular_import.py
test_circular_import_error
36
null
allmonday/pydantic-resolve
import pytest from pydantic import BaseModel from pydantic_resolve import base_entity, Relationship def test_scalar_field_conflict(): """测试标量字段与关系字段的冲突检测""" BaseEntity = base_entity() # 需要先定义 PostEntity class PostEntity(BaseModel, BaseEntity): id: int class UserEntity(BaseModel, BaseEntit...
error_msg
assert
variable
tests/graphql/test_field_name_conflicts.py
test_scalar_field_conflict
34
null
allmonday/pydantic-resolve
import pytest from typing import Optional, List from pydantic import BaseModel from pydantic_resolve import ( ErDiagram, Entity, Relationship, QueryConfig, MutationConfig, query, mutation, ) from pydantic_resolve.graphql import SchemaBuilder async def get_all_users(limit: int = 10) -> List...
schema
assert
variable
tests/graphql/test_query_mutation_config.py
test_schema_generation_with_config
TestSchemaBuilderCompatibility
236
null
allmonday/pydantic-resolve
from pydantic import BaseModel from pydantic_resolve.analysis import Analytic def test_long_distance_resolve(): result = Analytic().scan(A) prefix = 'tests.analysis.test_analysis_object_fields_4' expect = { f'{prefix}.A': { 'resolve': [], 'post': [], 'object_fiel...
v.items()
assert
func_call
tests/analysis/test_analysis_object_fields_4.py
test_long_distance_resolve
95
null
allmonday/pydantic-resolve
import pytest from pydantic import BaseModel from pydantic_resolve.analysis import Analytic from pydantic_resolve.exceptions import ResolverTargetAttrNotFound, MissingCollector from typing import Optional, List def test_empty_class(): """Empty class should have no resolve/post, should_traverse=False""" result ...
[]
assert
collection
tests/analysis/test_analysis_edge_cases.py
test_empty_class
20
null
allmonday/pydantic-resolve
from __future__ import annotations import pytest from typing import Optional from pydantic import BaseModel from pydantic_resolve.analysis import Analytic def test_raise_exception(): with pytest.raises(
ValueError)
pytest.raises
variable
tests/core/test_field_pydantic_error.py
test_raise_exception
26
null
allmonday/pydantic-resolve
from __future__ import annotations from pydantic import BaseModel from typing import List, Annotated from pydantic_resolve import Resolver, Collector, LoaderDepend, SendTo, DefineSubset, SubsetConfig import pytest async def c_loader_fn(keys): return [[C(detail=f'{k}-1'), C(detail=f'{k}-2')] for k in keys] @pytest...
True
assert
bool_literal
tests/resolver/test_53_send_to.py
test_collector_1
77
null
allmonday/pydantic-resolve
from __future__ import annotations from collections import defaultdict from typing import List from pydantic import BaseModel from pydantic_resolve import Resolver, LoaderDepend from aiodataloader import DataLoader import pytest @pytest.mark.asyncio async def test_1(): loader = DummyLoader() records = [ ...
expected
assert
variable
tests/resolver/test_26_tree.py
test_1
52
null
allmonday/pydantic-resolve
import pytest from typing import List import pydantic_resolve.constant as const from pydantic import BaseModel from pydantic_resolve.utils.resolver_configurator import config_resolver from pydantic_resolve import Entity, Relationship, ErDiagram @pytest.mark.asyncio async def test_resolver_factory(): MyResolver = c...
[]
assert
collection
tests/utils/test_resolver_factory.py
test_resolver_factory
25
null
allmonday/pydantic-resolve
import asyncio from pydantic import ConfigDict, BaseModel import pytest import pydantic_resolve.utils.class_util import pydantic_resolve.utils.conversion import pydantic_resolve.utils.dataloader def test_build_object(): raw = [(1, 'peter', 10), (2, 'mike', 21), (3, 'john', 12)] users = [User(id=i[0], name=i[1...
[b, c, a, None]
assert
collection
tests/utils/test_utils.py
test_build_object
43
null
allmonday/pydantic-resolve
from dataclasses import dataclass from typing import Optional from pydantic import BaseModel from pydantic_resolve.utils import class_util import pydantic_resolve.constant as const import pytest def test_ensure_subset(): class Base(BaseModel): a: str b: int @class_util.ensure_subset(Base) ...
TypeError)
pytest.raises
variable
tests/utils/test_ensure_subset.py
test_ensure_subset
50
null
allmonday/pydantic-resolve
from pydantic_resolve.utils.openapi import model_config from pydantic import BaseModel, Field from pydantic_resolve import Resolver from pydantic.json_schema import GenerateJsonSchema as GenerateJsonSchema import pytest from typing import Annotated @pytest.mark.asyncio async def test_schema_config_required_true(): ...
{'name', 'id', 'password'}
assert
collection
tests/utils/test_model_config.py
test_schema_config_required_true
64
null
allmonday/pydantic-resolve
from pydantic import BaseModel from pydantic_resolve.analysis import _scan_post_method, _scan_post_default_handler from pydantic_resolve import Collector def test_scan_post_method_3(): class A(BaseModel): a: str def post_a(self, context, ancestor_context, ...
2
assert
numeric_literal
tests/core/test_scan_post_method.py
test_scan_post_method_3
54
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve.utils.resolver_configurator import config_global_resolver from pydantic_resolve import Entity, Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ErDiagram, Resolver from aiodataloader import Dat...
"b"
assert
string_literal
tests/er_diagram/test_er_diagram_global.py
test_resolver_factory_with_er_configs_inherit
117
null
allmonday/pydantic-resolve
from pydantic import BaseModel, Field from pydantic_resolve import serialization from typing import List, Optional, Annotated def test_multi_level_nesting(): """Test that serialization decorator works with multi-level nesting (3 levels)""" schema = User.model_json_schema(mode='serialization') # Level 1: U...
city_def['required']
assert
complex_expr
tests/utils/test_serialization.py
test_multi_level_nesting
59
null
allmonday/pydantic-resolve
from typing import List import pytest from pydantic import BaseModel from pydantic_resolve import Resolver, LoaderDepend from aiodataloader import DataLoader @pytest.mark.asyncio async def test_loader_depends(): counter = { "book": 0 } BOOKS = { 1: [{'name': 'book1'}, {'name': 'book2'}], ...
2
assert
numeric_literal
tests/resolver/test_30_loader_in_object.py
test_loader_depends
55
null
allmonday/pydantic-resolve
from pydantic import BaseModel from typing import List from pydantic_resolve import Resolver, LoaderDepend from aiodataloader import DataLoader import pytest from pydantic_resolve.exceptions import GlobalLoaderFieldOverlappedError async def loader_fn_a(keys): return [ k**2 for k in keys ] @pytest.mark.asyncio asy...
8
assert
numeric_literal
tests/resolver/test_33_global_loader_filter.py
test_case_1
61
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import ( config_resolver, Entity, Relationship, LoadBy, ErDiagram ) from aiodataloader import DataLoader @pytest.mark.asyncio async def test_field_fn_returns_incompatible_type(): """...
ValueError)
pytest.raises
variable
tests/er_diagram/test_field_fn_exceptions.py
test_field_fn_returns_incompatible_type
191
null
allmonday/pydantic-resolve
import pytest from typing import List import pydantic_resolve.constant as const from pydantic import BaseModel from pydantic_resolve.utils.resolver_configurator import config_resolver from pydantic_resolve import Entity, Relationship, ErDiagram @pytest.mark.asyncio async def test_resolver_factory(): MyResolver = c...
'kikodo!!!'
assert
string_literal
tests/utils/test_resolver_factory.py
test_resolver_factory
22
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ensure_subset, base_entity from aiodataloader import DataLoader BASE_ENTITY = base_entity()...
"b"
assert
string_literal
tests/er_diagram/test_er_diagram_inline.py
test_resolver_factory_with_er_configs_inherit
138
null
allmonday/pydantic-resolve
from pydantic_resolve.utils.openapi import model_config from pydantic import BaseModel, Field from pydantic_resolve import Resolver from pydantic.json_schema import GenerateJsonSchema as GenerateJsonSchema import pytest from typing import Annotated @pytest.mark.asyncio async def test_schema_config(): @model_confi...
{'name': 'kikodo'}
assert
collection
tests/utils/test_model_config.py
test_schema_config
29
null
allmonday/pydantic-resolve
import pytest from pydantic import BaseModel from pydantic_resolve.utils.er_diagram import base_entity, Relationship def test_simple_class_name_not_found_in_module(): """Test that simple class name without module path raises clear error.""" Base = base_entity() class MyEntity(BaseModel, Base): __...
error_msg
assert
variable
tests/utils/test_resolve_ref_errors.py
test_simple_class_name_not_found_in_module
112
null
allmonday/pydantic-resolve
from dataclasses import dataclass from typing import Optional from pydantic import BaseModel from pydantic_resolve.utils import class_util import pydantic_resolve.constant as const import pytest def test_ensure_subset(): class Base(BaseModel): a: str b: int @class_util.ensure_subset(Base) ...
Base
assert
variable
tests/utils/test_ensure_subset.py
test_ensure_subset
31
null
allmonday/pydantic-resolve
import asyncio from pydantic import ConfigDict, BaseModel import pytest import pydantic_resolve.utils.class_util import pydantic_resolve.utils.conversion import pydantic_resolve.utils.dataloader def test_super_logic(): class A(): def say(self): return 'A' class B(A): def say(s...
'B.A'
assert
string_literal
tests/utils/test_utils.py
test_super_logic
68
null
allmonday/pydantic-resolve
import sys from pydantic_resolve.utils.types import ( get_core_types, ) from typing import Optional, List import pytest @pytest.mark.skipif(sys.version_info < (3, 12), reason="PEP 695 type aliases require Python 3.12+") def test_union_type_alias_and_list(): # Dynamically exec a type alias using the new syntax...
{A, B}
assert
collection
tests/utils/test_union_types.py
test_union_type_alias_and_list
53
null
allmonday/pydantic-resolve
import pytest from aiodataloader import DataLoader from pydantic import BaseModel from pydantic_resolve.analysis import _scan_resolve_method from pydantic_resolve import LoaderDepend, Collector def test_scan_resolve_method_4(): class A(BaseModel): a: str def resolve_a(self, c=Collector('some_field'...
AttributeError)
pytest.raises
variable
tests/core/test_scan_resolve_method.py
test_scan_resolve_method_4
75
null
allmonday/pydantic-resolve
from __future__ import annotations import pytest from typing import Optional, List from pydantic import BaseModel from pydantic_resolve import Resolver @pytest.mark.asyncio async def test_parent(): b = Base(name='kikodo') b = await Resolver().resolve(b) assert b.parent is None # parent of root is none ...
'kikodo'
assert
string_literal
tests/resolver/test_39_parent.py
test_parent
39
null
allmonday/pydantic-resolve
import pytest from typing import List from pydantic import BaseModel from pydantic_resolve.resolver import Resolver @pytest.mark.asyncio async def test_case_1(): class Kar(BaseModel): name: str desc: str = '' def resolve_desc(self, ancestor_context): return f"{self.name} - {anc...
TypeError)
pytest.raises
variable
tests/resolver/test_32_dynamic_variable_for_descdant_loader_exception.py
test_case_1
72
null
allmonday/pydantic-resolve
from pydantic import BaseModel from pydantic_resolve.analysis import Analytic from typing import Optional def test_analysis_object_fields(): result = Analytic().scan(Kls) prefix = 'tests.analysis.test_analysis_object_fields_2' expect = { f'{prefix}.Kls': { 'resolve': [], 'ob...
v.items()
assert
func_call
tests/analysis/test_analysis_object_fields_2.py
test_analysis_object_fields
98
null
allmonday/pydantic-resolve
from __future__ import annotations import pytest from typing import Optional, List from pydantic import BaseModel from aiodataloader import DataLoader from pydantic_resolve.analysis import Analytic from pydantic_resolve import LoaderDepend, LoaderFieldNotProvidedError from pydantic_resolve.loader_manager import validat...
4
assert
numeric_literal
tests/core/test_field_validate_and_create_loader_instance.py
test_instance_2
98
null
allmonday/pydantic-resolve
import pytest from pydantic import BaseModel from pydantic_resolve.utils.er_diagram import base_entity, Relationship def test_missing_module_name_before_colon(): """Test that empty module name before colon raises appropriate error.""" Base = base_entity() class MyEntity(BaseModel, Base): __relati...
(ImportError, ValueError))
pytest.raises
collection
tests/utils/test_resolve_ref_errors.py
test_missing_module_name_before_colon
55
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import LoadBy from aiodataloader import DataLoader @pytest.mark.asyncio async def test_resolver_factory_with_er_configs_inherit(): with pytest.raises(
ValueError)
pytest.raises
variable
tests/er_diagram/test_er_diagram_not_config.py
test_resolver_factory_with_er_configs_inherit
34
null
allmonday/pydantic-resolve
from __future__ import annotations from typing import Tuple from pydantic import BaseModel from pydantic_resolve.analysis import Analytic async def loader_fn(keys): return keys def test_get_all_fields(): # https://github.com/allmonday/pydantic2-resolve/issues/7 result = Analytic().scan(Student) expect...
v.items()
assert
func_call
tests/core/test_specific_type.py
test_get_all_fields
26
null
allmonday/pydantic-resolve
from pydantic import BaseModel from pydantic_resolve.analysis import Analytic def test_long_distance_resolve(): result = Analytic().scan(Tree) prefix = 'tests.analysis.test_analysis_object_fields_3' expect = { f'{prefix}.Tree': { 'resolve': [], 'object_fields': [], ...
v.items()
assert
func_call
tests/analysis/test_analysis_object_fields_3.py
test_long_distance_resolve
27
null
allmonday/pydantic-resolve
import asyncio from pydantic import ConfigDict, BaseModel import pytest import pydantic_resolve.utils.class_util import pydantic_resolve.utils.conversion import pydantic_resolve.utils.dataloader def test_build_list(): raw = [(1, 'peter', 10), (2, 'mike', 21), (3, 'john', 12)] users = [User(id=i[0], name=i[1],...
[[b], [c], [a], []]
assert
collection
tests/utils/test_utils.py
test_build_list
52
null
allmonday/pydantic-resolve
import asyncio from pydantic import ConfigDict, BaseModel import pytest import pydantic_resolve.utils.class_util import pydantic_resolve.utils.conversion import pydantic_resolve.utils.dataloader @pytest.mark.asyncio async def test_mapper_1(): class A(BaseModel): a: int @pydantic_resolve.utils.convers...
A(a=1)
assert
func_call
tests/utils/test_utils.py
test_mapper_1
94
null
allmonday/pydantic-resolve
from pydantic_resolve.utils.types import ( _is_list, get_core_types, shelling_type, get_class_field_annotations, _is_optional ) from typing import Optional, Union, List, Dict, Tuple, Set import pytest def test_get_class_field_annotations_with_inheritance(): class BaseClass: base_field:...
{'derived_field'}
assert
collection
tests/utils/test_types.py
test_get_class_field_annotations_with_inheritance
146
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ensure_subset, base_entity from aiodataloader import DataLoader BASE_ENTITY = base_entity()...
"b"
assert
string_literal
tests/er_diagram/test_er_diagram_inline_anno.py
test_resolver_factory_with_er_configs_inherit
141
null
allmonday/pydantic-resolve
from pydantic import BaseModel from pydantic_resolve.utils.class_util import is_compatible_type from pydantic_resolve.utils.subset import DefineSubset from typing import List, Optional def test_is_compatible_type(): assert is_compatible_type(int, str) is False assert is_compatible_type(XA, A) is False ass...
True
assert
bool_literal
tests/utils/test_class_util.py
test_is_compatible_type
32
null
allmonday/pydantic-resolve
import pytest from typing import List from pydantic import BaseModel from aiodataloader import DataLoader from pydantic_resolve import LoaderDepend, Resolver @pytest.mark.asyncio async def test_loader_query_meta(): classrooms = [ ClassRoom(id=1, name='a'), ClassRoom(id=2, name='b'), ] resol...
{'id', 'name'}
assert
collection
tests/resolver/test_49_loader_query_meta.py
test_loader_query_meta
46
null
allmonday/pydantic-resolve
from typing import get_origin def test_module_path_syntax_with_simple_class(): """ Test that module path syntax works with simple class reference. """ from tests.er_diagram.circular.entities.user import UserEntity from tests.er_diagram.circular.entities.post import PostEntity from tests.er_diag...
'UserEntity'
assert
string_literal
tests/er_diagram/circular/test_circular_import.py
test_module_path_syntax_with_simple_class
91
null
allmonday/pydantic-resolve
from typing import List import pytest from pydantic import BaseModel from pydantic_resolve import Resolver, LoaderDepend from aiodataloader import DataLoader @pytest.mark.asyncio async def test_loader_depends(): counter = { "book": 0 } BOOKS = { 1: [{'name': 'book1'}, {'name': 'book2'}], ...
1
assert
numeric_literal
tests/resolver/test_30_loader_in_object.py
test_loader_depends
51
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import ( config_resolver, Entity, Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ErDiagram, ensure_subset, Loader ) from aiodataloader import DataLoad...
None
assert
none_literal
tests/er_diagram/test_er_diagram.py
test_resolver_factory_with_er_configs_subset
201
null
allmonday/pydantic-resolve
from pydantic_resolve import Resolver import pytest @pytest.mark.asyncio async def test_input(): data = [] data = await Resolver().resolve(data) assert data ==
[]
assert
collection
tests/core/test_input.py
test_input
8
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ensure_subset, base_entity from aiodataloader import DataLoader BASE_ENTITY = base_entity()...
None
assert
none_literal
tests/er_diagram/test_er_diagram_inline_anno.py
test_resolver_factory_with_er_configs_subset
173
null
allmonday/pydantic-resolve
from pydantic import BaseModel, Field from pydantic_resolve import serialization from typing import List, Optional, Annotated def test_multi_level_nesting(): """Test that serialization decorator works with multi-level nesting (3 levels)""" schema = User.model_json_schema(mode='serialization') # Level 1: U...
city_def['properties']
assert
complex_expr
tests/utils/test_serialization.py
test_multi_level_nesting
61
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ensure_subset, base_entity from aiodataloader import DataLoader BASE_ENTITY = base_entity()...
None
assert
none_literal
tests/er_diagram/test_er_diagram_inline_short.py
test_resolver_factory_with_er_configs_subset
170
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve.utils.resolver_configurator import config_global_resolver from pydantic_resolve import Entity, Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ErDiagram, Resolver from aiodataloader import Dat...
"a"
assert
string_literal
tests/er_diagram/test_er_diagram_global.py
test_resolver_factory_with_er_configs_inherit
113
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ensure_subset, base_entity from aiodataloader import DataLoader BASE_ENTITY = base_entity()...
["foo1", "foo2"]
assert
collection
tests/er_diagram/test_er_diagram_inline_anno.py
test_resolver_factory_with_er_configs_inherit
139
null
allmonday/pydantic-resolve
import pytest from typing import Annotated, List from pydantic import BaseModel from pydantic_resolve import ( config_resolver, Entity, MultipleRelationship, Link, LoadBy, ErDiagram, ) from aiodataloader import DataLoader @pytest.mark.asyncio async def test_biz_not_found_in_links(): """Tes...
error_msg
assert
variable
tests/er_diagram/test_multiple_relationship_edge_cases.py
test_biz_not_found_in_links
137
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import ( config_resolver, Entity, Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ErDiagram, ensure_subset, Loader ) from aiodataloader import DataLoad...
AttributeError)
pytest.raises
variable
tests/er_diagram/test_er_diagram.py
test_resolver_factory_of_er_relationship_not_found
246
null
allmonday/pydantic-resolve
from __future__ import annotations import pytest from typing import List from collections import Counter, defaultdict from aiodataloader import DataLoader from pydantic import ConfigDict, BaseModel from sqlalchemy import select from sqlalchemy.ext.asyncio import async_sessionmaker from sqlalchemy.ext.asyncio import cre...
2
assert
numeric_literal
tests/resolver/test_11_sqlalchemy_query_global_filter.py
test_sqlite_and_dataloader
205
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ensure_subset, base_entity from aiodataloader import DataLoader BASE_ENTITY = base_entity()...
[]
assert
collection
tests/er_diagram/test_er_diagram_inline.py
test_resolver_factory_with_er_configs_inherit
140
null
allmonday/pydantic-resolve
from typing import List import pytest from pydantic import BaseModel from pydantic_resolve import Resolver, LoaderDepend @pytest.mark.asyncio async def test_loader_depends(): BOOKS = { 1: [{'name': 'book1'}, {'name': 'book2'}], 2: [{'name': 'book3'}, {'name': 'book4'}], 3: [{'name': 'book1'...
expected
assert
variable
tests/resolver/test_22_not_stop_by_idle_level_complex.py
test_loader_depends
42
null
allmonday/pydantic-resolve
from pydantic_resolve.utils.types import ( _is_list, get_core_types, shelling_type, get_class_field_annotations, _is_optional ) from typing import Optional, Union, List, Dict, Tuple, Set import pytest def test_get_class_field_annotations_empty(): class EmptyClass: pass annotat...
[]
assert
collection
tests/utils/test_types.py
test_get_class_field_annotations_empty
131
null
allmonday/pydantic-resolve
from pydantic import BaseModel from pydantic_resolve.analysis import Analytic from typing import Optional def test_analysis_object_fields(): result = Analytic().scan(Kls) prefix = 'tests.analysis.test_analysis_object_fields_1' expect = { f'{prefix}.Kls': { 'resolve': [], 'ob...
v.items()
assert
func_call
tests/analysis/test_analysis_object_fields_1.py
test_analysis_object_fields
124
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ensure_subset, base_entity from aiodataloader import DataLoader BASE_ENTITY = base_entity()...
"a"
assert
string_literal
tests/er_diagram/test_er_diagram_inline_anno.py
test_resolver_factory_with_er_configs_inherit
134
null
allmonday/pydantic-resolve
import pytest from pydantic import BaseModel from pydantic_resolve.utils.er_diagram import base_entity, Relationship def test_invalid_module_in_module_path(): """Test reference to non-existent module.""" Base = base_entity() class MyEntity(BaseModel, Base): __relationships__ = [ Relat...
ImportError)
pytest.raises
variable
tests/utils/test_resolve_ref_errors.py
test_invalid_module_in_module_path
262
null
allmonday/pydantic-resolve
import pytest from typing import List from collections import Counter, defaultdict from aiodataloader import DataLoader from pydantic import ConfigDict, BaseModel from sqlalchemy import select from sqlalchemy.ext.asyncio import async_sessionmaker from sqlalchemy.ext.asyncio import create_async_engine from sqlalchemy.or...
2
assert
numeric_literal
tests/resolver/test_10_sqlalchemy_query_with_change.py
test_sqlite_and_dataloader
196
null
allmonday/pydantic-resolve
from pydantic_resolve.utils.types import ( _is_list, get_core_types, shelling_type, get_class_field_annotations, _is_optional ) from typing import Optional, Union, List, Dict, Tuple, Set import pytest @pytest.mark.parametrize( "annotation,expected", [ (Optional[int], True), ...
expected
assert
variable
tests/utils/test_types.py
test_is_optional
25
null
allmonday/pydantic-resolve
import asyncio from random import random from pydantic import BaseModel from pydantic_resolve import Resolver from typing import List import pytest @pytest.mark.asyncio async def test_3(): earth = Earth() with pytest.raises(
KeyError)
pytest.raises
variable
tests/resolver/test_27_context.py
test_3
59
null
allmonday/pydantic-resolve
from pydantic import BaseModel from pydantic_resolve.utils.class_util import get_class_of_object def test_get_class(): class Student(BaseModel): name: str = 'kikodo' stu = Student() stus = [Student(), Student()] assert get_class_of_object(stu) ==
Student
assert
variable
tests/core/test_field.py
test_get_class
12
null
allmonday/pydantic-resolve
from pydantic import BaseModel from pydantic_resolve.utils.er_diagram import base_entity, Relationship Base = base_entity() def test_bases(): assert MyModel in
Base.entities
assert
complex_expr
tests/er_diagram/test_er_diagram_base.py
test_bases
26
null
allmonday/pydantic-resolve
from typing import List from pydantic import BaseModel from pydantic_resolve import Resolver, mapper, LoaderDepend from aiodataloader import DataLoader import pytest counter = { "n": 0 } @pytest.mark.asyncio async def test_loader_instance_1(): counter["n"] = 0 root = Root() loader = FriendLoader() ...
1
assert
numeric_literal
tests/resolver/test_20_loader_instance.py
test_loader_instance_1
76
null
allmonday/pydantic-resolve
import asyncio from pydantic import ConfigDict, BaseModel import pytest import pydantic_resolve.utils.class_util import pydantic_resolve.utils.conversion import pydantic_resolve.utils.dataloader def test_get_class_field_annotations(): class B: hello: str = 'hello' class C: hello: str ...
[]
assert
collection
tests/utils/test_utils.py
test_get_class_field_annotations
27
null
allmonday/pydantic-resolve
from pydantic_resolve.utils.openapi import model_config from pydantic import BaseModel, Field from pydantic_resolve import Resolver from pydantic.json_schema import GenerateJsonSchema as GenerateJsonSchema import pytest from typing import Annotated @pytest.mark.asyncio async def test_raw_schema_in_serialization(): ...
['name', 'id']
assert
collection
tests/utils/test_model_config.py
test_raw_schema_in_serialization
79
null
allmonday/pydantic-resolve
import pytest from pydantic import BaseModel from pydantic_resolve.utils.er_diagram import base_entity, Relationship def test_list_generic_with_module_path(): """Test that list['module:ClassName'] syntax works correctly.""" Base = base_entity() class MyEntity(BaseModel, Base): __relationships__ =...
list
assert
variable
tests/utils/test_resolve_ref_errors.py
test_list_generic_with_module_path
230
null
allmonday/pydantic-resolve
from typing import List import pytest from pydantic import BaseModel from pydantic_resolve import Resolver, LoaderDepend @pytest.mark.asyncio async def test_loader_depends(): BOOKS = { 1: [{'name': 'book1'}, {'name': 'book2'}], 2: [{'name': 'book3'}, {'name': 'book4'}], 3: [{'name': 'book1...
expected
assert
variable
tests/resolver/test_15_support_batch_load_fn.py
test_loader_depends
38
null
allmonday/pydantic-resolve
from pydantic_resolve import query def test_query_decorator_without_args(): """测试不带参数的 @query 装饰器""" @query async def my_query(cls): return [] # 验证返回的是 classmethod assert isinstance(my_query, classmethod) # 验证属性被正确设置(在 __func__ 上) assert hasattr(my_query.__func__, '_pydantic_reso...
None
assert
none_literal
tests/graphql/test_query_decorator.py
test_query_decorator_without_args
38
null
allmonday/pydantic-resolve
import pytest from pydantic_resolve.graphql import QueryParser, QueryParseError from tests.graphql.fixtures.entities import BaseEntity class TestQueryParser: def setup_method(self): """设置测试环境""" self.er_diagram = BaseEntity.get_diagram() self.parser = QueryParser(self.er_diagram) def ...
parsed.field_tree
assert
complex_expr
tests/graphql/test_query_parser.py
test_parse_simple_query
TestQueryParser
24
null
allmonday/pydantic-resolve
from pydantic import BaseModel from typing import List from pydantic_resolve import Resolver, LoaderDepend from aiodataloader import DataLoader import pytest from pydantic_resolve.exceptions import GlobalLoaderFieldOverlappedError async def loader_fn_a(keys): return [ k**2 for k in keys ] @pytest.mark.asyncio asy...
9
assert
numeric_literal
tests/resolver/test_33_global_loader_filter.py
test_case_1
62
null
allmonday/pydantic-resolve
from __future__ import annotations from typing import List, Optional import asyncio from pydantic import BaseModel from pydantic_resolve import Resolver import pytest async def set_after(fut, value): await asyncio.sleep(.1) fut.set_result(value) @pytest.mark.asyncio async def test_resolve_future(): stu = ...
expected
assert
variable
tests/resolver/test_4_resolve_return_types.py
test_resolve_future
42
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ensure_subset, base_entity from aiodataloader import DataLoader BASE_ENTITY = base_entity()...
None
assert
none_literal
tests/er_diagram/test_er_diagram_inline.py
test_resolver_factory_with_er_configs_subset
170
null
allmonday/pydantic-resolve
from typing import List import pytest from collections import Counter, defaultdict from aiodataloader import DataLoader from pydantic import ConfigDict, BaseModel from sqlalchemy import select from sqlalchemy.ext.asyncio import async_sessionmaker from sqlalchemy.ext.asyncio import create_async_engine from sqlalchemy.or...
expected
assert
variable
tests/resolver/test_9_sqlalchemy_query_fix_cache.py
test_sqlite_and_dataloader
154
null
allmonday/pydantic-resolve
import sys from pydantic_resolve.utils.types import ( get_core_types, ) from typing import Optional, List import pytest @pytest.mark.parametrize( "tp,expected", [ # Optional types (int | None, (int,)), (None | int, (int,)), # Union types (multiple non-None types) ...
expected
assert
variable
tests/utils/test_union_types.py
test_get_core_types_3_10
33
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import ( config_resolver, Entity, Relationship, LoadBy, ErDiagram ) from aiodataloader import DataLoader @pytest.mark.asyncio async def test_load_many_fn_with_valid_transformation(): ...
2
assert
numeric_literal
tests/er_diagram/test_field_fn_exceptions.py
test_load_many_fn_with_valid_transformation
357
null
allmonday/pydantic-resolve
from pydantic_resolve import Resolver import pytest @pytest.mark.asyncio async def test_input_2(): data = 'hello' with pytest.raises(
AttributeError)
pytest.raises
variable
tests/core/test_input.py
test_input_2
14
null
allmonday/pydantic-resolve
import pytest from pydantic import BaseModel from pydantic_resolve.utils.er_diagram import base_entity, Relationship def test_other_container_types(): """Test that other container types like tuple, set are handled.""" Base = base_entity() class MyEntity(BaseModel, Base): __relationships__ = [ ...
tuple['User']
assert
complex_expr
tests/utils/test_resolve_ref_errors.py
test_other_container_types
173
null
allmonday/pydantic-resolve
import pytest from typing import List from pydantic import BaseModel from pydantic_resolve.resolver import Resolver @pytest.mark.asyncio async def test_case_0(): class Kar(BaseModel): name: str desc: str = '' def resolve_desc(self, ancestor_context): return f"{self.name} - {anc...
str(e.value)
assert
func_call
tests/resolver/test_32_dynamic_variable_for_descdant_loader_exception.py
test_case_0
40
null
allmonday/pydantic-resolve
from typing import List, Optional import pytest from pydantic import BaseModel, ValidationError from pydantic_resolve import Resolver @pytest.mark.asyncio async def test_function_param(): class Base(BaseModel): name: str id: int class Child(BaseModel): name: str class Containe...
'name-1'
assert
string_literal
tests/resolver/test_43_type_adapter_conver_from_pydantic_object.py
test_function_param
25
null
allmonday/pydantic-resolve
from pydantic_resolve.utils.types import ( _is_list, get_core_types, shelling_type, get_class_field_annotations, _is_optional ) from typing import Optional, Union, List, Dict, Tuple, Set import pytest def test_complex_nested_types(): """Test complex nested type scenarios""" # Triple nested...
(int,)
assert
collection
tests/utils/test_types.py
test_complex_nested_types
164
null
allmonday/pydantic-resolve
from typing import get_origin def test_circular_import_error(): """ Test that module path syntax resolves cross-module references without circular import. - entities/user.py uses: list['tests.er_diagram.circular.entities.post:PostEntity'] - entities/post.py uses: 'tests.er_diagram.circular.entities.us...
2
assert
numeric_literal
tests/er_diagram/circular/test_circular_import.py
test_circular_import_error
26
null
allmonday/pydantic-resolve
import pytest from pydantic_resolve.graphql import QueryParser, QueryParseError from tests.graphql.fixtures.entities import BaseEntity class TestQueryParser: def setup_method(self): """设置测试环境""" self.er_diagram = BaseEntity.get_diagram() self.parser = QueryParser(self.er_diagram) def ...
'UserEntity'
assert
string_literal
tests/graphql/test_query_parser.py
test_parse_simple_query
TestQueryParser
23
null
allmonday/pydantic-resolve
from pydantic_resolve import query def test_query_decorator_sets_attributes(): """测试 @query 装饰器正确设置函数属性""" @query(name='test_query', description='测试查询') async def my_query(cls, limit: int = 10): return [] # 验证返回的是 classmethod assert isinstance(my_query, classmethod) # 验证属性被正确设置(在 __f...
'test_query'
assert
string_literal
tests/graphql/test_query_decorator.py
test_query_decorator_sets_attributes
21
null
allmonday/pydantic-resolve
from __future__ import annotations from typing import List import pytest from pydantic import BaseModel from pydantic_resolve import Resolver, LoaderDepend import tests.resolver.test_14_deps.mod_a as a import tests.resolver.test_14_deps.mod_b as b @pytest.mark.asyncio async def test_loader_depends(): print(a.BookL...
expected
assert
variable
tests/resolver/test_14_check_loader_name.py
test_loader_depends
37
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ensure_subset, base_entity from aiodataloader import DataLoader BASE_ENTITY = base_entity()...
1
assert
numeric_literal
tests/er_diagram/test_er_diagram_inline.py
test_resolver_factory_with_er_configs_inherit_2
156
null
allmonday/pydantic-resolve
import pytest from typing import Optional, List from pydantic import BaseModel from pydantic_resolve import ( ErDiagram, Entity, Relationship, QueryConfig, MutationConfig, query, mutation, ) from pydantic_resolve.graphql import SchemaBuilder async def get_all_users(limit: int = 10) -> List...
[]
assert
collection
tests/graphql/test_query_mutation_config.py
test_entity_with_empty_lists
TestEntityDefaultValues
320
null
allmonday/pydantic-resolve
from __future__ import annotations from typing import List, Optional import pytest from pydantic import ConfigDict, BaseModel from pydantic_resolve import Resolver, LoaderDepend, mapper from aiodataloader import DataLoader @pytest.mark.asyncio async def test_mapper(): """ user provided mapper """ class...
expected
assert
variable
tests/resolver/test_16_mapper.py
test_mapper
37
null
allmonday/pydantic-resolve
import inspect from typing import Any, Callable, Optional import pytest def Depend( # noqa: N802 dependency: Optional[Callable[..., Any]] = None ) -> Any: return Depends(dependency=dependency) def runner_maker(): cache = {} counter = { "init_count": 0 } def exec(t_method): s...
1
assert
numeric_literal
tests/resolver/test_0_depends.py
test_depend
68
null
allmonday/pydantic-resolve
from __future__ import annotations from typing import List from pydantic import BaseModel from pydantic_resolve.analysis import Analytic def test_get_all_fields(): result = Analytic().scan(Student) expect = { 'test_field_mix.Student': { 'resolve': ['resolve_books'], 'post': [], ...
v.items()
assert
func_call
tests/core/test_field_mix.py
test_get_all_fields
38
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ensure_subset, base_entity from aiodataloader import DataLoader BASE_ENTITY = base_entity()...
"b"
assert
string_literal
tests/er_diagram/test_er_diagram_inline_short.py
test_resolver_factory_with_er_configs_inherit
138
null
allmonday/pydantic-resolve
import pytest from pydantic import BaseModel from pydantic_resolve.utils.er_diagram import base_entity, Relationship def test_valid_module_path_syntax(): """Test that valid module:path syntax works correctly.""" Base = base_entity() class MyEntity(BaseModel, Base): __relationships__ = [ ...
User.__name__
assert
complex_expr
tests/utils/test_resolve_ref_errors.py
test_valid_module_path_syntax
134
null
allmonday/pydantic-resolve
import pytest from pydantic_resolve import config_global_resolver, query from pydantic_resolve.graphql import GraphQLHandler from pydantic import BaseModel from typing import List, Optional, Dict, Any class TestGraphQLIntegration: def setup_method(self): """设置测试环境""" # 创建简单的 ERD(只用于测试) fr...
1
assert
numeric_literal
tests/graphql/test_e2e.py
test_query_with_arguments
TestGraphQLIntegration
65
null
allmonday/pydantic-resolve
from pydantic_resolve.utils.openapi import model_config from pydantic import BaseModel, Field from pydantic_resolve import Resolver from pydantic.json_schema import GenerateJsonSchema as GenerateJsonSchema import pytest from typing import Annotated @pytest.mark.asyncio async def test_schema_config(): @model_confi...
['name']
assert
collection
tests/utils/test_model_config.py
test_schema_config
24
null