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
lexiforest/curl_cffi
import pytest from curl_cffi import requests def test_wrong_type_custom_response(): with pytest.raises(
TypeError)
pytest.raises
variable
tests/integration/test_response_class.py
test_wrong_type_custom_response
30
null
lexiforest/curl_cffi
from curl_cffi import requests def test_post_with_no_body(): r = requests.post( "https://shopee.co.id/api/v2/authentication/get_active_login_page" ) assert r.status_code ==
200
assert
numeric_literal
tests/integration/test_real_world.py
test_post_with_no_body
8
null
lexiforest/curl_cffi
import asyncio import base64 import json from contextlib import suppress import pytest from curl_cffi import Headers from curl_cffi.requests import AsyncSession, RequestsError from curl_cffi.requests.errors import SessionClosed async def test_elapsed(server): async with AsyncSession() as s: r = await s.g...
0.1
assert
numeric_literal
tests/unittest/test_async_session.py
test_elapsed
243
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests JA3_URL = "https://tls.browserleaks.com/json" CHROME_JA3_HASH = "53ff64ddf993ca882b70e1c82af5da49" EDGE_JA3_HASH = "53ff64ddf993ca882b70e1c82af5da49" SAFARI_JA3_HASH = "8468a1ef6cb71b13e1eef8eadf786f7d" def test_impersonate_safari(): r = requests.get(JA3_URL, imper...
SAFARI_JA3_HASH
assert
variable
tests/integration/test_fingerprints.py
test_impersonate_safari
31
null
lexiforest/curl_cffi
import base64 import json from io import BytesIO from typing import cast import pytest import curl_cffi from curl_cffi import Curl, CurlError, CurlInfo, CurlOpt def test_post(server): c = Curl() url = str(server.url.copy_with(path="/echo_body")) c.setopt(CurlOpt.URL, url.encode()) c.setopt(CurlOpt.PO...
b"foo=bar"
assert
string_literal
tests/unittest/test_curl.py
test_post
31
null
lexiforest/curl_cffi
import base64 import json from io import BytesIO from typing import cast import pytest import curl_cffi from curl_cffi import Curl, CurlError, CurlInfo, CurlOpt def test_not_follow_redirect(server): c = Curl() url = str(server.url.copy_with(path="/redirect_301")) c.setopt(CurlOpt.URL, url.encode()) c...
301
assert
numeric_literal
tests/unittest/test_curl.py
test_not_follow_redirect
205
null
lexiforest/curl_cffi
import base64 import json from io import BytesIO from typing import cast import pytest import curl_cffi from curl_cffi import Curl, CurlError, CurlInfo, CurlOpt def test_post_data_with_size(server): c = Curl() url = str(server.url.copy_with(path="/echo_body")) c.setopt(CurlOpt.URL, url.encode()) c.se...
b"\0" * 7
assert
string_literal
tests/unittest/test_curl.py
test_post_data_with_size
58
null
lexiforest/curl_cffi
from curl_cffi.requests import AsyncSession, Session, WebSocket from curl_cffi.requests.websockets import CurlWsFlag def test_hello(ws_server): ws = WebSocket() ws.connect(ws_server.url) ws.send(b"Foo me once") content, _ = ws.recv() assert content ==
b"Foo me once"
assert
string_literal
tests/unittest/test_websockets.py
test_hello
19
null
lexiforest/curl_cffi
from __future__ import annotations import asyncio import queue import threading from asyncio import Task from collections.abc import AsyncIterator, Awaitable, Callable, Generator from contextlib import asynccontextmanager, suppress from dataclasses import dataclass, field from enum import Enum, auto from typing import...
""
assert
string_literal
tests/unittest/test_async_websockets.py
test_empty_string_message
TestAsyncWebSocketEdgeCases
1,196
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests from curl_cffi.const import CurlHttpVersion, CurlSslVersion @pytest.mark.skip(reason="Unstable API") def test_customized_extra_fp_sig_hash_algs(): url = "https://tls.peet.ws/api/all" safari_algs = [ "ecdsa_secp256r1_sha256", "rsa_pss_rsae_sha256", ...
result_algs
assert
variable
tests/unittest/test_impersonate.py
test_customized_extra_fp_sig_hash_algs
189
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests from curl_cffi.const import CurlHttpVersion, CurlSslVersion @pytest.mark.skip(reason="Unstable API") def test_customized_extra_fp_tls_min_version(): url = "https://tls.peet.ws/api/all" safari_min_version = CurlSslVersion.TLSv1_0 fp = requests.ExtraFingerprints(...
4
assert
numeric_literal
tests/unittest/test_impersonate.py
test_customized_extra_fp_tls_min_version
201
null
lexiforest/curl_cffi
from __future__ import annotations import asyncio import queue import threading from asyncio import Task from collections.abc import AsyncIterator, Awaitable, Callable, Generator from contextlib import asynccontextmanager, suppress from dataclasses import dataclass, field from enum import Enum, auto from typing import...
5
assert
numeric_literal
tests/unittest/test_async_websockets.py
test_concurrent_recv_multiple_consumers
TestAsyncWebSocketConcurrency
614
null
lexiforest/curl_cffi
import base64 import json from io import BytesIO from typing import cast import pytest import curl_cffi from curl_cffi import Curl, CurlError, CurlInfo, CurlOpt def test_follow_redirect(server): c = Curl() url = str(server.url.copy_with(path="/redirect_301")) c.setopt(CurlOpt.URL, url.encode()) c.set...
200
assert
numeric_literal
tests/unittest/test_curl.py
test_follow_redirect
197
null
lexiforest/curl_cffi
import pytest from curl_cffi.requests.cookies import Cookies, CurlMorsel from curl_cffi.requests.errors import CookieConflict, RequestsError def test_cookies_conflict(): c = Cookies() c.set("foo", "bar", domain="example.com") c.set("foo", "baz", domain="test.local") with pytest.raises(
CookieConflict)
pytest.raises
variable
tests/unittest/test_cookies.py
test_cookies_conflict
11
null
lexiforest/curl_cffi
from curl_cffi.requests import AsyncSession, Session, WebSocket from curl_cffi.requests.websockets import CurlWsFlag def test_on_data_callback(ws_server): on_data_called = False def on_data(ws: WebSocket, data, frame): nonlocal on_data_called on_data_called = True ws = WebSocket(on_data=o...
False
assert
bool_literal
tests/unittest/test_websockets.py
test_on_data_callback
102
null
lexiforest/curl_cffi
from curl_cffi.requests import Headers from curl_cffi.requests.utils import update_header_line def test_replace_header(): header_lines = [] update_header_line(header_lines, "content-type", "image/png") assert header_lines == ["content-type: image/png"] update_header_line(header_lines, "Content-Type", "...
["Content-Type: application/json"]
assert
collection
tests/unittest/test_headers.py
test_replace_header
34
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests from curl_cffi.const import CurlHttpVersion, CurlSslVersion @pytest.mark.skip(reason="website is down") def test_customized_ja3_extensions(): url = "https://tls.browserleaks.com/json" ja3 = ( "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-491...
"65281-0-11-23-27-16-17513-10-35-43-45-13-51"
assert
string_literal
tests/unittest/test_impersonate.py
test_customized_ja3_extensions
114
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests JA3_URL = "https://tls.browserleaks.com/json" CHROME_JA3_HASH = "53ff64ddf993ca882b70e1c82af5da49" EDGE_JA3_HASH = "53ff64ddf993ca882b70e1c82af5da49" SAFARI_JA3_HASH = "8468a1ef6cb71b13e1eef8eadf786f7d" def test_impersonate_edge(): r = requests.get(JA3_URL, imperso...
EDGE_JA3_HASH
assert
variable
tests/integration/test_fingerprints.py
test_impersonate_edge
26
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests from curl_cffi.const import CurlHttpVersion, CurlSslVersion @pytest.mark.skip(reason="not working") def test_customized_ja3_tls_version(): url = "https://tls.browserleaks.com/json" ja3 = ( "770,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-...
"770"
assert
string_literal
tests/unittest/test_impersonate.py
test_customized_ja3_tls_version
73
null
lexiforest/curl_cffi
from __future__ import annotations import asyncio import queue import threading from asyncio import Task from collections.abc import AsyncIterator, Awaitable, Callable, Generator from contextlib import asynccontextmanager, suppress from dataclasses import dataclass, field from enum import Enum, auto from typing import...
size
assert
variable
tests/unittest/test_async_websockets.py
test_large_message_echo
TestAsyncWebSocketLargeMessages
541
null
lexiforest/curl_cffi
import pytest from curl_cffi.requests.cookies import Cookies, CurlMorsel from curl_cffi.requests.errors import CookieConflict, RequestsError def test_get_dict(): c = Cookies({"foo": "bar"}) d = c.get_dict() assert d == {"foo": "bar"} c = Cookies({"foo": "bar", "hello": "world", "a": "b"}) d = c.g...
1
assert
numeric_literal
tests/unittest/test_cookies.py
test_get_dict
66
null
lexiforest/curl_cffi
from curl_cffi.requests import Headers from curl_cffi.requests.utils import update_header_line def test_headers(): headers = Headers() headers["foo"] = "bar" headers["foo"] = "baz" assert headers["foo"] == "baz" assert headers.get("foo") == "baz" assert headers.get("bar") is
None
assert
none_literal
tests/unittest/test_headers.py
test_headers
11
null
lexiforest/curl_cffi
import base64 import json from io import BytesIO from typing import cast import pytest import curl_cffi from curl_cffi import Curl, CurlError, CurlInfo, CurlOpt def test_elapsed(server): c = Curl() url = str(server.url) c.setopt(CurlOpt.URL, url.encode()) c.perform() assert cast(int, c.getinfo(C...
0
assert
numeric_literal
tests/unittest/test_curl.py
test_elapsed
316
null
lexiforest/curl_cffi
from curl_cffi import requests URLS = [ "https://www.google.com", "https://www.apple.com", ] def test_without_impersonate(): for url in URLS: r = requests.get(url) assert r.status_code ==
200
assert
numeric_literal
tests/unittest/test_smoke.py
test_without_impersonate
13
null
lexiforest/curl_cffi
import os from pathlib import Path from curl_cffi import CurlMime, requests ASSET_FOLDER = Path(__file__).parent.parent.parent / "assets" def test_upload_with_text_fields(file_server): multipart = CurlMime.from_list( [ { "name": "image", "content_type": "image/...
"bar"
assert
string_literal
tests/unittest/test_upload.py
test_upload_with_text_fields
49
null
lexiforest/curl_cffi
from curl_cffi.requests import AsyncSession, Session, WebSocket from curl_cffi.requests.websockets import CurlWsFlag def test_receive_large_messages_run_forever(ws_server): def on_open(ws: WebSocket): ws.send("*" * 10000) chunk_counter = 0 def on_data(ws: WebSocket, data, frame): nonlocal...
1
assert
numeric_literal
tests/unittest/test_websockets.py
test_receive_large_messages_run_forever
86
null
lexiforest/curl_cffi
import asyncio import base64 import json from contextlib import suppress import pytest from curl_cffi import Headers from curl_cffi.requests import AsyncSession, RequestsError from curl_cffi.requests.errors import SessionClosed async def test_get(server): async with AsyncSession() as s: r = await s.get(s...
200
assert
numeric_literal
tests/unittest/test_async_session.py
test_get
16
null
lexiforest/curl_cffi
import pytest from curl_cffi.requests.cookies import Cookies, CurlMorsel from curl_cffi.requests.errors import CookieConflict, RequestsError def test_get_dict(): c = Cookies({"foo": "bar"}) d = c.get_dict() assert d == {"foo": "bar"} c = Cookies({"foo": "bar", "hello": "world", "a": "b"}) d = c.g...
"b"
assert
string_literal
tests/unittest/test_cookies.py
test_get_dict
55
null
lexiforest/curl_cffi
from curl_cffi.requests import Headers from curl_cffi.requests.utils import update_header_line def test_headers(): headers = Headers() headers["foo"] = "bar" headers["foo"] = "baz" assert headers["foo"] ==
"baz"
assert
string_literal
tests/unittest/test_headers.py
test_headers
9
null
lexiforest/curl_cffi
from __future__ import annotations import asyncio import queue import threading from asyncio import Task from collections.abc import AsyncIterator, Awaitable, Callable, Generator from contextlib import asynccontextmanager, suppress from dataclasses import dataclass, field from enum import Enum, auto from typing import...
1001
assert
numeric_literal
tests/unittest/test_async_websockets.py
test_close_code_extraction
TestAsyncWebSocketCoverageGaps
1,759
null
lexiforest/curl_cffi
from __future__ import annotations import asyncio import queue import threading from asyncio import Task from collections.abc import AsyncIterator, Awaitable, Callable, Generator from contextlib import asynccontextmanager, suppress from dataclasses import dataclass, field from enum import Enum, auto from typing import...
0
assert
numeric_literal
tests/unittest/test_async_websockets.py
test_flush_waits_for_queue
TestAsyncWebSocketFlush
1,111
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests from curl_cffi.const import CurlHttpVersion, CurlSslVersion @pytest.mark.skip(reason="Unstable API") def test_customized_extra_fp_grease(): url = "https://tls.peet.ws/api/all" fp = requests.ExtraFingerprints(tls_grease=True) r = requests.get(url, extra_fp=fp).j...
r["tls"]["ciphers"][0]
assert
complex_expr
tests/unittest/test_impersonate.py
test_customized_extra_fp_grease
209
null
lexiforest/curl_cffi
import pytest from curl_cffi import CurlHttpVersion, CurlOpt, requests def test_imperonsate_default_headers(): r = requests.get("http://postman-echo.com/headers", impersonate="chrome110") headers = r.json() assert "Mozilla" in headers["headers"]["user-agent"] r = requests.get( "http://httpbin....
headers["headers"]
assert
complex_expr
tests/integration/test_httpbin.py
test_imperonsate_default_headers
47
null
lexiforest/curl_cffi
import pytest from curl_cffi.requests.cookies import Cookies, CurlMorsel from curl_cffi.requests.errors import CookieConflict, RequestsError def test_get_dict(): c = Cookies({"foo": "bar"}) d = c.get_dict() assert d == {"foo": "bar"} c = Cookies({"foo": "bar", "hello": "world", "a": "b"}) d = c.g...
2
assert
numeric_literal
tests/unittest/test_cookies.py
test_get_dict
63
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests from curl_cffi.const import CurlHttpVersion, CurlSslVersion @pytest.mark.skip(reason="website is down") def test_customized_ja3_curves(): url = "https://tls.browserleaks.com/json" ja3 = ( "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-1...
"25497-24-23-29"
assert
string_literal
tests/unittest/test_impersonate.py
test_customized_ja3_curves
144
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests JA3_URL = "https://tls.browserleaks.com/json" CHROME_JA3_HASH = "53ff64ddf993ca882b70e1c82af5da49" EDGE_JA3_HASH = "53ff64ddf993ca882b70e1c82af5da49" SAFARI_JA3_HASH = "8468a1ef6cb71b13e1eef8eadf786f7d" def test_impersonate_unknown(): with pytest.raises(
requests.RequestsError, match="not supported")
pytest.raises
complex_expr
tests/integration/test_fingerprints.py
test_impersonate_unknown
35
null
lexiforest/curl_cffi
from curl_cffi.requests import AsyncSession, Session, WebSocket from curl_cffi.requests.websockets import CurlWsFlag def test_receive_large_messages_run_forever(ws_server): def on_open(ws: WebSocket): ws.send("*" * 10000) chunk_counter = 0 def on_data(ws: WebSocket, data, frame): nonlocal...
10000
assert
numeric_literal
tests/unittest/test_websockets.py
test_receive_large_messages_run_forever
87
null
lexiforest/curl_cffi
import base64 import json import time from io import BytesIO from uuid import uuid4 import pytest from charset_normalizer import detect import curl_cffi from curl_cffi import Curl, CurlOpt, requests from curl_cffi.const import CurlECode, CurlInfo from curl_cffi.requests.errors import SessionClosed from curl_cffi.requ...
""
assert
string_literal
tests/unittest/test_requests.py
test_empty_header_included
274
null
lexiforest/curl_cffi
import os from pathlib import Path from curl_cffi import CurlMime, requests ASSET_FOLDER = Path(__file__).parent.parent.parent / "assets" def test_upload_single_file(file_server): multipart = CurlMime.from_list( [ { "name": "image", "content_type": "image/jpg",...
"scrapfly.png"
assert
string_literal
tests/unittest/test_upload.py
test_upload_single_file
23
null
lexiforest/curl_cffi
import asyncio import base64 import json from contextlib import suppress import pytest from curl_cffi import Headers from curl_cffi.requests import AsyncSession, RequestsError from curl_cffi.requests.errors import SessionClosed async def test_follow_redirects(server): async with AsyncSession() as s: r = ...
1
assert
numeric_literal
tests/unittest/test_async_session.py
test_follow_redirects
189
null
lexiforest/curl_cffi
import asyncio import base64 import json from contextlib import suppress import pytest from curl_cffi import Headers from curl_cffi.requests import AsyncSession, RequestsError from curl_cffi.requests.errors import SessionClosed async def test_not_follow_redirects(server): async with AsyncSession() as s: ...
0
assert
numeric_literal
tests/unittest/test_async_session.py
test_not_follow_redirects
179
null
lexiforest/curl_cffi
import pytest from curl_cffi import requests from curl_cffi.const import CurlHttpVersion, CurlSslVersion @pytest.mark.skip(reason="website is down") def test_customized_ja3_chrome126(): url = "https://tls.browserleaks.com/json" ja3 = ( "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-4917...
ja3
assert
variable
tests/unittest/test_impersonate.py
test_customized_ja3_chrome126
61
null
PyMySQL/PyMySQL
import datetime import json import time import pytest import pymysql.cursors from pymysql.tests import base __all__ = ["TestConversion", "TestCursor", "TestBulkInserts"] class TestConversion(base.PyMySQLTestCase): def test_untyped(self): """test conversion of null, empty string""" conn = self.c...
c.fetchone())
self.assertEqual
func_call
pymysql/tests/test_basic.py
test_untyped
TestConversion
166
null
PyMySQL/PyMySQL
import datetime import time import warnings import pytest import pymysql from pymysql.tests import base __all__ = ["TestOldIssues", "TestNewIssues", "TestGitHubIssues"] class TestGitHubIssues(base.PyMySQLTestCase): def test_issue_321(self): """Test iterable as query argument.""" conn = pymysql....
3)
self.assertEqual
numeric_literal
pymysql/tests/test_issues.py
test_issue_321
TestGitHubIssues
416
null
PyMySQL/PyMySQL
from . import dbapi20 import pymysql from pymysql.tests import base class test_MySQLdb(dbapi20.DatabaseAPI20Test): driver = pymysql connect_args = () connect_kw_args = base.PyMySQLTestCase.databases[0].copy() def help_nextset_setUp(self, cur): """Should create a procedure called deleteme ...
len(self.samples)
assert
func_call
pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py
test_nextset
test_MySQLdb
198
null
PyMySQL/PyMySQL
from pymysql.constants import ER from pymysql.tests import base import pymysql.cursors import pytest class CursorTest(base.PyMySQLTestCase): def setUp(self): super().setUp() conn = self.connect() self.safe_create_table( conn, "test", "create table test ...
(1,))
self.assertEqual
collection
pymysql/tests/test_cursor.py
test_cleanup_rows_unbuffered
CursorTest
49
null
PyMySQL/PyMySQL
__rcs_id__ = "$Id$" __version__ = "$Revision$"[11:-2] __author__ = "Stuart Bishop <zen@shangri-la.dropbear.id.au>" import time import unittest class DatabaseAPI20Test(unittest.TestCase): driver = None connect_args = () # List of arguments to pass to connect connect_kw_args = {} # Keyword arguments for ...
"2.0")
self.assertEqual
string_literal
pymysql/tests/thirdparty/test_MySQLdb/dbapi20.py
test_apilevel
DatabaseAPI20Test
151
null
PyMySQL/PyMySQL
from io import StringIO from unittest import TestCase from pymysql.optionfile import Parser __all__ = ["TestParser"] _cfg_file = r""" [default] string = foo quoted = "bar" single_quoted = 'foobar' skip-slave-start """ class TestParser(TestCase): def test_string(self): parser = Parser() parser.rea...
"foobar")
self.assertEqual
string_literal
pymysql/tests/test_optionfile.py
test_string
TestParser
24
null
PyMySQL/PyMySQL
import pytest import pymysql from pymysql.tests import base from pymysql.constants import CLIENT class TestNextset(base.PyMySQLTestCase): @pytest.mark.xfail def test_multi_cursor(self): con = self.connect(client_flag=CLIENT.MULTI_STATEMENTS) cur1 = con.cursor() cur2 = con.cursor() ...
list(cur1))
self.assertEqual
func_call
pymysql/tests/test_nextset.py
test_multi_cursor
TestNextset
61
null
PyMySQL/PyMySQL
import datetime import ssl import pytest import time from unittest import mock import pymysql from pymysql.tests import base from pymysql.constants import CLIENT def escape_foo(x, d): return x.value class TestEscape(base.PyMySQLTestCase): def test_escape_custom_object(self): con = self.connect() ...
"bar")
self.assertEqual
string_literal
pymysql/tests/test_connection.py
test_escape_custom_object
TestEscape
847
null
PyMySQL/PyMySQL
import pytest from pymysql.tests import base import pymysql.cursors from pymysql.constants import CLIENT, ER class TestSSCursor(base.PyMySQLTestCase): def test_warnings(self): con = self.connect() cur = con.cursor(pymysql.cursors.SSCursor) cur.execute("DROP TABLE IF EXISTS `no_exists_tabl...
1)
self.assertEqual
numeric_literal
pymysql/tests/test_SSCursor.py
test_warnings
TestSSCursor
205
null
PyMySQL/PyMySQL
import unittest import pymysql _mysql = pymysql from pymysql.constants import FIELD_TYPE from pymysql.tests import base class CoreModule(unittest.TestCase): def test_client_info(self): self.assertTrue(
isinstance(_mysql.get_client_info(), str))
self.assertTrue
func_call
pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py
test_client_info
CoreModule
39
null
PyMySQL/PyMySQL
import pytest from pymysql.tests import base import pymysql.cursors from pymysql.constants import CLIENT, ER class TestSSCursor(base.PyMySQLTestCase): def test_execution_time_limit(self): # this method is similarly implemented in test_cursor conn = self.connect() # table creation and fi...
("row1", 0))
self.assertEqual
collection
pymysql/tests/test_SSCursor.py
test_execution_time_limit
TestSSCursor
167
null
PyMySQL/PyMySQL
import datetime import json import time import pytest import pymysql.cursors from pymysql.tests import base __all__ = ["TestConversion", "TestCursor", "TestBulkInserts"] class TestConversion(base.PyMySQLTestCase): def test_datatypes(self): """test every data type""" conn = self.connect() ...
r)
self.assertEqual
variable
pymysql/tests/test_basic.py
test_datatypes
TestConversion
78
null
PyMySQL/PyMySQL
from . import dbapi20 import pymysql from pymysql.tests import base class test_MySQLdb(dbapi20.DatabaseAPI20Test): driver = pymysql connect_args = () connect_kw_args = base.PyMySQLTestCase.databases[0].copy() def test_fetchone(self): con = self._connect() try: cur = con.cur...
"cursor.fetchone should have retrieved a single row")
self.assertEqual
string_literal
pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py
test_fetchone
test_MySQLdb
114
null
PyMySQL/PyMySQL
import unittest import pymysql _mysql = pymysql from pymysql.constants import FIELD_TYPE from pymysql.tests import base class CoreModule(unittest.TestCase): def test_NULL(self): """Should have a NULL constant.""" self.assertEqual(_mysql.NULL,
"NULL")
self.assertEqual
string_literal
pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py
test_NULL
CoreModule
29
null
PyMySQL/PyMySQL
from . import dbapi20 import pymysql from pymysql.tests import base class test_MySQLdb(dbapi20.DatabaseAPI20Test): driver = pymysql connect_args = () connect_kw_args = base.PyMySQLTestCase.databases[0].copy() def test_fetchall(self): con = self._connect() try: cur = con.cur...
cur.rowcount in (-1, len(self.samples)))
self.assertTrue
func_call
pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py
test_fetchall
test_MySQLdb
48
null
PyMySQL/PyMySQL
from time import time import unittest class DatabaseTest(unittest.TestCase): db_module = None connect_args = () connect_kwargs = dict(use_unicode=True, charset="utf8mb4", binary_prefix=True) create_table_extra = "ENGINE=INNODB CHARACTER SET UTF8MB4" rows = 10 debug = False def setUp(self):...
self.rows)
self.assertEqual
complex_expr
pymysql/tests/thirdparty/test_MySQLdb/capabilities.py
check_data_integrity
DatabaseTest
98
null
PyMySQL/PyMySQL
import unittest import pymysql _mysql = pymysql from pymysql.constants import FIELD_TYPE from pymysql.tests import base class CoreAPI(unittest.TestCase): def setUp(self): kwargs = base.PyMySQLTestCase.databases[0].copy() kwargs["read_default_file"] = "~/.my.cnf" self.conn = _mysql.connec...
TypeError)
self.assertRaises
variable
pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py
test_thread_id
CoreAPI
62
null
PyMySQL/PyMySQL
from io import StringIO from unittest import TestCase from pymysql.optionfile import Parser __all__ = ["TestParser"] _cfg_file = r""" [default] string = foo quoted = "bar" single_quoted = 'foobar' skip-slave-start """ class TestParser(TestCase): def test_string(self): parser = Parser() parser.rea...
"foo")
self.assertEqual
string_literal
pymysql/tests/test_optionfile.py
test_string
TestParser
22
null
PyMySQL/PyMySQL
__rcs_id__ = "$Id$" __version__ = "$Revision$"[11:-2] __author__ = "Stuart Bishop <zen@shangri-la.dropbear.id.au>" import time import unittest class DatabaseAPI20Test(unittest.TestCase): driver = None connect_args = () # List of arguments to pass to connect connect_kw_args = {} # Keyword arguments for ...
"Victoria Bitter")
self.assertEqual
string_literal
pymysql/tests/thirdparty/test_MySQLdb/dbapi20.py
test_cursor_isolation
DatabaseAPI20Test
247
null
PyMySQL/PyMySQL
import pytest from pymysql import err def test_raise_mysql_exception(): data = b"\xff\x15\x04#28000Access denied" with pytest.raises(
err.OperationalError)
pytest.raises
complex_expr
pymysql/tests/test_err.py
test_raise_mysql_exception
7
null
PyMySQL/PyMySQL
from pymysql.constants import ER from pymysql.tests import base import pymysql.cursors import pytest class CursorTest(base.PyMySQLTestCase): def setUp(self): super().setUp() conn = self.connect() self.safe_create_table( conn, "test", "create table test ...
c2.fetchone())
self.assertIsNone
func_call
pymysql/tests/test_cursor.py
test_cleanup_rows_unbuffered
CursorTest
50
null
PyMySQL/PyMySQL
from io import StringIO from unittest import TestCase from pymysql.optionfile import Parser __all__ = ["TestParser"] _cfg_file = r""" [default] string = foo quoted = "bar" single_quoted = 'foobar' skip-slave-start """ class TestParser(TestCase): def test_string(self): parser = Parser() parser.rea...
"bar")
self.assertEqual
string_literal
pymysql/tests/test_optionfile.py
test_string
TestParser
23
null
PyMySQL/PyMySQL
import pytest import pymysql from pymysql.tests import base from pymysql.constants import CLIENT class TestNextset(base.PyMySQLTestCase): @pytest.mark.xfail def test_multi_cursor(self): con = self.connect(client_flag=CLIENT.MULTI_STATEMENTS) cur1 = con.cursor() cur2 = con.cursor() ...
list(cur2))
self.assertEqual
func_call
pymysql/tests/test_nextset.py
test_multi_cursor
TestNextset
62
null
PyMySQL/PyMySQL
__rcs_id__ = "$Id$" __version__ = "$Revision$"[11:-2] __author__ = "Stuart Bishop <zen@shangri-la.dropbear.id.au>" import time import unittest class DatabaseAPI20Test(unittest.TestCase): driver = None connect_args = () # List of arguments to pass to connect connect_kw_args = {} # Keyword arguments for ...
6)
self.assertEqual
numeric_literal
pymysql/tests/thirdparty/test_MySQLdb/dbapi20.py
test_fetchmany
DatabaseAPI20Test
588
null
PyMySQL/PyMySQL
import unittest import pymysql _mysql = pymysql from pymysql.constants import FIELD_TYPE from pymysql.tests import base class CoreModule(unittest.TestCase): def test_version(self): """Version information sanity.""" self.assertTrue(isinstance(_mysql.__version__, str)) self.assertTrue(
isinstance(_mysql.version_info, tuple))
self.assertTrue
func_call
pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py
test_version
CoreModule
35
null
PyMySQL/PyMySQL
from pymysql.tests import base import pymysql.cursors import datetime import warnings class TestDictCursor(base.PyMySQLTestCase): bob = {"name": "bob", "age": 21, "DOB": datetime.datetime(1990, 2, 6, 23, 4, 56)} jim = {"name": "jim", "age": 56, "DOB": datetime.datetime(1955, 5, 9, 13, 12, 45)} fred = {"na...
"fetchone via DictCursor failed")
self.assertEqual
string_literal
pymysql/tests/test_DictCursor.py
test_DictCursor
TestDictCursor
56
null
PyMySQL/PyMySQL
import datetime from unittest import TestCase from pymysql import converters __all__ = ["TestConverter"] class TestConverter(TestCase): def test_escape_string(self): self.assertEqual(converters.escape_string("foo\nbar"),
"foo\\nbar")
self.assertEqual
string_literal
pymysql/tests/test_converters.py
test_escape_string
TestConverter
11
null
PyMySQL/PyMySQL
import unittest import pymysql _mysql = pymysql from pymysql.constants import FIELD_TYPE from pymysql.tests import base class CoreAPI(unittest.TestCase): def setUp(self): kwargs = base.PyMySQLTestCase.databases[0].copy() kwargs["read_default_file"] = "~/.my.cnf" self.conn = _mysql.connec...
"Should return 0 before we do anything.")
self.assertEqual
string_literal
pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py
test_affected_rows
CoreAPI
70
null
PyMySQL/PyMySQL
from pymysql import cursors, OperationalError from pymysql.constants import ER from pymysql.tests import base import os __all__ = ["TestLoadLocal"] class TestLoadLocal(base.PyMySQLTestCase): def test_no_file(self): """Test load local infile when the file does not exist""" conn = self.connect() ...
OperationalError)
self.assertRaises
variable
pymysql/tests/test_load_local.py
test_no_file
TestLoadLocal
17
null
PyMySQL/PyMySQL
from . import dbapi20 import pymysql from pymysql.tests import base class test_MySQLdb(dbapi20.DatabaseAPI20Test): driver = pymysql connect_args = () connect_kw_args = base.PyMySQLTestCase.databases[0].copy() def test_fetchall(self): con = self._connect() try: cur = con.cur...
self.driver.Error)
self.assertRaises
complex_expr
pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py
test_fetchall
test_MySQLdb
36
null
PyMySQL/PyMySQL
from pymysql.constants import ER from pymysql.tests import base import pymysql.cursors import pytest class CursorTest(base.PyMySQLTestCase): def setUp(self): super().setUp() conn = self.connect() self.safe_create_table( conn, "test", "create table test ...
("row1",))
self.assertEqual
collection
pymysql/tests/test_cursor.py
test_cursor_is_iterator
CursorTest
33
null
PyMySQL/PyMySQL
import pymysql.charset def test_utf8(): utf8mb3 = pymysql.charset.charset_by_name("utf8mb3") assert utf8mb3.name == "utf8mb3" assert utf8mb3.collation == "utf8mb3_general_ci" assert ( repr(utf8mb3) == "Charset(id=33, name='utf8mb3', collation='utf8mb3_general_ci')" ) # MySQL 8....
utf8mb4
assert
variable
pymysql/tests/test_charset.py
test_utf8
25
null
PyMySQL/PyMySQL
from . import capabilities import pymysql from pymysql.tests import base import warnings warnings.filterwarnings("error") class test_MySQLdb(capabilities.DatabaseTest): db_module = pymysql connect_args = () connect_kwargs = base.PyMySQLTestCase.databases[0].copy() leak_test = False def quote_ide...
"'foo'" == self.connection.literal("foo"))
self.assertTrue
string_literal
pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py
test_literal_string
test_MySQLdb
107
null
PyMySQL/PyMySQL
import pytest from pymysql.tests import base import pymysql.cursors from pymysql.constants import CLIENT, ER class TestSSCursor(base.PyMySQLTestCase): def test_execution_time_limit(self): # this method is similarly implemented in test_cursor conn = self.connect() # table creation and fi...
ER.QUERY_TIMEOUT)
self.assertEqual
complex_expr
pymysql/tests/test_SSCursor.py
test_execution_time_limit
TestSSCursor
193
null
PyMySQL/PyMySQL
from pymysql.constants import ER from pymysql.tests import base import pymysql.cursors import pytest class CursorTest(base.PyMySQLTestCase): def setUp(self): super().setUp() conn = self.connect() self.safe_create_table( conn, "test", "create table test ...
None
assert
none_literal
pymysql/tests/test_cursor.py
test_executemany
CursorTest
105
null
PyMySQL/PyMySQL
__rcs_id__ = "$Id$" __version__ = "$Revision$"[11:-2] __author__ = "Stuart Bishop <zen@shangri-la.dropbear.id.au>" import time import unittest class DatabaseAPI20Test(unittest.TestCase): driver = None connect_args = () # List of arguments to pass to connect connect_kw_args = {} # Keyword arguments for ...
"FOO")
self.assertEqual
string_literal
pymysql/tests/thirdparty/test_MySQLdb/dbapi20.py
test_callproc
DatabaseAPI20Test
337
null
PyMySQL/PyMySQL
import datetime import ssl import pytest import time from unittest import mock import pymysql from pymysql.tests import base from pymysql.constants import CLIENT class TestConnection(base.PyMySQLTestCase): def test_defer_connect(self): import socket d = self.databases[0].copy() try: ...
c.open)
self.assertFalse
complex_expr
pymysql/tests/test_connection.py
test_defer_connect
TestConnection
555
null
PyMySQL/PyMySQL
import unittest import pymysql _mysql = pymysql from pymysql.constants import FIELD_TYPE from pymysql.tests import base class TestDBAPISet(unittest.TestCase): def test_set_equality_membership(self): self.assertTrue(
FIELD_TYPE.VAR_STRING == pymysql.STRING)
self.assertTrue
complex_expr
pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py
test_set_equality_membership
TestDBAPISet
18
null
PyMySQL/PyMySQL
from pymysql.tests import base import pymysql.cursors import datetime import warnings class TestDictCursor(base.PyMySQLTestCase): bob = {"name": "bob", "age": 21, "DOB": datetime.datetime(1990, 2, 6, 23, 4, 56)} jim = {"name": "jim", "age": 56, "DOB": datetime.datetime(1955, 5, 9, 13, 12, 45)} fred = {"na...
"fetchall failed via MyDictCursor")
self.assertEqual
string_literal
pymysql/tests/test_DictCursor.py
test_custom_dict
TestDictCursor
105
null
PyMySQL/PyMySQL
import pytest import pymysql from pymysql.tests import base from pymysql.constants import CLIENT class TestNextset(base.PyMySQLTestCase): def test_nextset(self): con = self.connect( init_command='SELECT "bar"; SELECT "baz"', client_flag=CLIENT.MULTI_STATEMENTS, ) cu...
list(cur))
self.assertEqual
func_call
pymysql/tests/test_nextset.py
test_nextset
TestNextset
16
null
PyMySQL/PyMySQL
import datetime from unittest import TestCase from pymysql import converters __all__ = ["TestConverter"] class TestConverter(TestCase): def test_convert_datetime(self): expected = datetime.datetime(2007, 2, 24, 23, 6, 20) dt = converters.convert_datetime("2007-02-24 23:06:20") self.asser...
expected)
self.assertEqual
variable
pymysql/tests/test_converters.py
test_convert_datetime
TestConverter
16
null
PyMySQL/PyMySQL
import pytest import pymysql from pymysql.tests import base from pymysql.constants import CLIENT class TestNextset(base.PyMySQLTestCase): def test_ok_and_next(self): cur = self.connect(client_flag=CLIENT.MULTI_STATEMENTS).cursor() cur.execute("SELECT 1; commit; SELECT 2;") self.assertEqua...
bool(cur.nextset()))
self.assertFalse
func_call
pymysql/tests/test_nextset.py
test_ok_and_next
TestNextset
50
null
PyMySQL/PyMySQL
import datetime import json import time import pytest import pymysql.cursors from pymysql.tests import base __all__ = ["TestConversion", "TestCursor", "TestBulkInserts"] class TestConversion(base.PyMySQLTestCase): def test_binary(self): """test binary data""" data = bytes(bytearray(range(255)))...
c.fetchone()[0])
self.assertEqual
func_call
pymysql/tests/test_basic.py
test_binary
TestConversion
148
null
PyMySQL/PyMySQL
import datetime import ssl import pytest import time from unittest import mock import pymysql from pymysql.tests import base from pymysql.constants import CLIENT class TestConnection(base.PyMySQLTestCase): def test_set_character_set(self): con = self.connect() cur = con.cursor() con.set_...
"cp1252")
self.assertEqual
string_literal
pymysql/tests/test_connection.py
test_set_character_set
TestConnection
454
null
PyMySQL/PyMySQL
from pymysql.tests import base import pymysql.cursors import datetime import warnings class TestDictCursor(base.PyMySQLTestCase): bob = {"name": "bob", "age": 21, "DOB": datetime.datetime(1990, 2, 6, 23, 4, 56)} jim = {"name": "jim", "age": 56, "DOB": datetime.datetime(1955, 5, 9, 13, 12, 45)} fred = {"na...
"fetch a 1 row result via fetchall failed via DictCursor")
self.assertEqual
string_literal
pymysql/tests/test_DictCursor.py
test_DictCursor
TestDictCursor
62
null
PyMySQL/PyMySQL
from pymysql.constants import ER from pymysql.tests import base import pymysql.cursors import pytest class CursorTest(base.PyMySQLTestCase): def setUp(self): super().setUp() conn = self.connect() self.safe_create_table( conn, "test", "create table test ...
ER.QUERY_TIMEOUT)
self.assertEqual
complex_expr
pymysql/tests/test_cursor.py
test_execution_time_limit
CursorTest
199
null
PyMySQL/PyMySQL
import datetime import time import warnings import pytest import pymysql from pymysql.tests import base __all__ = ["TestOldIssues", "TestNewIssues", "TestGitHubIssues"] class TestGitHubIssues(base.PyMySQLTestCase): def test_issue_175(self): """The number of fields returned by server is read in wrong wa...
length
assert
variable
pymysql/tests/test_issues.py
test_issue_175
TestGitHubIssues
387
null
PyMySQL/PyMySQL
from pymysql.constants import ER from pymysql.tests import base import pymysql.cursors import pytest class CursorTest(base.PyMySQLTestCase): def setUp(self): super().setUp() conn = self.connect() self.safe_create_table( conn, "test", "create table test ...
m)
self.assertIsNotNone
variable
pymysql/tests/test_cursor.py
test_executemany
CursorTest
76
null
PyMySQL/PyMySQL
import pytest from pymysql.tests import base import pymysql.cursors from pymysql.constants import CLIENT, ER class TestSSCursor(base.PyMySQLTestCase): def test_execution_time_limit(self): # this method is similarly implemented in test_cursor conn = self.connect() # table creation and fi...
(1,))
self.assertEqual
collection
pymysql/tests/test_SSCursor.py
test_execution_time_limit
TestSSCursor
173
null
PyMySQL/PyMySQL
import unittest import pymysql _mysql = pymysql from pymysql.constants import FIELD_TYPE from pymysql.tests import base class CoreAPI(unittest.TestCase): def setUp(self): kwargs = base.PyMySQLTestCase.databases[0].copy() kwargs["read_default_file"] = "~/.my.cnf" self.conn = _mysql.connec...
isinstance(tid, int))
self.assertTrue
func_call
pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py
test_thread_id
CoreAPI
58
null
PyMySQL/PyMySQL
import datetime import time import warnings import pytest import pymysql from pymysql.tests import base __all__ = ["TestOldIssues", "TestNewIssues", "TestGitHubIssues"] class TestNewIssues(base.PyMySQLTestCase): def test_issue_37(self): conn = self.connect() c = conn.cursor() self.asser...
c.fetchone())
self.assertEqual
func_call
pymysql/tests/test_issues.py
test_issue_37
TestNewIssues
248
null
PyMySQL/PyMySQL
import pytest from pymysql.tests import base import pymysql.cursors from pymysql.constants import CLIENT, ER class TestSSCursor(base.PyMySQLTestCase): def test_warnings(self): con = self.connect() cur = con.cursor(pymysql.cursors.SSCursor) cur.execute("DROP TABLE IF EXISTS `no_exists_tabl...
0)
self.assertEqual
numeric_literal
pymysql/tests/test_SSCursor.py
test_warnings
TestSSCursor
222
null
PyMySQL/PyMySQL
import datetime import json import time import pytest import pymysql.cursors from pymysql.tests import base __all__ = ["TestConversion", "TestCursor", "TestBulkInserts"] class TestCursor(base.PyMySQLTestCase): def test_single_tuple(self): """test a single tuple""" conn = self.connect() ...
list(c.fetchall()))
self.assertEqual
func_call
pymysql/tests/test_basic.py
test_single_tuple
TestCursor
296
null
PyMySQL/PyMySQL
import datetime import json import time import pytest import pymysql.cursors from pymysql.tests import base __all__ = ["TestConversion", "TestCursor", "TestBulkInserts"] class TestConversion(base.PyMySQLTestCase): def test_datatypes(self): """test every data type""" conn = self.connect() ...
r[10])
self.assertEqual
complex_expr
pymysql/tests/test_basic.py
test_datatypes
TestConversion
63
null
PyMySQL/PyMySQL
import unittest import pymysql _mysql = pymysql from pymysql.constants import FIELD_TYPE from pymysql.tests import base class CoreModule(unittest.TestCase): def test_version(self): """Version information sanity.""" self.assertTrue(isinstance(_mysql.__version__, str)) self.assertTrue(isi...
5)
self.assertEqual
numeric_literal
pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py
test_version
CoreModule
36
null
PyMySQL/PyMySQL
import unittest import pymysql _mysql = pymysql from pymysql.constants import FIELD_TYPE from pymysql.tests import base class TestDBAPISet(unittest.TestCase): def test_set_inequality_membership(self): self.assertTrue(
FIELD_TYPE.DATE != pymysql.STRING)
self.assertTrue
complex_expr
pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py
test_set_inequality_membership
TestDBAPISet
21
null
PyMySQL/PyMySQL
import datetime import time import warnings import pytest import pymysql from pymysql.tests import base __all__ = ["TestOldIssues", "TestNewIssues", "TestGitHubIssues"] class TestGitHubIssues(base.PyMySQLTestCase): def test_issue_79(self): """Duplicate field overwrites the previous one in the result of...
22)
self.assertEqual
numeric_literal
pymysql/tests/test_issues.py
test_issue_79
TestGitHubIssues
325
null
PyMySQL/PyMySQL
import unittest import pymysql _mysql = pymysql from pymysql.constants import FIELD_TYPE from pymysql.tests import base class CoreModule(unittest.TestCase): def test_thread_safe(self): self.assertTrue(
isinstance(_mysql.thread_safe(), int))
self.assertTrue
func_call
pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py
test_thread_safe
CoreModule
42
null