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 |
|---|---|---|---|---|---|---|---|---|---|
SmileyChris/django-countries | from django.db import models
from django.test import TestCase
from rest_framework import serializers
from django_countries.fields import Country, CountryField
from django_countries.serializers import CountryFieldMixin
from django_countries.tests.models import AllowNull
class TestNullWithUnique(TestCase):
def set... | 2) | self.assertEqual | numeric_literal | django_countries/tests/test_null_support.py | test_multiple_empty_strings_allowed_without_unique | TestNullWithUnique | 122 | null |
SmileyChris/django-countries | from django.test import TestCase
from django_countries import base, countries, data
class TestSettings(TestCase):
def setUp(self):
del countries.countries
def tearDown(self):
del countries.countries
def test_override_remove(self):
with self.settings(COUNTRIES_OVERRIDE={"AU": None... | countries) | self.assertNotIn | variable | django_countries/tests/test_settings.py | test_override_remove | TestSettings | 37 | null |
SmileyChris/django-countries | from django.db import models
from django.test import TestCase
from rest_framework import serializers
from django_countries.fields import Country, CountryField
from django_countries.serializers import CountryFieldMixin
from django_countries.tests.models import AllowNull
class TestSingleValueNullIsAllowed(TestCase):
... | []) | self.assertEqual | collection | django_countries/tests/test_null_support.py | test_single_null_field_no_error | TestSingleValueNullIsAllowed | 142 | null |
SmileyChris/django-countries | import pytest
from django.template import Context, Template
from django.test import TestCase
from django.utils import translation
from django_countries import countries
from django_countries.conf import settings
class TestCountriesTags(TestCase):
TEMPLATE_COUNTRY = Template(
"{% load countries %}{% get_co... | "Brazil") | self.assertEqual | string_literal | django_countries/tests/test_tags.py | test_country_name | TestCountriesTags | 27 | null |
SmileyChris/django-countries | import pickle
from unittest import mock
from unittest.case import skipUnless
import django
import pytest
from django.core import checks, validators
from django.core.files.temp import NamedTemporaryFile
from django.core.management import call_command
from django.db import models
from django.forms import Select
from dja... | 2) | self.assertEqual | numeric_literal | django_countries/tests/test_fields.py | test_len | TestCountryField | 226 | null |
SmileyChris/django-countries | from django.contrib.admin.utils import display_for_field
from django.test import TestCase
from django_countries.tests import models
class TestMultipleCountryAdminDisplay(TestCase):
def test_multiple_countries_descriptor_equality(self):
"""Test MultipleCountriesDescriptor equality comparisons."""
... | multi2.countries) | self.assertEqual | complex_expr | django_countries/tests/test_admin_display.py | test_multiple_countries_descriptor_equality | TestMultipleCountryAdminDisplay | 131 | null |
SmileyChris/django-countries | import inspect
import pytest
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from django.test.client import RequestFactory
from django_countries import countries, filters
from django_countries... | filterset.filters) | self.assertIn | complex_expr | django_countries/tests/test_admin_filters.py | test_django_filters_country_filter_with_empty_label | TestDjangoFiltersIntegration | 179 | null |
SmileyChris/django-countries | from django.db import models
from django.test import TestCase
from rest_framework import serializers
from django_countries.fields import Country, CountryField
from django_countries.serializers import CountryFieldMixin
from django_countries.tests.models import AllowNull
class TestMultipleNullAllowed(TestCase):
de... | result) | self.assertIsNone | variable | django_countries/tests/test_null_support.py | test_multiple_null_returns_none | TestMultipleNullAllowed | 180 | null |
SmileyChris/django-countries | from graphene.test import Client # type: ignore
from django_countries.tests.graphql.schema import schema
def test_country_type():
client = Client(schema)
executed = client.execute(
"""{ newZealand {code, name, iocCode, numeric, alpha3} }"""
)
returned_country = executed["data"]["newZealand"]
... | { "code": "NZ", "name": "New Zealand", "iocCode": "NZL", "numeric": 554, "alpha3": "NZL", } | assert | collection | django_countries/tests/graphql/test_country_type.py | test_country_type | 12 | null | |
SmileyChris/django-countries | from django.test import TestCase
from django_countries import base, countries, data
class TestSettings(TestCase):
def setUp(self):
del countries.countries
def tearDown(self):
del countries.countries
def test_override_replace(self):
with self.settings(COUNTRIES_OVERRIDE={"NZ": "Mi... | "Middle Earth") | self.assertEqual | string_literal | django_countries/tests/test_settings.py | test_override_replace | TestSettings | 33 | null |
SmileyChris/django-countries | from django.test import TestCase
from django_countries import base, countries, data
class TestSettings(TestCase):
def setUp(self):
del countries.countries
def tearDown(self):
del countries.countries
def test_override_complex(self):
with self.settings(
COUNTRIES_OVERRI... | "y") | self.assertEqual | string_literal | django_countries/tests/test_settings.py | test_override_complex | TestSettings | 27 | null |
SmileyChris/django-countries | import inspect
import pytest
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from django.test.client import RequestFactory
from django_countries import countries, filters
from django_countries... | ["country"]) | self.assertEqual | collection | django_countries/tests/test_admin_filters.py | test_autocomplete_fields_in_admin_config | TestAutocompleteFields | 121 | null |
SmileyChris/django-countries | from django.test import TestCase
from django_countries import base, countries, data
class TestSettings(TestCase):
def setUp(self):
del countries.countries
def tearDown(self):
del countries.countries
def test_common_names(self):
common_code, common_name = list(base.CountriesBase.C... | common_name) | self.assertEqual | variable | django_countries/tests/test_settings.py | test_common_names | TestSettings | 48 | null |
SmileyChris/django-countries | from django.contrib.admin.utils import display_for_field
from django.test import TestCase
from django_countries.tests import models
class TestMultipleCountryAdminDisplay(TestCase):
def test_display_for_field_with_list_display(self):
"""
Test that multiple country fields work in list_display.
... | str) | self.assertIsInstance | variable | django_countries/tests/test_admin_display.py | test_display_for_field_with_list_display | TestMultipleCountryAdminDisplay | 27 | null |
SmileyChris/django-countries | from django.test import TestCase
from django_countries import base, countries, data
class TestSettings(TestCase):
def setUp(self):
del countries.countries
def tearDown(self):
del countries.countries
def test_override_only(self):
with self.settings(COUNTRIES_ONLY={"AU": "Desert"})... | len(countries.countries) == 1) | self.assertTrue | func_call | django_countries/tests/test_settings.py | test_override_only | TestSettings | 42 | null |
SmileyChris/django-countries | from unittest import mock
from urllib import parse as urlparse
from django.forms.models import modelform_factory
from django.test import TestCase, override_settings
from django.utils import safestring
from django.utils.html import escape
from django_countries import countries, fields, widgets
from django_countries.co... | widgets.LazySelect) | self.assertIsInstance | complex_expr | django_countries/tests/test_widgets.py | test_is_default_widget | TestDefaultSelectWidget | 98 | null |
SmileyChris/django-countries | import pytest
from django.template import Context, Template
from django.test import TestCase
from django.utils import translation
from django_countries import countries
from django_countries.conf import settings
class TestCountriesTags(TestCase):
TEMPLATE_COUNTRY = Template(
"{% load countries %}{% get_co... | "XX") | self.assertEqual | string_literal | django_countries/tests/test_tags.py | test_wrong_code | TestCountriesTags | 37 | null |
SmileyChris/django-countries | import importlib.util
import pytest
from django.test import TestCase, override_settings
from rest_framework import serializers, views
from rest_framework.test import APIRequestFactory
from django_countries import Countries, countries
from django_countries.conf import settings
from django_countries.fields import Count... | "NV") | self.assertEqual | string_literal | django_countries/tests/test_drf.py | test_deserialize_by_name | TestDRF | 105 | null |
SmileyChris/django-countries | import pickle
from unittest import mock
from unittest.case import skipUnless
import django
import pytest
from django.core import checks, validators
from django.core.files.temp import NamedTemporaryFile
from django.core.management import call_command
from django.db import models
from django.forms import Select
from dja... | 1) | self.assertEqual | numeric_literal | django_countries/tests/test_fields.py | test_single | TestCountryMultiple | 530 | null |
SmileyChris/django-countries | from unittest import mock
from urllib import parse as urlparse
from django.forms.models import modelform_factory
from django.test import TestCase, override_settings
from django.utils import safestring
from django.utils.html import escape
from django_countries import countries, fields, widgets
from django_countries.co... | widgets.CountrySelectWidget) | self.assertNotIsInstance | complex_expr | django_countries/tests/test_widgets.py | test_is_default_widget | TestDefaultSelectWidget | 97 | null |
SmileyChris/django-countries | from django.db import models
from django.test import TestCase
from rest_framework import serializers
from django_countries.fields import Country, CountryField
from django_countries.serializers import CountryFieldMixin
from django_countries.tests.models import AllowNull
class TestNullWithUnique(TestCase):
def set... | country2) | self.assertFalse | variable | django_countries/tests/test_null_support.py | test_multiple_nulls_allowed | TestNullWithUnique | 110 | null |
SmileyChris/django-countries | import importlib.util
import pytest
from django.test import TestCase, override_settings
from rest_framework import serializers, views
from rest_framework.test import APIRequestFactory
from django_countries import Countries, countries
from django_countries.conf import settings
from django_countries.fields import Count... | "DE") | self.assertEqual | string_literal | django_countries/tests/test_drf.py | test_deserialize_by_name_localized_french | TestDRF | 176 | null |
SmileyChris/django-countries | from django.contrib.admin.utils import display_for_field
from django.test import TestCase
from django_countries.tests import models
class TestMultipleCountryAdminDisplay(TestCase):
def test_multiple_countries_descriptor_list_behavior(self):
"""Test that MultipleCountriesDescriptor acts like a list."""
... | "AU") | self.assertEqual | string_literal | django_countries/tests/test_admin_display.py | test_multiple_countries_descriptor_list_behavior | TestMultipleCountryAdminDisplay | 99 | null |
SmileyChris/django-countries | from django.contrib.admin.utils import display_for_field
from django.test import TestCase
from django_countries.tests import models
class TestMultipleCountryAdminDisplay(TestCase):
def test_multiple_countries_descriptor_list_behavior(self):
"""Test that MultipleCountriesDescriptor acts like a list."""
... | 3) | self.assertEqual | numeric_literal | django_countries/tests/test_admin_display.py | test_multiple_countries_descriptor_list_behavior | TestMultipleCountryAdminDisplay | 102 | null |
SmileyChris/django-countries | import pytest
from django.test import TestCase
from django.utils import translation
from django_countries import Countries, CountryTuple, countries
from django_countries.conf import settings
from django_countries.tests import custom_countries
EXPECTED_COUNTRY_COUNT = 249
FIRST_THREE_COUNTRIES = [
("AF", "Afghanis... | 900) | self.assertEqual | numeric_literal | django_countries/tests/test_countries.py | test_numeric_override | TestCountriesObject | 141 | null |
SmileyChris/django-countries | from django.db import models
from django.test import TestCase
from rest_framework import serializers
from django_countries.fields import Country, CountryField
from django_countries.serializers import CountryFieldMixin
from django_countries.tests.models import AllowNull
class TestMultipleNullAllowed(TestCase):
de... | 0) | self.assertEqual | numeric_literal | django_countries/tests/test_null_support.py | test_multiple_empty_string_vs_null | TestMultipleNullAllowed | 203 | null |
SmileyChris/django-countries | import pytest
from django.test import TestCase
from django.utils import translation
from django_countries import Countries, countries, countries_context
from django_countries.conf import settings
class TestCountriesContext(BaseTest):
def test_context_with_only(self):
"""Test that context can override 'on... | 10) | self.assertGreater | numeric_literal | django_countries/tests/test_dynamic_first.py | test_context_with_only | TestCountriesContext | 262 | null |
SmileyChris/django-countries | from django.contrib.admin.utils import display_for_field
from django.test import TestCase
from django_countries.tests import models
class TestMultipleCountryAdminDisplay(TestCase):
def test_single_country_field_flatchoices(self):
"""Test that single (non-multiple) fields still use flatchoices normally.""... | flatchoices) | self.assertIsNotNone | variable | django_countries/tests/test_admin_display.py | test_single_country_field_flatchoices | TestMultipleCountryAdminDisplay | 145 | null |
SmileyChris/django-countries | from django.contrib.admin.utils import display_for_field
from django.test import TestCase
from django_countries.tests import models
class TestMultipleCountryAdminDisplay(TestCase):
def test_value_from_object_returns_displayable_descriptor(self):
"""
Test that value_from_object returns a MultipleC... | str_value) | self.assertIn | variable | django_countries/tests/test_admin_display.py | test_value_from_object_returns_displayable_descriptor | TestMultipleCountryAdminDisplay | 83 | null |
SmileyChris/django-countries | import inspect
import pytest
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from django.test.client import RequestFactory
from django_countries import countries, filters
from django_countries... | "Any Country") | self.assertEqual | string_literal | django_countries/tests/test_admin_filters.py | test_django_filters_country_filter_with_empty_label | TestDjangoFiltersIntegration | 181 | null |
SmileyChris/django-countries | from django.contrib.admin.utils import display_for_field
from django.test import TestCase
from django_countries.tests import models
class TestMultipleCountryAdminDisplay(TestCase):
def test_multiple_countries_descriptor_empty_behavior(self):
"""Test MultipleCountriesDescriptor with empty list."""
... | 0) | self.assertEqual | numeric_literal | django_countries/tests/test_admin_display.py | test_multiple_countries_descriptor_empty_behavior | TestMultipleCountryAdminDisplay | 122 | null |
SmileyChris/django-countries | import pytest
from django.test import TestCase
from django.utils import translation
from django_countries import Countries, countries, countries_context
from django_countries.conf import settings
class TestCountriesContext(BaseTest):
def test_context_override(self):
"""Test that context manager overrides... | "DE") | self.assertEqual | string_literal | django_countries/tests/test_dynamic_first.py | test_context_override | TestCountriesContext | 207 | null |
SmileyChris/django-countries | import pytest
from django.test import TestCase
from django.utils import translation
from django_countries import Countries, countries, countries_context
from django_countries.conf import settings
class TestCountriesContext(BaseTest):
def test_context_with_first_repeat(self):
"""Test that context can over... | 1) | self.assertEqual | numeric_literal | django_countries/tests/test_dynamic_first.py | test_context_with_first_repeat | TestCountriesContext | 296 | null |
SmileyChris/django-countries | import pytest
from django.test import TestCase
from django.utils import translation
from django_countries import Countries, countries, countries_context
from django_countries.conf import settings
class TestCountriesContext(BaseTest):
def test_context_override(self):
"""Test that context manager overrides... | "US") | self.assertEqual | string_literal | django_countries/tests/test_dynamic_first.py | test_context_override | TestCountriesContext | 201 | null |
SmileyChris/django-countries | from graphene.test import Client # type: ignore
from django_countries.tests.graphql.schema import schema
from django_countries.tests.models import Person
def test_country_type(db):
Person.objects.create(name="Skippy", country="AU")
client = Client(schema)
executed = client.execute("""{ people { name, cou... | {"name": "Skippy", "country": {"name": "Australia"}} | assert | collection | django_countries/tests/graphql/test_model.py | test_country_type | 12 | null | |
SmileyChris/django-countries | import inspect
import pytest
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from django.test.client import RequestFactory
from django_countries import countries, filters
from django_countries... | list(models.Person.objects.all())) | self.assertEqual | func_call | django_countries/tests/test_admin_filters.py | test_filter_none | TestCountryFilter | 60 | null |
SmileyChris/django-countries | from django.test import TestCase
from django_countries import base, countries, data
class TestSettings(TestCase):
def setUp(self):
del countries.countries
def tearDown(self):
del countries.countries
def test_override_additional(self):
with self.settings(COUNTRIES_OVERRIDE={"XX": ... | "New") | self.assertEqual | string_literal | django_countries/tests/test_settings.py | test_override_additional | TestSettings | 15 | null |
SmileyChris/django-countries | from django.db import models
from django.test import TestCase
from rest_framework import serializers
from django_countries.fields import Country, CountryField
from django_countries.serializers import CountryFieldMixin
from django_countries.tests.models import AllowNull
class TestNullBehavior(TestCase):
def test_... | Country) | self.assertIsInstance | variable | django_countries/tests/test_null_support.py | test_null_field_returns_country_with_none_code | TestNullBehavior | 32 | null |
SmileyChris/django-countries | import inspect
import pytest
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from django.test.client import RequestFactory
from django_countries import countries, filters
from django_countries... | list(expected)) | self.assertCountEqual | func_call | django_countries/tests/test_admin_filters.py | test_filter_country | TestMultiCountryFilter | 257 | null |
SmileyChris/django-countries | import pytest
from django.test import TestCase
from django.utils import translation
from django_countries import Countries, countries, countries_context
from django_countries.conf import settings
class TestCountriesContext(BaseTest):
def test_context_with_only(self):
"""Test that context can override 'on... | 3) | self.assertEqual | numeric_literal | django_countries/tests/test_dynamic_first.py | test_context_with_only | TestCountriesContext | 267 | null |
SmileyChris/django-countries | import importlib.util
import pytest
from django.test import TestCase, override_settings
from rest_framework import serializers, views
from rest_framework.test import APIRequestFactory
from django_countries import Countries, countries
from django_countries.conf import settings
from django_countries.fields import Count... | "GB") | self.assertEqual | string_literal | django_countries/tests/test_drf.py | test_deserialize_country_dict | TestDRF | 93 | null |
SmileyChris/django-countries | from unittest import mock
from urllib import parse as urlparse
from django.forms.models import modelform_factory
from django.test import TestCase, override_settings
from django.utils import safestring
from django.utils.html import escape
from django_countries import countries, fields, widgets
from django_countries.co... | widget.use_required_attribute(form.fields["country"])) | self.assertTrue | func_call | django_countries/tests/test_widgets.py | test_lazy_select_use_required_attribute_when_hidden | TestDefaultSelectWidget | 156 | null |
SmileyChris/django-countries | from django.db import models
from django.test import TestCase
from rest_framework import serializers
from django_countries.fields import Country, CountryField
from django_countries.serializers import CountryFieldMixin
from django_countries.tests.models import AllowNull
class TestNullBehavior(TestCase):
def test_... | "NZ") | self.assertEqual | string_literal | django_countries/tests/test_null_support.py | test_null_field_with_value_returns_country | TestNullBehavior | 45 | null |
SmileyChris/django-countries | from django.test import TestCase
from django_countries import base, countries, data
class TestSettings(TestCase):
def setUp(self):
del countries.countries
def tearDown(self):
del countries.countries
def test_common_names(self):
common_code, common_name = list(base.CountriesBase.C... | official_name) | self.assertEqual | variable | django_countries/tests/test_settings.py | test_common_names | TestSettings | 54 | null |
SmileyChris/django-countries | from django.contrib.admin.utils import display_for_field
from django.test import TestCase
from django_countries.tests import models
class TestMultipleCountryAdminDisplay(TestCase):
def test_value_from_object_returns_displayable_descriptor(self):
"""
Test that value_from_object returns a MultipleC... | 2) | self.assertEqual | numeric_literal | django_countries/tests/test_admin_display.py | test_value_from_object_returns_displayable_descriptor | TestMultipleCountryAdminDisplay | 79 | null |
SmileyChris/django-countries | from django.test import TestCase
from django_countries import base, countries, data
class TestSettings(TestCase):
def setUp(self):
del countries.countries
def tearDown(self):
del countries.countries
def test_override_complex(self):
with self.settings(
COUNTRIES_OVERRI... | 950) | self.assertEqual | numeric_literal | django_countries/tests/test_settings.py | test_override_complex | TestSettings | 29 | null |
SmileyChris/django-countries | import pytest
from django.test import TestCase
from django.utils import translation
from django_countries import Countries, CountryTuple, countries
from django_countries.conf import settings
from django_countries.tests import custom_countries
EXPECTED_COUNTRY_COUNT = 249
FIRST_THREE_COUNTRIES = [
("AF", "Afghanis... | 5) | self.assertEqual | numeric_literal | django_countries/tests/test_countries.py | test_countries_slice | TestCountriesObject | 66 | null |
SmileyChris/django-countries | import importlib.util
import pytest
from django.test import TestCase, override_settings
from rest_framework import serializers, views
from rest_framework.test import APIRequestFactory
from django_countries import Countries, countries
from django_countries.conf import settings
from django_countries.fields import Count... | 554) | self.assertEqual | numeric_literal | django_countries/tests/test_drf.py | test_country_dict_with_numeric_key | TestCountryDictCustomization | 225 | null |
SmileyChris/django-countries | import pickle
from unittest import mock
from unittest.case import skipUnless
import django
import pytest
from django.core import checks, validators
from django.core.files.temp import NamedTemporaryFile
from django.core.management import call_command
from django.db import models
from django.forms import Select
from dja... | "") | self.assertEqual | string_literal | django_countries/tests/test_fields.py | test_unicode_flag_blank | TestCountryField | 85 | null |
SmileyChris/django-countries | import importlib.util
import pytest
from django.test import TestCase, override_settings
from rest_framework import serializers, views
from rest_framework.test import APIRequestFactory
from django_countries import Countries, countries
from django_countries.conf import settings
from django_countries.fields import Count... | "🇺🇸") | self.assertEqual | string_literal | django_countries/tests/test_drf.py | test_country_dict_with_all_keys | TestCountryDictCustomization | 255 | null |
SmileyChris/django-countries | from unittest import mock
from urllib import parse as urlparse
from django.forms.models import modelform_factory
from django.test import TestCase, override_settings
from django.utils import safestring
from django.utils.html import escape
from django_countries import countries, fields, widgets
from django_countries.co... | html) | self.assertIn | variable | django_countries/tests/test_widgets.py | test_render_contains_flag_url | TestCountrySelectWidget | 37 | null |
SmileyChris/django-countries | from unittest import mock
from urllib import parse as urlparse
from django.forms.models import modelform_factory
from django.test import TestCase, override_settings
from django.utils import safestring
from django.utils.html import escape
from django_countries import countries, fields, widgets
from django_countries.co... | rendered) | self.assertIn | variable | django_countries/tests/test_widgets.py | test_required_attribute | TestCountrySelectWidget | 74 | null |
SmileyChris/django-countries | from unittest import mock
from urllib import parse as urlparse
from django.forms.models import modelform_factory
from django.test import TestCase, override_settings
from django.utils import safestring
from django.utils.html import escape
from django_countries import countries, fields, widgets
from django_countries.co... | isinstance(output, safestring.SafeData)) | self.assertTrue | func_call | django_countries/tests/test_widgets.py | test_render_escaping | TestCountrySelectWidget | 63 | null |
SmileyChris/django-countries | import inspect
import pytest
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from django.test.client import RequestFactory
from django_countries import countries, filters
from django_countries... | "Alice") | self.assertEqual | string_literal | django_countries/tests/test_admin_filters.py | test_django_filters_country_filter_basic | TestDjangoFiltersIntegration | 163 | null |
SmileyChris/django-countries | import importlib.util
import pytest
from django.test import TestCase, override_settings
from rest_framework import serializers, views
from rest_framework.test import APIRequestFactory
from django_countries import Countries, countries
from django_countries.conf import settings
from django_countries.fields import Count... | 840) | self.assertEqual | numeric_literal | django_countries/tests/test_drf.py | test_country_dict_with_all_keys | TestCountryDictCustomization | 254 | null |
SmileyChris/django-countries | import pickle
from unittest import mock
from unittest.case import skipUnless
import django
import pytest
from django.core import checks, validators
from django.core.files.temp import NamedTemporaryFile
from django.core.management import call_command
from django.db import models
from django.forms import Select
from dja... | []) | self.assertEqual | collection | django_countries/tests/test_fields.py | test_exact | TestCountryField | 292 | null |
SmileyChris/django-countries | import pytest
from django.test import TestCase
from django.utils import translation
from django_countries import Countries, CountryTuple, countries
from django_countries.conf import settings
from django_countries.tests import custom_countries
EXPECTED_COUNTRY_COUNT = 249
FIRST_THREE_COUNTRIES = [
("AF", "Afghanis... | 2) | self.assertEqual | numeric_literal | django_countries/tests/test_countries.py | test_countries_limit | TestCountriesCustom | 564 | null |
SmileyChris/django-countries | import inspect
import pytest
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from django.test.client import RequestFactory
from django_countries import countries, filters
from django_countries... | country_codes) | self.assertIn | variable | django_countries/tests/test_admin_filters.py | test_django_filters_country_filter_has_choices | TestDjangoFiltersIntegration | 201 | null |
SmileyChris/django-countries | from django.test import TestCase
from django_countries import base, countries, data
class TestSettings(TestCase):
def setUp(self):
del countries.countries
def tearDown(self):
del countries.countries
def test_override_complex(self):
with self.settings(
COUNTRIES_OVERRI... | "") | self.assertEqual | string_literal | django_countries/tests/test_settings.py | test_override_complex | TestSettings | 28 | null |
SmileyChris/django-countries | from django.contrib.admin.utils import display_for_field
from django.test import TestCase
from django_countries.tests import models
class TestMultipleCountryAdminDisplay(TestCase):
def test_display_for_field_with_list_display(self):
"""
Test that multiple country fields work in list_display.
... | "-") | self.assertNotEqual | string_literal | django_countries/tests/test_admin_display.py | test_display_for_field_with_list_display | TestMultipleCountryAdminDisplay | 28 | null |
SmileyChris/django-countries | from django.db import models
from django.test import TestCase
from rest_framework import serializers
from django_countries.fields import Country, CountryField
from django_countries.serializers import CountryFieldMixin
from django_countries.tests.models import AllowNull
class TestNullWithUnique(TestCase):
def set... | country1) | self.assertFalse | variable | django_countries/tests/test_null_support.py | test_multiple_nulls_allowed | TestNullWithUnique | 109 | null |
SmileyChris/django-countries | import importlib.util
import pytest
from django.test import TestCase, override_settings
from rest_framework import serializers, views
from rest_framework.test import APIRequestFactory
from django_countries import Countries, countries
from django_countries.conf import settings
from django_countries.fields import Count... | 2) | self.assertEqual | numeric_literal | django_countries/tests/test_drf.py | test_mixin_with_multiple_field_country_dict | TestCountryFieldMixinExtraKwargs | 452 | null |
SmileyChris/django-countries | from django.test import TestCase
from django_countries import base, countries, data
class TestSettings(TestCase):
def setUp(self):
del countries.countries
def tearDown(self):
del countries.countries
def test_override_only(self):
with self.settings(COUNTRIES_ONLY={"AU": "Desert"})... | "Desert") | self.assertEqual | string_literal | django_countries/tests/test_settings.py | test_override_only | TestSettings | 44 | null |
SmileyChris/django-countries | from django.contrib.admin.utils import display_for_field
from django.test import TestCase
from django_countries.tests import models
class TestMultipleCountryAdminDisplay(TestCase):
def test_multiple_countries_descriptor_empty_behavior(self):
"""Test MultipleCountriesDescriptor with empty list."""
... | "") | self.assertEqual | string_literal | django_countries/tests/test_admin_display.py | test_multiple_countries_descriptor_empty_behavior | TestMultipleCountryAdminDisplay | 116 | null |
SmileyChris/django-countries | from unittest import mock
from urllib import parse as urlparse
from django.forms.models import modelform_factory
from django.test import TestCase, override_settings
from django.utils import safestring
from django.utils.html import escape
from django_countries import countries, fields, widgets
from django_countries.co... | isinstance(widget, widgets.CountrySelectWidget)) | self.assertFalse | func_call | django_countries/tests/test_widgets.py | test_not_default_widget | TestCountrySelectWidget | 31 | null |
SmileyChris/django-countries | import pytest
from django.template import Context, Template
from django.test import TestCase
from django.utils import translation
from django_countries import countries
from django_countries.conf import settings
class TestCountriesTags(TestCase):
TEMPLATE_COUNTRY = Template(
"{% load countries %}{% get_co... | "") | self.assertEqual | string_literal | django_countries/tests/test_tags.py | test_wrong_code | TestCountriesTags | 40 | null |
SmileyChris/django-countries | from unittest import mock
from urllib import parse as urlparse
from django.forms.models import modelform_factory
from django.test import TestCase, override_settings
from django.utils import safestring
from django.utils.html import escape
from django_countries import countries, fields, widgets
from django_countries.co... | rendered_first_tag) | self.assertIn | variable | django_countries/tests/test_widgets.py | test_required_attribute | TestDefaultSelectWidget | 105 | null |
SmileyChris/django-countries | import inspect
import pytest
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from django.test.client import RequestFactory
from django_countries import countries, filters
from django_countries... | 3) | self.assertEqual | numeric_literal | django_countries/tests/test_admin_filters.py | test_django_filters_country_filter_no_filter_returns_all | TestDjangoFiltersIntegration | 218 | null |
SmileyChris/django-countries | import inspect
import pytest
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from django.test.client import RequestFactory
from django_countries import countries, filters
from django_countries... | 1) | self.assertEqual | numeric_literal | django_countries/tests/test_admin_filters.py | test_django_filters_country_filter_basic | TestDjangoFiltersIntegration | 162 | null |
SmileyChris/django-countries | from django.db import models
from django.test import TestCase
from rest_framework import serializers
from django_countries.fields import Country, CountryField
from django_countries.serializers import CountryFieldMixin
from django_countries.tests.models import AllowNull
class TestNullBehavior(TestCase):
def test_... | obj.country) | self.assertFalse | complex_expr | django_countries/tests/test_null_support.py | test_null_field_returns_country_with_none_code | TestNullBehavior | 35 | null |
SmileyChris/django-countries | import importlib.util
import pytest
from django.test import TestCase, override_settings
from rest_framework import serializers, views
from rest_framework.test import APIRequestFactory
from django_countries import Countries, countries
from django_countries.conf import settings
from django_countries.fields import Count... | "US") | self.assertEqual | string_literal | django_countries/tests/test_drf.py | test_deserialize | TestDRF | 82 | null |
qwertyquerty/pypresence | import asyncio
import json
import struct
import sys
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pypresence.baseclient import BaseClient
from pypresence.exceptions import (
ConnectionTimeout,
InvalidArgument,
InvalidID,
InvalidPipe,
PipeClosed,
PyPresenceException,
R... | False | assert | bool_literal | tests/test_baseclient.py | test_init_basic | TestBaseClientInit | 32 | null |
qwertyquerty/pypresence | import json
import struct
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pypresence import AioPresence, Presence
from pypresence.types import ActivityType
class TestPresenceURLFeatures:
@patch("pypresence.baseclient.BaseClient.read_output")
def test_update_with_small_url(self, mock_read... | "small_key" | assert | string_literal | tests/test_presence.py | test_update_with_small_url | TestPresenceURLFeatures | 364 | null |
qwertyquerty/pypresence | import pytest
from pypresence.exceptions import (
ConnectionTimeout,
DiscordError,
DiscordNotFound,
InvalidArgument,
InvalidID,
InvalidPipe,
PipeClosed,
PyPresenceException,
ResponseTimeout,
ServerError,
)
class TestExceptions:
def test_exceptions_can_be_raised_and_caught(... | PipeClosed) | pytest.raises | variable | tests/test_exceptions.py | test_exceptions_can_be_raised_and_caught | TestExceptions | 52 | null |
qwertyquerty/pypresence | import asyncio
import json
import struct
import sys
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pypresence.baseclient import BaseClient
from pypresence.exceptions import (
ConnectionTimeout,
InvalidArgument,
InvalidID,
InvalidPipe,
PipeClosed,
PyPresenceException,
R... | new_loop | assert | variable | tests/test_baseclient.py | test_update_event_loop | TestBaseClientEventLoop | 359 | null |
qwertyquerty/pypresence | from pypresence.types import ActivityType, StatusDisplayType
class TestActivityType:
def test_activity_type_names(self):
"""Test ActivityType names"""
assert ActivityType.PLAYING.name == "PLAYING"
# STREAMING not implemented in Discord
assert ActivityType.LISTENING.name == "LISTENI... | "WATCHING" | assert | string_literal | tests/test_types.py | test_activity_type_names | TestActivityType | 30 | null |
qwertyquerty/pypresence | import json
import struct
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pypresence import AioPresence, Presence
from pypresence.types import ActivityType
class TestPresenceUpdate:
@patch("pypresence.baseclient.BaseClient.read_output")
def test_update_basic(self, mock_read_output, clien... | "SET_ACTIVITY" | assert | string_literal | tests/test_presence.py | test_update_basic | TestPresenceUpdate | 64 | null |
qwertyquerty/pypresence | import asyncio
import json
import struct
import sys
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pypresence.baseclient import BaseClient
from pypresence.exceptions import (
ConnectionTimeout,
InvalidArgument,
InvalidID,
InvalidPipe,
PipeClosed,
PyPresenceException,
R... | error_handler | assert | variable | tests/test_baseclient.py | test_init_with_valid_sync_handler | TestBaseClientInit | 75 | null |
qwertyquerty/pypresence | import json
import struct
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pypresence import AioPresence, Presence
from pypresence.types import ActivityType
class TestPresenceInit:
def test_presence_init_basic(self, client_id):
"""Test basic Presence initialization"""
presence... | False | assert | bool_literal | tests/test_presence.py | test_presence_init_basic | TestPresenceInit | 21 | null |
qwertyquerty/pypresence | import asyncio
import sys
import pytest
from pypresence.utils import get_event_loop, remove_none
class TestRemoveNone:
def test_removes_none_from_nested_dict(self):
"""Test removing None from nested dictionary"""
d = {
"level1": {
"keep": "this",
"remo... | 123 | assert | numeric_literal | tests/test_utils.py | test_removes_none_from_nested_dict | TestRemoveNone | 40 | null |
qwertyquerty/pypresence | import asyncio
import sys
import pytest
from pypresence.utils import get_event_loop, remove_none
class TestRemoveNone:
def test_preserves_falsy_non_none_values(self):
"""Test that other falsy values (0, False, '') are preserved"""
d = {
"zero": 0,
"false": False,
... | False | assert | bool_literal | tests/test_utils.py | test_preserves_falsy_non_none_values | TestRemoveNone | 62 | null |
qwertyquerty/pypresence | import asyncio
import json
import struct
import sys
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pypresence.baseclient import BaseClient
from pypresence.exceptions import (
ConnectionTimeout,
InvalidArgument,
InvalidID,
InvalidPipe,
PipeClosed,
PyPresenceException,
R... | InvalidPipe) | pytest.raises | variable | tests/test_baseclient.py | test_handshake_discord_not_found | TestBaseClientHandshake | 251 | null |
qwertyquerty/pypresence | import json
import struct
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pypresence import AioPresence, Presence
from pypresence.types import ActivityType
class TestPresenceUpdate:
@patch("pypresence.baseclient.BaseClient.read_output")
def test_update_basic(self, mock_read_output, clien... | "Testing" | assert | string_literal | tests/test_presence.py | test_update_basic | TestPresenceUpdate | 65 | null |
qwertyquerty/pypresence | import json
import os
from pypresence.payloads import Payload
from pypresence.types import ActivityType, StatusDisplayType
class TestPayloadGeneration:
def test_payload_removes_none_values(self):
"""Test that None values are removed by default"""
data = {
"cmd": "TEST",
"a... | 1 | assert | numeric_literal | tests/test_payloads.py | test_payload_removes_none_values | TestPayloadGeneration | 36 | null |
qwertyquerty/pypresence | import pytest
from pypresence.exceptions import (
ConnectionTimeout,
DiscordError,
DiscordNotFound,
InvalidArgument,
InvalidID,
InvalidPipe,
PipeClosed,
PyPresenceException,
ResponseTimeout,
ServerError,
)
class TestExceptions:
def test_exceptions_can_be_raised_and_caught(... | DiscordNotFound) | pytest.raises | variable | tests/test_exceptions.py | test_exceptions_can_be_raised_and_caught | TestExceptions | 61 | null |
qwertyquerty/pypresence | import asyncio
import sys
import pytest
from pypresence.utils import get_event_loop, remove_none
class TestRemoveNone:
def test_preserves_falsy_non_none_values(self):
"""Test that other falsy values (0, False, '') are preserved"""
d = {
"zero": 0,
"false": False,
... | "" | assert | string_literal | tests/test_utils.py | test_preserves_falsy_non_none_values | TestRemoveNone | 63 | null |
qwertyquerty/pypresence | import json
import os
from pypresence.payloads import Payload
from pypresence.types import ActivityType, StatusDisplayType
class TestPayloadGeneration:
def test_payload_str_is_valid_json(self):
"""Test that __str__ returns valid JSON"""
data = {"cmd": "TEST", "value": 123}
payload = Paylo... | 123 | assert | numeric_literal | tests/test_payloads.py | test_payload_str_is_valid_json | TestPayloadGeneration | 47 | null |
qwertyquerty/pypresence | from pypresence.types import ActivityType, StatusDisplayType
class TestActivityType:
def test_activity_type_names(self):
"""Test ActivityType names"""
assert ActivityType.PLAYING.name == "PLAYING"
# STREAMING not implemented in Discord
assert ActivityType.LISTENING.name == "LISTENI... | "COMPETING" | assert | string_literal | tests/test_types.py | test_activity_type_names | TestActivityType | 31 | null |
qwertyquerty/pypresence | import json
import struct
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pypresence import AioPresence, Presence
from pypresence.types import ActivityType
class TestPresenceInit:
def test_presence_init_with_custom_timeouts(self, client_id):
"""Test Presence with custom timeouts"""
... | 60 | assert | numeric_literal | tests/test_presence.py | test_presence_init_with_custom_timeouts | TestPresenceInit | 29 | null |
qwertyquerty/pypresence | import json
import struct
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pypresence import AioPresence, Presence
from pypresence.types import ActivityType
class TestPresenceInit:
def test_presence_init_with_custom_timeouts(self, client_id):
"""Test Presence with custom timeouts"""
... | 20 | assert | numeric_literal | tests/test_presence.py | test_presence_init_with_custom_timeouts | TestPresenceInit | 30 | null |
qwertyquerty/pypresence | import pytest
from pypresence.exceptions import (
ConnectionTimeout,
DiscordError,
DiscordNotFound,
InvalidArgument,
InvalidID,
InvalidPipe,
PipeClosed,
PyPresenceException,
ResponseTimeout,
ServerError,
)
class TestExceptions:
def test_exceptions_can_be_raised_and_caught(... | InvalidPipe) | pytest.raises | variable | tests/test_exceptions.py | test_exceptions_can_be_raised_and_caught | TestExceptions | 67 | null |
qwertyquerty/pypresence | from pypresence.types import ActivityType, StatusDisplayType
class TestActivityType:
def test_activity_type_values(self):
"""Test ActivityType enum values"""
assert ActivityType.PLAYING.value == 0
# STREAMING not implemented in Discord
assert ActivityType.LISTENING.value == 2
... | 5 | assert | numeric_literal | tests/test_types.py | test_activity_type_values | TestActivityType | 15 | null |
qwertyquerty/pypresence | import asyncio
import json
import struct
import sys
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pypresence.baseclient import BaseClient
from pypresence.exceptions import (
ConnectionTimeout,
InvalidArgument,
InvalidID,
InvalidPipe,
PipeClosed,
PyPresenceException,
R... | "123456789" | assert | string_literal | tests/test_baseclient.py | test_init_converts_client_id_to_string | TestBaseClientInit | 39 | null |
qwertyquerty/pypresence | import asyncio
import sys
import pytest
from pypresence.utils import get_event_loop, remove_none
class TestRemoveNone:
def test_removes_none_from_flat_dict(self):
"""Test removing None from flat dictionary"""
d = {"a": 1, "b": None, "c": "test", "d": None}
result = remove_none(d)
... | 1 | assert | numeric_literal | tests/test_utils.py | test_removes_none_from_flat_dict | TestRemoveNone | 23 | null |
qwertyquerty/pypresence | import json
import os
from pypresence.payloads import Payload
from pypresence.types import ActivityType, StatusDisplayType
class TestSetActivity:
def test_set_activity_with_buttons(self):
"""Test activity with buttons"""
buttons = [
{"label": "Button 1", "url": "https://example.com/1"... | buttons | assert | variable | tests/test_payloads.py | test_set_activity_with_buttons | TestSetActivity | 104 | null |
qwertyquerty/pypresence | import json
import struct
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pypresence import AioPresence, Presence
from pypresence.types import ActivityType
class TestPresenceURLFeatures:
@patch("pypresence.baseclient.BaseClient.read_output")
def test_update_with_small_url(self, mock_read... | "Small Image" | assert | string_literal | tests/test_presence.py | test_update_with_small_url | TestPresenceURLFeatures | 365 | null |
qwertyquerty/pypresence | from pypresence.types import ActivityType, StatusDisplayType
class TestActivityType:
def test_activity_type_names(self):
"""Test ActivityType names"""
assert ActivityType.PLAYING.name == | "PLAYING" | assert | string_literal | tests/test_types.py | test_activity_type_names | TestActivityType | 27 | null |
qwertyquerty/pypresence | import json
import os
from pypresence.payloads import Payload
from pypresence.types import ActivityType, StatusDisplayType
class TestPayloadGeneration:
def test_basic_payload_creation(self):
"""Test creating a basic payload"""
data = {"cmd": "TEST", "args": {"value": 1}}
payload = Payload... | data | assert | variable | tests/test_payloads.py | test_basic_payload_creation | TestPayloadGeneration | 18 | null |
qwertyquerty/pypresence | import asyncio
import sys
import pytest
from pypresence.utils import get_event_loop, remove_none
class TestRemoveNone:
def test_removes_none_from_flat_dict(self):
"""Test removing None from flat dictionary"""
d = {"a": 1, "b": None, "c": "test", "d": None}
result = remove_none(d)
... | result | assert | variable | tests/test_utils.py | test_removes_none_from_flat_dict | TestRemoveNone | 19 | null |
qwertyquerty/pypresence | import asyncio
import json
import struct
import sys
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pypresence.baseclient import BaseClient
from pypresence.exceptions import (
ConnectionTimeout,
InvalidArgument,
InvalidID,
InvalidPipe,
PipeClosed,
PyPresenceException,
R... | loop | assert | variable | tests/test_baseclient.py | test_init_with_custom_loop | TestBaseClientInit | 47 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.