Dataset Viewer
Auto-converted to Parquet Duplicate
language
stringclasses
2 values
source_code
stringlengths
0
963k
test_code
stringlengths
300
420k
source_path
stringlengths
29
179
test_path
stringlengths
36
183
repo_name
stringclasses
58 values
instruction
stringlengths
380
1.3k
meta_class
stringlengths
2
57
python
import contextlib import os @contextlib.contextmanager def override_environ(**kwargs): save_env = dict(os.environ) for key, value in kwargs.items(): if value is None: del os.environ[key] else: os.environ[key] = value try: yield finally: os.enviro...
import copy import filecmp import os import tarfile import zipfile from collections import deque from io import BytesIO from unittest import mock import pytest from requests import compat from requests._internal_utils import unicode_is_ascii from requests.cookies import RequestsCookieJar from requests.structures impo...
./temp_repos/requests/tests/utils.py
./temp_repos/requests/tests/test_utils.py
requests
You are an expert Python testing engineer using unittest and unittest.mock. Task: Write a robust unit test for the class 'Unknown'. Context: - Class Name: Unknown - Dependencies to Mock: None detected - Key Imports: os, contextlib Requirements: 1. Use 'unittest.mock' library (MagicMock, patch). 2. Mock the ex...
Unknown
python
""" requests.hooks ~~~~~~~~~~~~~~ This module provides the capabilities for the Requests hooks system. Available hooks: ``response``: The response generated from a Request. """ HOOKS = ["response"] def default_hooks(): return {event: [] for event in HOOKS} # TODO: response is the only one def dispatch_...
import pytest from requests import hooks def hook(value): return value[1:] @pytest.mark.parametrize( "hooks_list, result", ( (hook, "ata"), ([hook, lambda x: None, hook], "ta"), ), ) def test_hooks(hooks_list, result): assert hooks.dispatch_hook("response", {"response": hooks_li...
./temp_repos/requests/src/requests/hooks.py
./temp_repos/requests/tests/test_hooks.py
requests
You are an expert Python testing engineer using unittest and unittest.mock. Task: Write a robust unit test for the class 'Unknown'. Context: - Class Name: Unknown - Dependencies to Mock: None detected - Key Imports: Requirements: 1. Use 'unittest.mock' library (MagicMock, patch). 2. Mock the external depende...
Unknown
python
"""Module containing bug report helper(s).""" import json import platform import ssl import sys import idna import urllib3 from . import __version__ as requests_version try: import charset_normalizer except ImportError: charset_normalizer = None try: import chardet except ImportError: chardet = Non...
from unittest import mock from requests.help import info def test_system_ssl(): """Verify we're actually setting system_ssl when it should be available.""" assert info()["system_ssl"]["version"] != "" class VersionedPackage: def __init__(self, version): self.__version__ = version def test_idn...
./temp_repos/requests/src/requests/help.py
./temp_repos/requests/tests/test_help.py
requests
You are an expert Python testing engineer using unittest and unittest.mock. Task: Write a robust unit test for the class 'Unknown'. Context: - Class Name: Unknown - Dependencies to Mock: None detected - Key Imports: OpenSSL, platform, urllib3.contrib, idna, ssl, urllib3, chardet, json, charset_normalizer, cryp...
Unknown
python
""" Built-in, globally-available admin actions. """ from django.contrib import messages from django.contrib.admin import helpers from django.contrib.admin.decorators import action from django.contrib.admin.utils import model_ngettext from django.core.exceptions import PermissionDenied from django.template.response imp...
from django.contrib import admin from django.contrib.auth.models import Permission, User from django.contrib.contenttypes.models import ContentType from django.test import TestCase from .models import Band class AdminActionsTests(TestCase): @classmethod def setUpTestData(cls): cls.superuser = User.ob...
./temp_repos/django/django/contrib/admin/actions.py
./temp_repos/django/tests/modeladmin/test_actions.py
django
You are an expert Python testing engineer using unittest and unittest.mock. Task: Write a robust unit test for the class 'Unknown'. Context: - Class Name: Unknown - Dependencies to Mock: None detected - Key Imports: django.contrib.admin.decorators, django.contrib.admin, django.core.exceptions, django.contrib.a...
Unknown
python
from ctypes import c_void_p class CPointerBase: """ Base class for objects that have a pointer access property that controls access to the underlying C pointer. """ _ptr = None # Initially the pointer is NULL. ptr_type = c_void_p destructor = None null_ptr_exception_class = Attribute...
import ctypes from unittest import mock from django.contrib.gis.ptr import CPointerBase from django.test import SimpleTestCase class CPointerBaseTests(SimpleTestCase): def test(self): destructor_mock = mock.Mock() class NullPointerException(Exception): pass class FakeGeom1(C...
./temp_repos/django/django/contrib/gis/ptr.py
./temp_repos/django/tests/gis_tests/test_ptr.py
django
You are an expert Python testing engineer using unittest and unittest.mock. Task: Write a robust unit test for the class 'CPointerBase'. Context: - Class Name: CPointerBase - Dependencies to Mock: None detected - Key Imports: ctypes Requirements: 1. Use 'unittest.mock' library (MagicMock, patch). 2. Mock the ...
CPointerBase
python
""" This module houses the GeoIP2 object, a wrapper for the MaxMind GeoIP2(R) Python API (https://geoip2.readthedocs.io/). This is an alternative to the Python GeoIP2 interface provided by MaxMind. GeoIP(R) is a registered trademark of MaxMind, Inc. For IP-based geolocation, this module requires the GeoLite2 Country ...
import ipaddress import itertools import pathlib from unittest import mock, skipUnless from django.conf import settings from django.contrib.gis.geoip2 import HAS_GEOIP2 from django.contrib.gis.geos import GEOSGeometry from django.test import SimpleTestCase, override_settings if HAS_GEOIP2: import geoip2 from...
./temp_repos/django/django/contrib/gis/geoip2.py
./temp_repos/django/tests/gis_tests/test_geoip2.py
django
You are an expert Python testing engineer using unittest and unittest.mock. Task: Write a robust unit test for the class 'GeoIP2Exception'. Context: - Class Name: GeoIP2Exception - Dependencies to Mock: cache, path, country, city - Key Imports: django.utils.functional, django.conf, django.contrib.gis.geos, dja...
GeoIP2Exception
python
""" ******** Models for test_data.py *********** The following classes are for testing basic data marshalling, including NULL values, where allowed. The basic idea is to have a model for each Django data type. """ import uuid from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from djang...
""" This module has the mock object definitions used to hold reference geometry for the GEOS and GDAL tests. """ import json import os from django.utils.functional import cached_property # Path where reference test data is located. TEST_DATA = os.path.join(os.path.dirname(__file__), "data") def tuplize(seq): "...
./temp_repos/django/tests/serializers/models/data.py
./temp_repos/django/tests/gis_tests/test_data.py
django
You are an expert Python testing engineer using unittest and unittest.mock. Task: Write a robust unit test for the class 'BinaryData'. Context: - Class Name: BinaryData - Dependencies to Mock: None detected - Key Imports: base, django.contrib.contenttypes.fields, django.db, django.contrib.contenttypes.models, ...
BinaryData
python
from ctypes import c_void_p from django.contrib.gis.gdal.base import GDALBase from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.gdal.libgdal import GDAL_VERSION from django.contrib.gis.gdal.prototypes import ds as capi from django.utils.encoding import force_bytes, force_str class Drive...
import unittest from unittest import mock from django.contrib.gis.gdal import GDAL_VERSION, Driver, GDALException valid_drivers = ( # vector "ESRI Shapefile", "MapInfo File", "S57", "DGN", "Memory", "CSV", "GML", "KML", # raster "GTiff", "JPEG", "MEM", "PNG", ) ...
./temp_repos/django/django/contrib/gis/gdal/driver.py
./temp_repos/django/tests/gis_tests/gdal_tests/test_driver.py
django
You are an expert Python testing engineer using unittest and unittest.mock. Task: Write a robust unit test for the class 'Driver'. Context: - Class Name: Driver - Dependencies to Mock: dr_input - Key Imports: django.contrib.gis.gdal.libgdal, django.contrib.gis.gdal.prototypes, django.contrib.gis.gdal.error, dj...
Driver
python
""" This module houses the ctypes function prototypes for GDAL DataSource (raster) related data structures. """ from ctypes import POINTER, c_bool, c_char_p, c_double, c_int, c_void_p from functools import partial from django.contrib.gis.gdal.libgdal import std_call from django.contrib.gis.gdal.prototypes.generation ...
import os import shutil import struct import tempfile import zipfile from pathlib import Path from unittest import mock from django.contrib.gis.gdal import GDAL_VERSION, GDALRaster, SpatialReference from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.gdal.raster.band import GDALBand from dj...
./temp_repos/django/django/contrib/gis/gdal/prototypes/raster.py
./temp_repos/django/tests/gis_tests/gdal_tests/test_raster.py
django
You are an expert Python testing engineer using unittest and unittest.mock. Task: Write a robust unit test for the class 'Unknown'. Context: - Class Name: Unknown - Dependencies to Mock: None detected - Key Imports: django.contrib.gis.gdal.libgdal, django.contrib.gis.gdal.prototypes.generation, functools, ctyp...
Unknown
python
""" Creates the default Site object. """ from django.apps import apps as global_apps from django.conf import settings from django.core.management.color import no_style from django.db import DEFAULT_DB_ALIAS, connections, router def create_default_site( app_config, verbosity=2, interactive=True, using...
import datetime import os import shutil import tempfile import unittest from io import StringIO from pathlib import Path from unittest import mock from admin_scripts.tests import AdminScriptTestCase from django.conf import STATICFILES_STORAGE_ALIAS, settings from django.contrib.staticfiles import storage from django....
./temp_repos/django/django/contrib/sites/management.py
./temp_repos/django/tests/staticfiles_tests/test_management.py
django
You are an expert Python testing engineer using unittest and unittest.mock. Task: Write a robust unit test for the class 'Unknown'. Context: - Class Name: Unknown - Dependencies to Mock: None detected - Key Imports: django.db, django.conf, django.apps, django.core.management.color Requirements: 1. Use 'unitte...
Unknown
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
1