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
graphql-python/graphene-django
import warnings from collections import OrderedDict, defaultdict from textwrap import dedent from unittest.mock import patch import pytest from django.db import models from graphene import Connection, Field, Interface, ObjectType, Schema, String from graphene.relay import Node from .. import registry from ..filter i...
dedent( """\ type Query { pet: Pet } type Pet { id: ID! kind: String! cuteness: Int! }""" )
assert
func_call
graphene_django/tests/test_types.py
test_django_objecttype_convert_choices_enum_false
TestDjangoObjectType
550
null
graphql-python/graphene-django
from django import VERSION as DJANGO_VERSION, forms from pytest import raises from graphene import ( ID, UUID, Boolean, Date, DateTime, Decimal, Float, Int, List, NonNull, String, Time, ) from ..converter import convert_form_field def assert_conversion(django_field, gr...
String
assert
variable
graphene_django/forms/tests/test_converter.py
test_should_multiple_choice_convert_list
116
null
graphql-python/graphene-django
import copy from django.db import models from pytest import raises from rest_framework import serializers import graphene from ..serializer_converter import convert_serializer_field from ..types import DictType def _get_type( rest_framework_field, is_input=True, convert_choices_to_enum=True, **kwargs ): # p...
graphene.Float)
assert_*
complex_expr
graphene_django/rest_framework/tests/test_field_converter.py
test_should_float_convert_float
132
null
graphql-python/graphene-django
from collections import namedtuple import pytest from django.db import models from django.utils.translation import gettext_lazy as _ from pytest import raises import graphene from graphene import NonNull from graphene.relay import ConnectionField, Node from graphene.types.datetime import Date, DateTime, Time from gra...
"es"
assert
string_literal
graphene_django/tests/test_converter.py
test_field_with_choices_convert_enum
175
null
graphql-python/graphene-django
import pytest from ...compat import ArrayField, MissingType @pytest.mark.skipif(ArrayField is MissingType, reason="ArrayField should exist") def test_array_field_filter_schema_type(schema): """ Check that the type in the filter is an array field like on the object type. """ schema_str = str(schema) ...
schema_str
assert
variable
graphene_django/filter/tests/test_array_field_exact_filter.py
test_array_field_filter_schema_type
83
null
graphql-python/graphene-django
from datetime import datetime import pytest from django_filters import ( FilterSet, rest_framework as filters, ) from graphene import ObjectType, Schema from graphene.relay import Node from graphene_django import DjangoObjectType from graphene_django.filter.tests.filters import ArticleFilter from graphene_dja...
[ {"node": {"name": "Mimi"}}, {"node": {"name": "Jojo, the rabbit"}}, ]
assert
collection
graphene_django/filter/tests/test_in_filter.py
test_int_in_filter
208
null
graphql-python/graphene-django
import copy from django.db import models from pytest import raises from rest_framework import serializers import graphene from ..serializer_converter import convert_serializer_field from ..types import DictType def _get_type( rest_framework_field, is_input=True, convert_choices_to_enum=True, **kwargs ): # p...
"w"
assert
string_literal
graphene_django/rest_framework/tests/test_field_converter.py
test_should_choice_convert_enum
76
null
graphql-python/graphene-django
from datetime import datetime import pytest from django_filters import ( FilterSet, rest_framework as filters, ) from graphene import ObjectType, Schema from graphene.relay import Node from graphene_django import DjangoObjectType from graphene_django.filter.tests.filters import ArticleFilter from graphene_dja...
[ {"node": {"headline": "A", "reporter": {"lastName": "Doe"}}}, {"node": {"headline": "B", "reporter": {"lastName": "Bon"}}}, ]
assert
collection
graphene_django/filter/tests/test_in_filter.py
test_fk_id_in_filter
369
null
graphql-python/graphene-django
import copy from django.db import models from pytest import raises from rest_framework import serializers import graphene from ..serializer_converter import convert_serializer_field from ..types import DictType def _get_type( rest_framework_field, is_input=True, convert_choices_to_enum=True, **kwargs ): # p...
graphene.Int
assert
complex_expr
graphene_django/rest_framework/tests/test_field_converter.py
test_should_list_convert_to_list
151
null
graphql-python/graphene-django
import json from unittest.mock import patch import pytest from django.utils.translation import gettext_lazy from ..utils import GraphQLTestCase, camelize, get_model_fields, get_reverse_fields from ..utils.testing import graphql_query from .models import APNewsReporter, CNNReporter, Film, Reporter def test_get_model_...
len(film_name_set)
assert
func_call
graphene_django/tests/test_utils.py
test_get_model_fields_no_duplication
19
null
graphql-python/graphene-django
from pytest import raises from ..registry import Registry from ..types import DjangoObjectType from .models import Reporter def test_should_map_fields_correctly(): class ReporterType2(DjangoObjectType): class Meta: model = Reporter registry = Registry() fields = "__all_...
["apnewsreporter", "articles", "films"]
assert
collection
graphene_django/tests/test_schema.py
test_should_map_fields_correctly
50
null
graphql-python/graphene-django
import pytest from ...compat import ArrayField, MissingType @pytest.mark.skipif(ArrayField is MissingType, reason="ArrayField should exist") def test_array_field_exact_no_match(schema): """ Test exact filter on a array field of string. """ query = """ query { events (tags: ["concert", "mu...
[]
assert
collection
graphene_django/filter/tests/test_array_field_exact_filter.py
test_array_field_exact_no_match
25
null
graphql-python/graphene-django
import datetime from pytest import raises from rest_framework import serializers from graphene import Field, ResolveInfo, String from graphene.types.inputobjecttype import InputObjectType from ...types import DjangoObjectType from ..models import ( MyFakeModel, MyFakeModelWithChoiceField, MyFakeModelWith...
4
assert
numeric_literal
graphene_django/rest_framework/tests/test_mutation.py
test_perform_mutate_success
283
null
graphql-python/graphene-django
from collections import namedtuple import pytest from django.db import models from django.utils.translation import gettext_lazy as _ from pytest import raises import graphene from graphene import NonNull from graphene.relay import ConnectionField, Node from graphene.types.datetime import Date, DateTime, Time from gra...
"Spanish"
assert
string_literal
graphene_django/tests/test_converter.py
test_field_with_choices_convert_enum
176
null
graphql-python/graphene-django
import datetime import re import pytest from django.db.models import Count, Prefetch from graphene import List, NonNull, ObjectType, Schema, String from ..fields import DjangoListField from ..types import DjangoObjectType from .models import ( Article as ArticleModel, Film as FilmModel, FilmDetails as Fi...
TypeError)
pytest.raises
variable
graphene_django/tests/test_fields.py
test_only_django_object_types
TestDjangoListField
25
null
graphql-python/graphene-django
import pytest from ...compat import ArrayField, MissingType @pytest.mark.skipif(ArrayField is MissingType, reason="ArrayField should exist") def test_array_field_overlap_multiple(schema): """ Test overlap filter on a array field of string. """ query = """ query { events (tags_Overlap: ["c...
[ {"node": {"name": "Live Show"}}, {"node": {"name": "Musical"}}, {"node": {"name": "Ballet"}}, ]
assert
collection
graphene_django/filter/tests/test_array_field_overlap_filter.py
test_array_field_overlap_multiple
25
null
graphql-python/graphene-django
from datetime import datetime import pytest from django_filters import ( FilterSet, rest_framework as filters, ) from graphene import ObjectType, Schema from graphene.relay import Node from graphene_django import DjangoObjectType from graphene_django.filter.tests.filters import ArticleFilter from graphene_dja...
[ { "node": { "genre": "do", "reporters": {"edges": [{"node": {"lastName": "Doe"}}]}, } }, { "node": { "genre": "ac", "reporters": {"edges": [{"node": {"lastName": "Doe"}}]}, } }, ]
assert
collection
graphene_django/filter/tests/test_in_filter.py
test_choice_in_filter_without_enum
300
null
graphql-python/graphene-django
from django import VERSION as DJANGO_VERSION, forms from pytest import raises from graphene import ( ID, UUID, Boolean, Date, DateTime, Decimal, Float, Int, List, NonNull, String, Time, ) from ..converter import convert_form_field def assert_conversion(django_field, gr...
Int)
assert_*
variable
graphene_django/forms/tests/test_converter.py
test_should_integer_convert_int
91
null
graphql-python/graphene-django
from django import forms from django.core.exceptions import ValidationError from pytest import raises from graphene import Field, ObjectType, Schema, String from graphene_django import DjangoObjectType from graphene_django.tests.forms import PetForm from graphene_django.tests.models import Pet from graphene_django.tes...
2
assert
numeric_literal
graphene_django/forms/tests/test_mutation.py
test_model_form_mutation_mutate_invalid_form
285
null
graphql-python/graphene-django
import datetime import re import pytest from django.db.models import Count, Prefetch from graphene import List, NonNull, ObjectType, Schema, String from ..fields import DjangoListField from ..types import DjangoObjectType from .models import ( Article as ArticleModel, Film as FilmModel, FilmDetails as Fi...
{ "persons": [ { "name": "Tara", "children": [ {"name": "Toto"}, {"name": "Tata"}, ], }, { "name": "Debra", "children": [], }, { "name": "Toto", "children": [], }, { "name": "Tata", "children": [], }, ] }
assert
collection
graphene_django/tests/test_fields.py
test_same_type_nested_list_field
TestDjangoListField
310
null
graphql-python/graphene-django
import datetime import re import pytest from django.db.models import Count, Prefetch from graphene import List, NonNull, ObjectType, Schema, String from ..fields import DjangoListField from ..types import DjangoObjectType from .models import ( Article as ArticleModel, Film as FilmModel, FilmDetails as Fi...
{"reporters": [{"firstName": "Debra"}]}
assert
collection
graphene_django/tests/test_fields.py
test_resolve_list
TestDjangoListField
424
null
graphql-python/graphene-django
from datetime import datetime from textwrap import dedent import pytest from django.db.models import TextField, Value from django.db.models.functions import Concat from graphene import Argument, Boolean, Decimal, Field, ObjectType, Schema, String from graphene.relay import Node from graphene_django import DjangoObjec...
Decimal
assert
variable
graphene_django/filter/tests/test_fields.py
test_filterset_descriptions
404
null
graphql-python/graphene-django
import datetime from pytest import raises from rest_framework import serializers from graphene import Field, ResolveInfo, String from graphene.types.inputobjecttype import InputObjectType from ...types import DjangoObjectType from ..models import ( MyFakeModel, MyFakeModelWithChoiceField, MyFakeModelWith...
name
assert
variable
graphene_django/rest_framework/tests/test_mutation.py
test_perform_mutate_success_with_enum_choice_field
309
null
graphql-python/graphene-django
import warnings from collections import OrderedDict, defaultdict from textwrap import dedent from unittest.mock import patch import pytest from django.db import models from graphene import Connection, Field, Interface, ObjectType, Schema, String from graphene.relay import Node from .. import registry from ..filter i...
fields
assert
variable
graphene_django/tests/test_types.py
test_django_objecttype_exclude_fields
371
null
graphql-python/graphene-django
import pytest from graphql_relay import to_global_id import graphene from graphene.relay import Node from ..types import DjangoObjectType from .models import Article, Film, FilmDetails, Reporter class TestShouldCallGetQuerySetOnForeignKey: def setup_schema(self): class ReporterType(DjangoObjectType): ...
None
assert
none_literal
graphene_django/tests/test_get_queryset.py
test_get_queryset_called_on_field
TestShouldCallGetQuerySetOnForeignKey
97
null
graphql-python/graphene-django
import copy from django.db import models from pytest import raises from rest_framework import serializers import graphene from ..serializer_converter import convert_serializer_field from ..types import DictType def _get_type( rest_framework_field, is_input=True, convert_choices_to_enum=True, **kwargs ): # p...
graphene.Field)
assert_*
complex_expr
graphene_django/rest_framework/tests/test_field_converter.py
test_should_model_convert_field
108
null
graphql-python/graphene-django
import pytest import graphene from graphene.relay import Node from graphene_django import DjangoConnectionField, DjangoObjectType from ...tests.models import Reporter from ..middleware import DjangoDebugMiddleware from ..types import DjangoDebug @pytest.mark.parametrize("max_limit", [None, 100]) def test_should_quer...
result.data["_debug"]["sql"][2]["rawSql"]
assert
complex_expr
graphene_django/debug/tests/test_query.py
test_should_query_nested_field
122
null
graphql-python/graphene-django
from pytest import raises from ..registry import Registry from ..types import DjangoObjectType from .models import Reporter def test_should_map_only_few_fields(): class Reporter2(DjangoObjectType): class Meta: model = Reporter fields = ("id", "email") assert list(Reporter2._m...
["id", "email"]
assert
collection
graphene_django/tests/test_schema.py
test_should_map_only_few_fields
59
null
graphql-python/graphene-django
import datetime import re import pytest from django.db.models import Count, Prefetch from graphene import List, NonNull, ObjectType, Schema, String from ..fields import DjangoListField from ..types import DjangoObjectType from .models import ( Article as ArticleModel, Film as FilmModel, FilmDetails as Fi...
{"reporters": []}
assert
collection
graphene_django/tests/test_fields.py
test_list_field_queryset_is_not_cached
TestDjangoListField
110
null
graphql-python/graphene-django
import datetime import re import pytest from django.db.models import Count, Prefetch from graphene import List, NonNull, ObjectType, Schema, String from ..fields import DjangoListField from ..types import DjangoObjectType from .models import ( Article as ArticleModel, Film as FilmModel, FilmDetails as Fi...
{ "reporters": [ {"firstName": "Tara", "articles": [{"headline": "Amazing news"}]}, {"firstName": "Debra", "articles": []}, ] }
assert
collection
graphene_django/tests/test_fields.py
test_override_resolver_nested_list_field
TestDjangoListField
264
null
graphql-python/graphene-django
import json import pytest from graphene import ObjectType, Schema from graphene.relay import Node from graphene_django import DjangoObjectType from graphene_django.tests.models import Pet from graphene_django.utils import DJANGO_FILTER_INSTALLED pytestmark = [] def test_range_filter_with_invalid_input(): """ ...
expected_error
assert
variable
graphene_django/filter/tests/test_range_filter.py
test_range_filter_with_invalid_input
104
null
graphql-python/graphene-django
import pytest from ...compat import ArrayField, MissingType @pytest.mark.skipif(ArrayField is MissingType, reason="ArrayField should exist") def test_array_field_contains_multiple(schema): """ Test contains filter on a array field of string. """ query = """ query { events (tags_Contains: ...
[ {"node": {"name": "Live Show"}}, ]
assert
collection
graphene_django/filter/tests/test_array_field_contains_filter.py
test_array_field_contains_multiple
25
null
graphql-python/graphene-django
import pytest from django.test import Client from ...settings import graphene_settings from ...tests.test_types import with_local_registry from .. import GraphQLTestCase def test_graphql_test_case_imports_endpoint(): """ GraphQLTestCase class should import the default endpoint from settings file """ ...
graphene_settings.TESTING_ENDPOINT
assert
complex_expr
graphene_django/utils/tests/test_testing.py
test_graphql_test_case_imports_endpoint
54
null
graphql-python/graphene-django
import copy from django.db import models from pytest import raises from rest_framework import serializers import graphene from ..serializer_converter import convert_serializer_field from ..types import DictType def _get_type( rest_framework_field, is_input=True, convert_choices_to_enum=True, **kwargs ): # p...
DictType)
assert_*
variable
graphene_django/rest_framework/tests/test_field_converter.py
test_should_dict_convert_dict
187
null
graphql-python/graphene-django
from collections import namedtuple import pytest from django.db import models from django.utils.translation import gettext_lazy as _ from pytest import raises import graphene from graphene import NonNull from graphene.relay import ConnectionField, Node from graphene.types.datetime import Date, DateTime, Time from gra...
"UserType"
assert
string_literal
graphene_django/tests/test_converter.py
test_generate_v2_enum_name
428
null
graphql-python/graphene-django
from datetime import datetime import pytest from django_filters import ( FilterSet, rest_framework as filters, ) from graphene import ObjectType, Schema from graphene.relay import Node from graphene_django import DjangoObjectType from graphene_django.filter.tests.filters import ArticleFilter from graphene_dja...
[ {"node": {"name": "Brutus"}}, {"node": {"name": "Mimi"}}, {"node": {"name": "Jojo, the rabbit"}}, ]
assert
collection
graphene_django/filter/tests/test_in_filter.py
test_int_in_filter
226
null
graphql-python/graphene-django
import copy from django.db import models from pytest import raises from rest_framework import serializers import graphene from ..serializer_converter import convert_serializer_field from ..types import DictType def _get_type( rest_framework_field, is_input=True, convert_choices_to_enum=True, **kwargs ): # p...
graphene.Int)
assert_*
complex_expr
graphene_django/rest_framework/tests/test_field_converter.py
test_should_integer_convert_int
124
null
graphql-python/graphene-django
import pytest from ...compat import ArrayField, MissingType @pytest.mark.skipif(ArrayField is MissingType, reason="ArrayField should exist") def test_array_field_custom_filter(schema): query = """ query { events (tags_Len_In: 2) { edges { node { name ...
'Int cannot represent non-integer value: "12"'
assert
string_literal
graphene_django/filter/tests/test_array_field_custom_filter.py
test_array_field_custom_filter
171
null
graphql-python/graphene-django
import json from http import HTTPStatus from unittest.mock import patch import pytest from django.db import connection from .models import Pet def url_string(string="/graphql", **url_params): if url_params: string += "?" + urlencode(url_params) return string def batch_url_string(**url_params): ...
None
assert
none_literal
graphene_django/tests/test_views.py
test_model_form_mutation_multiple_creation_invalid_atomic_request
754
null
graphql-python/graphene-django
import json from unittest.mock import patch import pytest from django.utils.translation import gettext_lazy from ..utils import GraphQLTestCase, camelize, get_model_fields, get_reverse_fields from ..utils.testing import graphql_query from .models import APNewsReporter, CNNReporter, Film, Reporter def test_get_revers...
len(list(cnn_reporter_fields))
assert
func_call
graphene_django/tests/test_utils.py
test_get_reverse_fields_includes_proxied_models
27
null
graphql-python/graphene-django
import json from unittest.mock import patch import pytest from django.utils.translation import gettext_lazy from ..utils import GraphQLTestCase, camelize, get_model_fields, get_reverse_fields from ..utils.testing import graphql_query from .models import APNewsReporter, CNNReporter, Film, Reporter def client_query(cl...
{"data": {"test": "Hello World"}}
assert
collection
graphene_django/tests/test_utils.py
test_pytest_fixture_usage
100
null
graphql-python/graphene-django
import pytest from ...compat import ArrayField, MissingType @pytest.mark.skipif(ArrayField is MissingType, reason="ArrayField should exist") def test_array_field_len_filter(schema): query = """ query { events (tags_Len: 2) { edges { node { name ...
1
assert
numeric_literal
graphene_django/filter/tests/test_array_field_custom_filter.py
test_array_field_len_filter
70
null
graphql-python/graphene-django
import operator from functools import reduce import pytest from django.db.models import Q from django_filters import FilterSet import graphene from graphene.relay import Node from graphene_django import DjangoObjectType from graphene_django.tests.models import Article, Reporter from graphene_django.utils import DJANG...
[]
assert
collection
graphene_django/filter/tests/test_typed_filter.py
test_list_filters_work
182
null
graphql-python/graphene-django
from datetime import datetime import pytest from django_filters import ( FilterSet, rest_framework as filters, ) from graphene import ObjectType, Schema from graphene.relay import Node from graphene_django import DjangoObjectType from graphene_django.filter.tests.filters import ArticleFilter from graphene_dja...
[ {"node": {"name": "Brutus"}}, {"node": {"name": "Jojo, the rabbit"}}, ]
assert
collection
graphene_django/filter/tests/test_in_filter.py
test_string_in_filter
121
null
graphql-python/graphene-django
import pytest from ...compat import ArrayField, MissingType @pytest.mark.skipif(ArrayField is MissingType, reason="ArrayField should exist") def test_array_field_exact_empty_list(schema): """ Test exact filter on a array field of string. """ query = """ query { events (tags: []) { ...
[ {"node": {"name": "Speech"}}, ]
assert
collection
graphene_django/filter/tests/test_array_field_exact_filter.py
test_array_field_exact_empty_list
71
null
graphql-python/graphene-django
import datetime import re import pytest from django.db.models import Count, Prefetch from graphene import List, NonNull, ObjectType, Schema, String from ..fields import DjangoListField from ..types import DjangoObjectType from .models import ( Article as ArticleModel, Film as FilmModel, FilmDetails as Fi...
str(excinfo.value)
assert
func_call
graphene_django/tests/test_fields.py
test_only_django_object_types
TestDjangoListField
28
null
graphql-python/graphene-django
import datetime import re import pytest from django.db.models import Count, Prefetch from graphene import List, NonNull, ObjectType, Schema, String from ..fields import DjangoListField from ..types import DjangoObjectType from .models import ( Article as ArticleModel, Film as FilmModel, FilmDetails as Fi...
Human
assert
variable
graphene_django/tests/test_fields.py
test_only_import_paths
TestDjangoListField
37
null
graphql-python/graphene-django
import pytest import graphene from graphene.relay import Node from graphene_django import DjangoConnectionField, DjangoObjectType from ...tests.models import Reporter from ..middleware import DjangoDebugMiddleware from ..types import DjangoDebug def test_should_query_stack_trace(): class ReporterType(DjangoObjec...
"caught stack trace"
assert
string_literal
graphene_django/debug/tests/test_query.py
test_should_query_stack_trace
314
null
graphql-python/graphene-django
from collections import namedtuple import pytest from django.db import models from django.utils.translation import gettext_lazy as _ from pytest import raises import graphene from graphene import NonNull from graphene.relay import ConnectionField, Node from graphene.types.datetime import Date, DateTime, Time from gra...
Time)
assert_*
variable
graphene_django/tests/test_converter.py
test_should_time_convert_string
69
null
graphql-python/graphene-django
import pytest from ..data import initialize from ..schema import schema pytestmark = pytest.mark.django_db def test_correct_fetch_first_ship_rebels(): initialize() query = """ query RebelsShipsQuery { rebels { name, hero { name } ships(first: 1) { ...
expected
assert
variable
examples/starwars/tests/test_connections.py
test_correct_fetch_first_ship_rebels
37
null
graphql-python/graphene-django
from collections import namedtuple import pytest from django.db import models from django.utils.translation import gettext_lazy as _ from pytest import raises import graphene from graphene import NonNull from graphene.relay import ConnectionField, Node from graphene.types.datetime import Date, DateTime, Time from gra...
Date)
assert_*
variable
graphene_django/tests/test_converter.py
test_should_date_convert_string
65
null
graphql-python/graphene-django
import copy from django.db import models from pytest import raises from rest_framework import serializers import graphene from ..serializer_converter import convert_serializer_field from ..types import DictType def _get_type( rest_framework_field, is_input=True, convert_choices_to_enum=True, **kwargs ): # p...
graphene.List)
assert_*
complex_expr
graphene_django/rest_framework/tests/test_field_converter.py
test_should_list_convert_to_list
145
null
graphql-python/graphene-django
from django import forms from pytest import raises import graphene from graphene_django import DjangoObjectType from ...tests.models import CHOICES, Film, Reporter from ..types import DjangoFormInputObjectType THIS = CHOICES[0][0] THIS_ON_CLIENT_CONVERTED = "A_1" DOCUMENTARY = "do" DOCUMENTARY_ON_CLIENT_CONVERTED =...
1
assert
numeric_literal
graphene_django/forms/tests/test_djangoinputobject.py
test_mutation_with_modelform_djangoforminputtype
195
null
graphql-python/graphene-django
import pytest import graphene from graphene.relay import Node from graphene_django import DjangoConnectionField, DjangoObjectType from ...tests.models import Reporter from ..middleware import DjangoDebugMiddleware from ..types import DjangoDebug @pytest.mark.parametrize("max_limit", [None, 100]) def test_should_quer...
result.data["_debug"]["sql"][1]["rawSql"]
assert
complex_expr
graphene_django/debug/tests/test_query.py
test_should_query_nested_field
121
null
graphql-python/graphene-django
from collections import namedtuple import pytest from django.db import models from django.utils.translation import gettext_lazy as _ from pytest import raises import graphene from graphene import NonNull from graphene.relay import ConnectionField, Node from graphene.types.datetime import Date, DateTime, Time from gra...
JSONString)
assert_*
variable
graphene_django/tests/test_converter.py
test_should_postgres_hstore_convert_string
388
null
graphql-python/graphene-django
from collections import namedtuple import pytest from django.db import models from django.utils.translation import gettext_lazy as _ from pytest import raises import graphene from graphene import NonNull from graphene.relay import ConnectionField, Node from graphene.types.datetime import Date, DateTime, Time from gra...
"en"
assert
string_literal
graphene_django/tests/test_converter.py
test_field_with_choices_convert_enum
177
null
graphql-python/graphene-django
import warnings from collections import OrderedDict, defaultdict from textwrap import dedent from unittest.mock import patch import pytest from django.db import models from graphene import Connection, Field, Interface, ObjectType, Schema, String from graphene.relay import Node from .. import registry from ..filter i...
1
assert
numeric_literal
graphene_django/tests/test_types.py
test_django_get_node
67
null
graphql-python/graphene-django
from django import VERSION as DJANGO_VERSION, forms from pytest import raises from graphene import ( ID, UUID, Boolean, Date, DateTime, Decimal, Float, Int, List, NonNull, String, Time, ) from ..converter import convert_form_field def assert_conversion(django_field, gr...
String)
assert_*
variable
graphene_django/forms/tests/test_converter.py
test_should_char_convert_string
54
null
graphql-python/graphene-django
from django import VERSION as DJANGO_VERSION, forms from pytest import raises from graphene import ( ID, UUID, Boolean, Date, DateTime, Decimal, Float, Int, List, NonNull, String, Time, ) from ..converter import convert_form_field def assert_conversion(django_field, gr...
help_text
assert
variable
graphene_django/forms/tests/test_converter.py
assert_conversion
31
null
graphql-python/graphene-django
import base64 import datetime from unittest.mock import ANY, Mock import pytest from django.db import models from django.db.models import Q from django.utils.functional import SimpleLazyObject from graphql_relay import to_global_id from pytest import raises import graphene from graphene.relay import Node from ..comp...
expected
assert
variable
graphene_django/tests/test_query.py
test_should_query_well
124
null
graphql-python/graphene-django
from datetime import datetime import pytest from django_filters import ( FilterSet, rest_framework as filters, ) from graphene import ObjectType, Schema from graphene.relay import Node from graphene_django import DjangoObjectType from graphene_django.filter.tests.filters import ArticleFilter from graphene_dja...
[ {"node": {"email": "jean@bon.com"}}, {"node": {"email": "jane@doe.com"}}, ]
assert
collection
graphene_django/filter/tests/test_in_filter.py
test_enum_in_filter
425
null
graphql-python/graphene-django
from datetime import datetime import pytest from django_filters import ( FilterSet, rest_framework as filters, ) from graphene import ObjectType, Schema from graphene.relay import Node from graphene_django import DjangoObjectType from graphene_django.filter.tests.filters import ArticleFilter from graphene_dja...
[ {"node": {"email": "john@doe.com"}}, ]
assert
collection
graphene_django/filter/tests/test_in_filter.py
test_enum_in_filter
408
null
graphql-python/graphene-django
from django import forms from pytest import raises import graphene from graphene_django import DjangoObjectType from ...tests.models import CHOICES, Film, Reporter from ..types import DjangoFormInputObjectType THIS = CHOICES[0][0] THIS_ON_CLIENT_CONVERTED = "A_1" DOCUMENTARY = "do" DOCUMENTARY_ON_CLIENT_CONVERTED =...
graphene.ID
assert
complex_expr
graphene_django/forms/tests/test_djangoinputobject.py
test_type_custom_id_field
78
null
graphql-python/graphene-django
import pytest import graphene from graphene.relay import Node from graphene_django import DjangoConnectionField, DjangoObjectType from ...tests.models import Reporter from ..middleware import DjangoDebugMiddleware from ..types import DjangoDebug @pytest.mark.parametrize("max_limit", [None, 100]) def test_should_quer...
expected["reporter"]
assert
complex_expr
graphene_django/debug/tests/test_query.py
test_should_query_nested_field
127
null
graphql-python/graphene-django
import datetime import re import pytest from django.db.models import Count, Prefetch from graphene import List, NonNull, ObjectType, Schema, String from ..fields import DjangoListField from ..types import DjangoObjectType from .models import ( Article as ArticleModel, Film as FilmModel, FilmDetails as Fi...
{ "reporters": [ { "firstName": "Tara", "articles": [ {"headline": "Amazing news"}, {"headline": "Not so good news"}, ], }, {"firstName": "Debra", "articles": []}, ] }
assert
collection
graphene_django/tests/test_fields.py
test_nested_list_field
TestDjangoListField
200
null
graphql-python/graphene-django
import pytest from ..data import initialize from ..schema import schema pytestmark = pytest.mark.django_db def test_mutations(): initialize() query = """ mutation MyMutation { introduceShip(input:{clientMutationId:"abc", shipName: "Peter", factionId: "1"}) { ship { id n...
expected
assert
variable
examples/starwars/tests/test_mutation.py
test_mutations
53
null
graphql-python/graphene-django
import warnings from collections import OrderedDict, defaultdict from textwrap import dedent from unittest.mock import patch import pytest from django.db import models from graphene import Connection, Field, Interface, ObjectType, Schema, String from graphene.relay import Node from .. import registry from ..filter i...
AssertionError)
pytest.raises
variable
graphene_django/tests/test_types.py
test_django_objecttype_exclude_and_only
398
null
graphql-python/graphene-django
import datetime from pytest import raises from rest_framework import serializers from graphene import Field, ResolveInfo, String from graphene.types.inputobjecttype import InputObjectType from ...types import DjangoObjectType from ..models import ( MyFakeModel, MyFakeModelWithChoiceField, MyFakeModelWith...
String
assert
variable
graphene_django/rest_framework/tests/test_mutation.py
test_model_serializer_optional_fields
115
null
graphql-python/graphene-django
import json from http import HTTPStatus from unittest.mock import patch import pytest from django.db import connection from .models import Pet def url_string(string="/graphql", **url_params): if url_params: string += "?" + urlencode(url_params) return string def batch_url_string(**url_params): ...
1
assert
numeric_literal
graphene_django/tests/test_views.py
test_form_mutation_multiple_creation_invalid_non_atomic
712
null
graphql-python/graphene-django
import pytest from ...compat import ArrayField, MissingType @pytest.mark.skipif(ArrayField is MissingType, reason="ArrayField should exist") def test_array_field_len_filter(schema): query = """ query { events (tags_Len: 2) { edges { node { name ...
"Int cannot represent non-integer value: True"
assert
string_literal
graphene_django/filter/tests/test_array_field_custom_filter.py
test_array_field_len_filter
86
null
graphql-python/graphene-django
from django import forms from django.core.exceptions import ValidationError from pytest import raises from graphene import Field, ObjectType, Schema, String from graphene_django import DjangoObjectType from graphene_django.tests.forms import PetForm from graphene_django.tests.models import Pet from graphene_django.tes...
Pet
assert
variable
graphene_django/forms/tests/test_mutation.py
test_default_meta_fields
136
null
graphql-python/graphene-django
from django import VERSION as DJANGO_VERSION, forms from pytest import raises from graphene import ( ID, UUID, Boolean, Date, DateTime, Decimal, Float, Int, List, NonNull, String, Time, ) from ..converter import convert_form_field def assert_conversion(django_field, gr...
Float)
assert_*
variable
graphene_django/forms/tests/test_converter.py
test_should_float_convert_float
105
null
graphql-python/graphene-django
import json from http import HTTPStatus from unittest.mock import patch import pytest from django.db import connection from .models import Pet def url_string(string="/graphql", **url_params): if url_params: string += "?" + urlencode(url_params) return string def batch_url_string(**url_params): ...
0
assert
numeric_literal
graphene_django/tests/test_views.py
test_form_mutation_multiple_creation_invalid_atomic_request
604
null
graphql-python/graphene-django
import copy from django.db import models from pytest import raises from rest_framework import serializers import graphene from ..serializer_converter import convert_serializer_field from ..types import DictType def _get_type( rest_framework_field, is_input=True, convert_choices_to_enum=True, **kwargs ): # p...
graphene.String
assert
complex_expr
graphene_django/rest_framework/tests/test_field_converter.py
test_should_list_convert_to_list
155
null
graphql-python/graphene-django
import pytest import graphene from graphene.relay import Node from graphene_django import DjangoConnectionField, DjangoObjectType from ...tests.models import Reporter from ..middleware import DjangoDebugMiddleware from ..types import DjangoDebug @pytest.mark.parametrize("max_limit", [None, 100]) def test_should_quer...
5
assert
numeric_literal
graphene_django/debug/tests/test_query.py
test_should_query_nested_field
125
null
graphql-python/graphene-django
from collections import namedtuple import pytest from django.db import models from django.utils.translation import gettext_lazy as _ from pytest import raises import graphene from graphene import NonNull from graphene.relay import ConnectionField, Node from graphene.types.datetime import Date, DateTime, Time from gra...
BigInt)
assert_*
variable
graphene_django/tests/test_converter.py
test_should_big_integer_convert_big_int
141
null
graphql-python/graphene-django
import pytest from graphql_relay import to_global_id import graphene from graphene.relay import Node from ..types import DjangoObjectType from .models import Article, Film, FilmDetails, Reporter class TestShouldCallGetQuerySetOnForeignKeyNode: def setup_schema(self): class ReporterType(DjangoObjectType)...
"Not authorized to access reporters."
assert
string_literal
graphene_django/tests/test_get_queryset.py
test_get_queryset_called_on_node
TestShouldCallGetQuerySetOnForeignKeyNode
282
null
graphql-python/graphene-django
import datetime import re import pytest from django.db.models import Count, Prefetch from graphene import List, NonNull, ObjectType, Schema, String from ..fields import DjangoListField from ..types import DjangoObjectType from .models import ( Article as ArticleModel, Film as FilmModel, FilmDetails as Fi...
2
assert
numeric_literal
graphene_django/tests/test_fields.py
test_select_related_and_prefetch_related_are_respected
TestDjangoListField
704
null
graphql-python/graphene-django
import operator from functools import reduce import pytest from django.db.models import Q from django_filters import FilterSet import graphene from graphene.relay import Node from graphene_django import DjangoObjectType from graphene_django.tests.models import Article, Reporter from graphene_django.utils import DJANG...
[ {"node": {"headline": "C"}}, ]
assert
collection
graphene_django/filter/tests/test_typed_filter.py
test_typed_filters_work
129
null
graphql-python/graphene-django
from datetime import datetime from textwrap import dedent import pytest from django.db.models import TextField, Value from django.db.models.functions import Concat from graphene import Argument, Boolean, Decimal, Field, ObjectType, Schema, String from graphene.relay import Node from graphene_django import DjangoObjec...
args
assert
variable
graphene_django/filter/tests/test_fields.py
assert_orderable
75
null
graphql-python/graphene-django
import datetime import re import pytest from django.db.models import Count, Prefetch from graphene import List, NonNull, ObjectType, Schema, String from ..fields import DjangoListField from ..types import DjangoObjectType from .models import ( Article as ArticleModel, Film as FilmModel, FilmDetails as Fi...
{ "reporters": [{"firstName": "Tara"}, {"firstName": "Debra"}] }
assert
collection
graphene_django/tests/test_fields.py
test_list_field_default_queryset
TestDjangoListField
85
null
graphql-python/graphene-django
from django import forms from pytest import raises import graphene from graphene_django import DjangoObjectType from ...tests.models import CHOICES, Film, Reporter from ..types import DjangoFormInputObjectType THIS = CHOICES[0][0] THIS_ON_CLIENT_CONVERTED = "A_1" DOCUMENTARY = "do" DOCUMENTARY_ON_CLIENT_CONVERTED =...
"Dave"
assert
string_literal
graphene_django/forms/tests/test_djangoinputobject.py
test_mutation_with_modelform_djangoforminputtype
197
null
chonkie-inc/chonkie
from pathlib import Path from unittest.mock import mock_open, patch import pytest from chonkie.chef import TextChef from chonkie.types import Document class TestTextChef: def text_chef(self) -> TextChef: """Fixture that returns a TextChef instance.""" return TextChef() def sample_text(self)...
""
assert
string_literal
tests/chef/test_chef.py
test_empty_file_content
TestTextChef
193
null
chonkie-inc/chonkie
import uuid from unittest.mock import Mock, patch import pytest import chromadb from chonkie import ChromaHandshake from chonkie.handshakes.chroma import ChromaEmbeddingFunction from chonkie.types import Chunk pytestmark = pytest.mark.skipif(chromadb is None, reason="chromadb not installed") def mock_embeddings():...
chunk.end_index
assert
complex_expr
tests/handshakes/test_chroma_handshake.py
test_chroma_handshake_write_single_chunk
198
null
chonkie-inc/chonkie
import pytest from chonkie import Sentence def test_sentence_serialization_round_trip(): """Test Sentence to_dict / from_dict round-trip preserves all fields.""" sentence = Sentence(text="Ratatouille is a movie.", start_index=0, end_index=23, token_count=4) d = sentence.to_dict() restored = Sentence.f...
sentence.text
assert
complex_expr
tests/types/test_sentence.py
test_sentence_serialization_round_trip
90
null
chonkie-inc/chonkie
from unittest.mock import MagicMock, patch import pytest from chonkie import Chunk from chonkie.cloud.refineries.base import BaseRefinery from chonkie.cloud.refineries.embeddings import EmbeddingsRefinery from chonkie.cloud.refineries.overlap import OverlapRefinery def make_chunks(n: int = 3) -> list[Chunk]: """...
"suffix"
assert
string_literal
tests/cloud/test_cloud_refineries.py
test_overlap_refinery_refine_posts_correct_payload
155
null
chonkie-inc/chonkie
from chonkie.types.code import LanguageConfig, MergeRule, SplitRule def test_language_config_with_split_rules(): """LanguageConfig stores provided split rules.""" rules = [SplitRule(name="class", node_type="class_definition", body_child="class_body")] config = LanguageConfig(language="python", merge_rules=...
"class"
assert
string_literal
tests/types/test_code.py
test_language_config_with_split_rules
142
null
chonkie-inc/chonkie
from __future__ import annotations from pathlib import Path from unittest.mock import mock_open, patch import pytest from chonkie.chef import MarkdownChef from chonkie.types import MarkdownDocument class TestMarkdownChef: def markdown_chef(self) -> MarkdownChef: """Fixture that returns a MarkdownChef i...
2
assert
numeric_literal
tests/chef/test_markdown_chef.py
test_parse_markdown_with_code
TestMarkdownChef
138
null
chonkie-inc/chonkie
import os from unittest.mock import Mock, patch import pytest from pytest import MonkeyPatch from chonkie.cloud import SlumberChunker from chonkie.types import Chunk def mock_api_response(): """Mock successful API response.""" def _mock_response(text_input, chunk_count=1): if isinstance(text_input, ...
2
assert
numeric_literal
tests/cloud/test_cloud_slumber_chunker.py
test_cloud_slumber_chunker_long_text
229
null
chonkie-inc/chonkie
import contextlib import dataclasses from unittest.mock import patch import numpy as np import pytest from chonkie.embeddings.base import BaseEmbeddings from chonkie.embeddings.cloudflare import CloudflareEmbeddings from chonkie.embeddings.deepinfra import DeepInfraEmbeddings from chonkie.embeddings.mistral import Mi...
ptp.dimension
assert
complex_expr
tests/embeddings/test_new_providers.py
test_dimension
TestNewProviderEmbeddings
121
null
chonkie-inc/chonkie
from __future__ import annotations import pytest from chonkie import Chunk def test_chunk_getitem(): """Test Chunk __getitem__ slices the text.""" chunk = Chunk(text="hello", start_index=0, end_index=5, token_count=1) assert chunk[0] ==
"h"
assert
string_literal
tests/types/test_base.py
test_chunk_getitem
200
null
chonkie-inc/chonkie
import os from typing import List from unittest.mock import MagicMock, patch import numpy as np import pytest from tests.embeddings.utils import make_mock_catsu_client def mock_catsu_client(): return make_mock_catsu_client(dimension=1024, model_name="voyage-3") def embedding_model(mock_catsu_client): """Fix...
[]
assert
collection
tests/embeddings/test_catsu_embeddings.py
test_tokenizer_encode_warning
246
null
chonkie-inc/chonkie
from __future__ import annotations import pytest from chonkie import Chunk pytestmark = pytest.mark.skipif(not MEMCHUNK_AVAILABLE, reason="memchunk not installed") def sample_text() -> str: """Fixture that returns a sample text for testing the FastChunker.""" text = """According to all known laws of aviatio...
"▁"
assert
string_literal
tests/chunkers/test_fast_chunker.py
test_fast_chunker_initialization_with_pattern
94
null
chonkie-inc/chonkie
from chonkie.handshakes.utils import ADJECTIVES, NOUNS, VERBS, generate_random_collection_name def test_generate_name_parts_from_word_lists(): """Each part of the name belongs to the corresponding word list.""" # Run several times to reduce false-positive risk from random selection. for _ in range(20): ...
NOUNS
assert
variable
tests/handshakes/test_handshake_utils.py
test_generate_name_parts_from_word_lists
34
null
chonkie-inc/chonkie
import pytest from chonkie import CodeChunker from chonkie.types import Chunk def python_code() -> str: """Return a sample Python code snippet.""" return """ import os import sys def hello_world(name: str): \"\"\"Prints a greeting.\"\"\" print(f"Hello, {name}!") class MyClass: def __init__(self,...
js_code
assert
variable
tests/chunkers/test_code_chunker.py
test_code_chunker_chunking_javascript
153
null
chonkie-inc/chonkie
from unittest.mock import Mock, patch import pytest from chonkie.cloud import LateChunker from chonkie.types import Chunk def mock_api_response(): """Mock successful API response.""" def _mock_response(text_input, chunk_count=1): if isinstance(text_input, str): if not text_input.strip():...
5
assert
numeric_literal
tests/cloud/test_cloud_late_chunker.py
test_cloud_late_chunker_from_recipe
193
null
chonkie-inc/chonkie
import html import logging import os from pathlib import Path from unittest.mock import MagicMock, patch import pytest from chonkie.types import Chunk from chonkie.utils.viz import ( BODY_BACKGROUND_COLOR_DARK, BODY_BACKGROUND_COLOR_LIGHT, CONTENT_BACKGROUND_COLOR_DARK, CONTENT_BACKGROUND_COLOR_LIGHT,...
""
assert
string_literal
tests/test_viz.py
test_init_custom_list_theme
TestVisualizerInitialization
106
null
chonkie-inc/chonkie
from unittest.mock import Mock, patch import pytest from chonkie.cloud import TokenChunker from chonkie.types import Chunk def mock_api_response(): """Mock successful API response.""" def _mock_response(text_input, chunk_count=1): if isinstance(text_input, str): if not text_input.strip()...
"gpt2"
assert
string_literal
tests/cloud/test_cloud_token_chunker.py
test_cloud_token_chunker_initialization
77
null
chonkie-inc/chonkie
import pytest from chonkie import SemanticChunker from chonkie.embeddings import BaseEmbeddings, Model2VecEmbeddings from chonkie.types import Chunk def sample_text() -> str: """Sample text for testing the SemanticChunker.""" text = """The process of text chunking in RAG applications represents a delicate bal...
1
assert
numeric_literal
tests/chunkers/test_semantic_chunker.py
test_semantic_chunker_initialization
57
null
chonkie-inc/chonkie
import pytest from chonkie import CodeChunker from chonkie.types import Chunk def python_code() -> str: """Return a sample Python code snippet.""" return """ import os import sys def hello_world(name: str): \"\"\"Prints a greeting.\"\"\" print(f"Hello, {name}!") class MyClass: def __init__(self,...
len(python_code)
assert
func_call
tests/chunkers/test_code_chunker.py
test_code_chunker_indices_python
106
null