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 |
|---|---|---|---|---|---|---|---|---|---|
ultrabug/mkdocs-static-i18n | import re
import logging
from pathlib import Path
from mkdocs.commands.build import build
from mkdocs.config.base import load_config
ADMONITIONS_CONFIG_WARNING = "mkdocs_static_i18n: admonition_translations used, but admonitions won't be rendered properly without 'admonition' in mkdocs.yml's markdown_extensions."
de... | [ 'Tip', # !!! tip 'Tip', # !!!tip 'Warning', # !!! warning (overrided) 'Heey', # !!! warning "Heey" 'Tip', # Indented !!! tip 'Tip', # !!! Tip (uppercase) 'Tip', # !!!Tip ] | assert | collection | tests/test_admonitions.py | test_plugin_no_use_directory_urls_default_language_only | 99 | null | |
ultrabug/mkdocs-static-i18n | import pytest
from mkdocs.config.base import load_config
from mkdocs.structure.files import get_files
from mkdocs.structure.nav import get_navigation
STATIC_NAV_DIRECTORY_URLS = {
"en": {"Home": "/", "Named File": "/topic1/named_file/", "Topic2": "/topic2/"},
"fr": {"Home": "/fr/", "Named File": "/fr/topic1/na... | control_data[language][page.title] | assert | complex_expr | tests/test_navigation.py | test_plugin_navigation | 238 | null | |
ultrabug/mkdocs-static-i18n | from pathlib import Path
from mkdocs.commands.build import build
from mkdocs.config.base import load_config
import pytest
USE_DIRECTORY_URLS = [
Path("english_default/index.en/index.html"),
Path("404.html"),
Path("assets/image_non_localized.png"),
Path("french_only/index.fr/index.html"),
Path("im... | sorted(PLUGIN_USE_DIRECTORY_URLS) | assert | func_call | tests/test_structure_suffix.py | test_plugin_use_directory_urls | 158 | null | |
ultrabug/mkdocs-static-i18n | from mkdocs.config.base import load_config
from mkdocs_static_i18n.plugin import I18n
def test_plugin_single_language_fr():
plugin = I18n()
plugin.load_config({"languages": [{"locale": "fr", "name": "français", "default": True}]})
config = load_config(
"tests/mkdocs.yml",
theme={"name": "m... | "fr" | assert | string_literal | tests/test_config.py | test_plugin_single_language_fr | 29 | null | |
ultrabug/mkdocs-static-i18n | from pathlib import Path
import pytest
from mkdocs.commands.build import build
from mkdocs.config.base import load_config
USE_DIRECTORY_URLS = [
Path("404.html"),
Path("assets/image_non_localized.png"),
Path("en/english_default/index.html"),
Path("en/image.fake"),
Path("en/image.png"),
Path("e... | sorted(PLUGIN_NO_USE_DIRECTORY_URLS_DEFAULT_ONLY) | assert | func_call | tests/test_structure_folder.py | test_plugin_no_use_directory_urls_default_language_only | 322 | null | |
ultrabug/mkdocs-static-i18n | from mkdocs.commands.build import build
from mkdocs.config.base import load_config
def test_search_no_add_lang():
mkdocs_config = load_config(
"tests/mkdocs.yml",
theme={"name": "mkdocs"},
use_directory_urls=True,
docs_dir="docs_suffix_structure_two_languages/",
plugins={
... | ["en"] | assert | collection | tests/test_search.py | test_search_no_add_lang | 166 | null | |
ultrabug/mkdocs-static-i18n | from pathlib import Path
from mkdocs.commands.build import build
from mkdocs.config.base import load_config
def test_rtd_fontfiles():
config_base_rtd = load_config(
"tests/mkdocs.yml",
theme={"name": "readthedocs"},
use_directory_urls=True,
docs_dir="docs_suffix_structure_two_langu... | sorted(i18n_font_files) | assert | func_call | tests/test_rtd.py | test_rtd_fontfiles | 46 | null | |
ultrabug/mkdocs-static-i18n | import re
import logging
from pathlib import Path
from mkdocs.commands.build import build
from mkdocs.config.base import load_config
ADMONITIONS_CONFIG_WARNING = "mkdocs_static_i18n: admonition_translations used, but admonitions won't be rendered properly without 'admonition' in mkdocs.yml's markdown_extensions."
de... | [ 'Conseil', # !!! tip 'Conseil', # !!!tip 'Avertissement', # !!! warning (overrided) 'Heey', # !!! warning "Heey" 'Conseil', # Indented !!! tip 'Conseil', # !!! Tip (uppercase) 'Conseil', # !!!Tip ] | assert | collection | tests/test_admonitions.py | test_plugin_no_use_directory_urls_default_language_only | 111 | null | |
ultrabug/mkdocs-static-i18n | from mkdocs.commands.build import build
from mkdocs.config.base import load_config
def test_plugin_language_selector_single_default_language():
mkdocs_config = load_config(
"tests/mkdocs.yml",
theme={"name": "material"},
use_directory_urls=True,
docs_dir="docs_suffix_structure_one_l... | {} | assert | collection | tests/test_language_selector.py | test_plugin_language_selector_single_default_language | 98 | null | |
ultrabug/mkdocs-static-i18n | from pathlib import Path
import pytest
from mkdocs.commands.build import build
from mkdocs.config.base import load_config
USE_DIRECTORY_URLS = [
Path("404.html"),
Path("assets/image_non_localized.png"),
Path("en/english_default/index.html"),
Path("en/image.fake"),
Path("en/image.png"),
Path("e... | sorted(USE_DIRECTORY_URLS) | assert | func_call | tests/test_structure_folder.py | test_build_use_directory_urls | 62 | null | |
ultrabug/mkdocs-static-i18n | from pathlib import Path
import pytest
from mkdocs.commands.build import build
from mkdocs.config.base import load_config
USE_DIRECTORY_URLS = [
Path("404.html"),
Path("assets/image_non_localized.png"),
Path("en/english_default/index.html"),
Path("en/image.fake"),
Path("en/image.png"),
Path("e... | sorted(PLUGIN_USE_DIRECTORY_URLS_DEFAULT_ONLY) | assert | func_call | tests/test_structure_folder.py | test_plugin_use_directory_urls_default_language_only | 290 | null | |
ultrabug/mkdocs-static-i18n | from pathlib import Path
from mkdocs.commands.build import build
from mkdocs.config.base import load_config
import pytest
USE_DIRECTORY_URLS = [
Path("english_default/index.en/index.html"),
Path("404.html"),
Path("assets/image_non_localized.png"),
Path("french_only/index.fr/index.html"),
Path("im... | sorted(NO_USE_DIRECTORY_URLS) | assert | func_call | tests/test_structure_suffix.py | test_build_no_use_directory_urls | 79 | null | |
ultrabug/mkdocs-static-i18n | from pathlib import Path
from mkdocs.commands.build import build
from mkdocs.config.base import load_config
import pytest
USE_DIRECTORY_URLS = [
Path("english_default/index.en/index.html"),
Path("404.html"),
Path("assets/image_non_localized.png"),
Path("french_only/index.fr/index.html"),
Path("im... | sorted(PLUGIN_NO_USE_DIRECTORY_URLS) | assert | func_call | tests/test_structure_suffix.py | test_plugin_no_use_directory_urls | 225 | null | |
ultrabug/mkdocs-static-i18n | from pathlib import Path
import pytest
from mkdocs.commands.build import build
from mkdocs.config.base import load_config
USE_DIRECTORY_URLS = [
Path("404.html"),
Path("assets/image_non_localized.png"),
Path("en/english_default/index.html"),
Path("en/image.fake"),
Path("en/image.png"),
Path("e... | sorted(PLUGIN_NO_USE_DIRECTORY_URLS) | assert | func_call | tests/test_structure_folder.py | test_plugin_no_use_directory_urls | 230 | null | |
ultrabug/mkdocs-static-i18n | import re
import logging
from pathlib import Path
from mkdocs.commands.build import build
from mkdocs.config.base import load_config
ADMONITIONS_CONFIG_WARNING = "mkdocs_static_i18n: admonition_translations used, but admonitions won't be rendered properly without 'admonition' in mkdocs.yml's markdown_extensions."
de... | warning_list.messages | assert | complex_expr | tests/test_admonitions.py | test_invalid_config | 55 | null | |
ultrabug/mkdocs-static-i18n | from mkdocs.commands.build import build
from mkdocs.config.base import load_config
def test_search_add_lang():
mkdocs_config = load_config(
"tests/mkdocs.yml",
theme={"name": "mkdocs"},
use_directory_urls=True,
docs_dir="docs_suffix_structure_two_languages/",
plugins={
... | ["en", "fr"] | assert | collection | tests/test_search.py | test_search_add_lang | 110 | null | |
ultrabug/mkdocs-static-i18n | import pytest
from mkdocs.commands.build import build
def navigate(nav):
for item in nav:
if item.children:
for child in navigate(item.children):
yield child
yield item
@pytest.mark.parametrize(
"control_data,test_data",
[
(
{"mkdocs_fp": "te... | test_nav.__str__() | assert | func_call | tests/test_control.py | test_control_single | 87 | null | |
ultrabug/mkdocs-static-i18n | import pytest
from mkdocs.config.base import load_config
from mkdocs.exceptions import Abort
def test_plugin_languages_no_default():
with pytest.raises( | Abort) | pytest.raises | variable | tests/test_languages_option.py | test_plugin_languages_no_default | 7 | null | |
ultrabug/mkdocs-static-i18n | from pathlib import Path
from mkdocs.commands.build import build
from mkdocs.config.base import load_config
import pytest
USE_DIRECTORY_URLS = [
Path("english_default/index.en/index.html"),
Path("404.html"),
Path("assets/image_non_localized.png"),
Path("french_only/index.fr/index.html"),
Path("im... | sorted(USE_DIRECTORY_URLS) | assert | func_call | tests/test_structure_suffix.py | test_build_use_directory_urls | 63 | null | |
ultrabug/mkdocs-static-i18n | import pytest
from mkdocs.config.base import ValidationError
from mkdocs_static_i18n.config import Locale
def test_locale_invalid_values():
locale = Locale(str)
invalid_locales = [
"123", # language code must be two-letter ISO-639-1
"english", # language code must be two-letter ISO-639-1
... | ValidationError) | pytest.raises | variable | tests/test_locale_type.py | test_locale_invalid_values | 44 | null | |
ultrabug/mkdocs-static-i18n | from pathlib import Path
import pytest
from mkdocs.commands.build import build
from mkdocs.config.base import load_config
USE_DIRECTORY_URLS = [
Path("404.html"),
Path("assets/image_non_localized.png"),
Path("en/english_default/index.html"),
Path("en/image.fake"),
Path("en/image.png"),
Path("e... | sorted(NO_USE_DIRECTORY_URLS) | assert | func_call | tests/test_structure_folder.py | test_build_no_use_directory_urls | 78 | null | |
ultrabug/mkdocs-static-i18n | import pytest
from mkdocs.config.base import ValidationError
from mkdocs_static_i18n.config import Locale
def test_locale_null_value():
locale = Locale(str)
assert locale.run_validation("null") == | "null" | assert | string_literal | tests/test_locale_type.py | test_locale_null_value | 50 | null | |
ultrabug/mkdocs-static-i18n | import pytest
from mkdocs.config.base import load_config
from mkdocs.exceptions import Abort
def test_plugin_build_only_locale():
mkdocs_config = load_config(
"tests/mkdocs.yml",
theme={"name": "material"},
docs_dir="docs_suffix_structure_two_languages/",
plugins={
"i18n... | True | assert | bool_literal | tests/test_languages_option.py | test_plugin_build_only_locale | 287 | null | |
ultrabug/mkdocs-static-i18n | import re
import logging
from pathlib import Path
from mkdocs.commands.build import build
from mkdocs.config.base import load_config
def test_plugin_no_use_directory_urls_default_language_only():
mkdocs_config = load_config(
"tests/mkdocs.yml",
theme={"name": "material"},
docs_dir="details... | [ 'Tip', # ??? tip 'Tip', # ???tip 'Tip', # ???+ tip 'Tip', # ???+tip 'Warning', # ??? warning (overrided) 'Heey', # ??? warning "Heey" 'Tip', # Indented ??? tip 'Tip', # Indented ???+ tip 'Tip', # ??? Tip (uppercase) 'Tip', # ???+ Tip 'Tip', # ???Tip 'Tip', # ???+Tip ] | assert | collection | tests/test_details.py | test_plugin_no_use_directory_urls_default_language_only | 42 | null | |
ultrabug/mkdocs-static-i18n | import pytest
from mkdocs.commands.build import build
def navigate(nav):
for item in nav:
if item.children:
for child in navigate(item.children):
yield child
yield item
@pytest.mark.parametrize(
"control_data,test_data",
[
(
{"mkdocs_fp": "te... | test_page.name | assert | complex_expr | tests/test_control.py | test_control_single | 95 | null | |
ultrabug/mkdocs-static-i18n | import pytest
from mkdocs.config.base import load_config
from mkdocs.structure.files import get_files
from mkdocs.structure.nav import get_navigation
STATIC_NAV_DIRECTORY_URLS = {
"en": {"Home": "/", "Named File": "/topic1/named_file/", "Topic2": "/topic2/"},
"fr": {"Home": "/fr/", "Named File": "/fr/topic1/na... | control_data[language] | assert | complex_expr | tests/test_navigation.py | test_plugin_navigation | 237 | null | |
ultrabug/mkdocs-static-i18n | import pytest
from mkdocs.commands.build import build
def navigate(nav):
for item in nav:
if item.children:
for child in navigate(item.children):
yield child
yield item
@pytest.mark.parametrize(
"control_data,test_data",
[
(
{"mkdocs_fp": "te... | test_env.filters.keys() | assert | func_call | tests/test_control.py | test_control_single | 88 | null | |
ultrabug/mkdocs-static-i18n | from pathlib import Path
from mkdocs.commands.build import build
from mkdocs.config.base import load_config
import pytest
USE_DIRECTORY_URLS = [
Path("english_default/index.en/index.html"),
Path("404.html"),
Path("assets/image_non_localized.png"),
Path("french_only/index.fr/index.html"),
Path("im... | sorted(PLUGIN_NO_USE_DIRECTORY_URLS_DEFAULT_ONLY) | assert | func_call | tests/test_structure_suffix.py | test_plugin_no_use_directory_urls_default_language_only | 315 | null | |
ultrabug/mkdocs-static-i18n | from mkdocs.commands.build import build
from mkdocs.config.base import load_config
def test_plugin_language_selector_fixed_link():
mkdocs_config = load_config(
"tests/mkdocs.yml",
theme={"name": "material"},
docs_dir="docs_suffix_structure_two_languages/",
plugins={
"i18... | [ {"name": "english", "link": "/en", "lang": "en"}, {"name": "français", "link": "/fr", "lang": "fr"}, ] | assert | collection | tests/test_language_selector.py | test_plugin_language_selector_fixed_link | 122 | null | |
ultrabug/mkdocs-static-i18n | from mkdocs.commands.build import build
from mkdocs.config.base import load_config
def test_plugin_language_selector_with_null():
mkdocs_config = load_config(
"tests/mkdocs.yml",
theme={"name": "material"},
use_directory_urls=True,
docs_dir="docs_suffix_structure_two_languages/",
... | [ {"name": "english", "link": "/", "lang": "en"}, {"name": "français", "link": "/fr/", "lang": "fr"}, {"name": "help", "link": "https://ultrabug.fr", "lang": "null"} ] | assert | collection | tests/test_language_selector.py | test_plugin_language_selector_with_null | 185 | null | |
ultrabug/mkdocs-static-i18n | from mkdocs.commands.build import build
from mkdocs.config.base import load_config
def test_plugin_language_selector_no_use_directory_urls():
mkdocs_config = load_config(
"tests/mkdocs.yml",
theme={"name": "material"},
use_directory_urls=False,
docs_dir="docs_suffix_structure_two_la... | [ {"name": "english", "link": "/index.html", "lang": "en"}, { "name": "français", "link": "/fr/index.html", "lang": "fr", }, ] | assert | collection | tests/test_language_selector.py | test_plugin_language_selector_no_use_directory_urls | 45 | null | |
ultrabug/mkdocs-static-i18n | from pathlib import Path
from mkdocs.commands.build import build
from mkdocs.config.base import load_config
import pytest
USE_DIRECTORY_URLS = [
Path("english_default/index.en/index.html"),
Path("404.html"),
Path("assets/image_non_localized.png"),
Path("french_only/index.fr/index.html"),
Path("im... | sorted(PLUGIN_USE_DIRECTORY_URLS_DEFAULT_ONLY) | assert | func_call | tests/test_structure_suffix.py | test_plugin_use_directory_urls_default_language_only | 284 | null | |
ultrabug/mkdocs-static-i18n | from mkdocs.commands.build import build
from mkdocs.config.base import load_config
def test_search_entries():
for theme in ["mkdocs", "material"]:
mkdocs_config = load_config(
"tests/mkdocs.yml",
theme={"name": theme},
use_directory_urls=True,
docs_dir="docs_... | 26 | assert | numeric_literal | tests/test_search.py | test_search_entries | 34 | null | |
ultrabug/mkdocs-static-i18n | from mkdocs.commands.build import build
from mkdocs.config.base import load_config
def test_search_entries_no_directory_urls():
mkdocs_config = load_config(
"tests/mkdocs.yml",
theme={"name": "mkdocs"},
use_directory_urls=False,
docs_dir="docs_suffix_structure_two_languages/",
... | 36 | assert | numeric_literal | tests/test_search.py | test_search_entries_no_directory_urls | 59 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from aiomysql import ProgrammingError, Cursor, InterfaceError, OperationalError
from aiomysql.cursors import RE_INSERT_VALUES
async def _prepare(conn):
cur = await conn.cursor()
await cur.execute("DROP TABLE IF EXISTS tbl;")
await cur.execute("""CREATE TABLE tbl (
... | 2 | assert | numeric_literal | tests/test_cursor.py | test_description | 45 | null | |
aio-libs/aiomysql | import datetime
import json
import re
import time
import pytest
from pymysql.err import ProgrammingError
def datatype_table(loop, cursor, table_cleanup):
async def f():
await cursor.execute(
"CREATE TABLE test_datatypes (b bit, i int, l bigint, f real, s "
"varchar(32), u varchar(3... | r[1:9] | assert | complex_expr | tests/test_basic.py | test_datatypes | 46 | null | |
aio-libs/aiomysql | import unittest
import sqlalchemy
from aiomysql.sa.connection import _distill_params
class DistillArgsTest(unittest.TestCase):
def test_distill_multi_string_tuple(self):
self | [("arg", "arg")]) | self.assertEqual | collection | tests/sa/test_sa_distil.py | test_distill_multi_string_tuple | DistillArgsTest | 85 | null |
aio-libs/aiomysql | import datetime
import json
import re
import time
import pytest
from pymysql.err import ProgrammingError
def datatype_table(loop, cursor, table_cleanup):
async def f():
await cursor.execute(
"CREATE TABLE test_datatypes (b bit, i int, l bigint, f real, s "
"varchar(32), u varchar(3... | r[0] | assert | complex_expr | tests/test_basic.py | test_datatypes | 44 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from pymysql import NotSupportedError
from aiomysql import ProgrammingError, InterfaceError, OperationalError
from aiomysql.cursors import SSCursor
DATA = [
('America', '', 'America/Jamaica'),
('America', '', 'America/Los_Angeles'),
('America', '', 'America/Lima'),
('Amer... | NotSupportedError) | pytest.raises | variable | tests/test_sscursor.py | test_sscursor_scroll_errors | 140 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from sqlalchemy import MetaData, Table, Column, Integer, String
from aiomysql import sa
meta = MetaData()
tbl = Table('sa_tbl3', meta,
Column('id', Integer, nullable=False,
primary_key=True),
Column('name', String(255)))
def make_engine(connect... | RuntimeError) | pytest.raises | variable | tests/sa/test_sa_engine.py | test_not_context_manager | 126 | null | |
aio-libs/aiomysql | import datetime
import pytest
from pymysql.err import Warning
import aiomysql
async def disabled_test_issue_54(connection):
conn = connection
c = await conn.cursor()
await c.execute("drop table if exists issue54")
big_sql = "select * from issue54 where "
big_sql += " and ".join("%d=%d" % (i, i) f... | 1049 | assert | numeric_literal | tests/test_issues.py | test_issue_792 | 476 | null | |
aio-libs/aiomysql | import datetime
import pytest
from pymysql.err import Warning
import aiomysql
@pytest.mark.run_loop
async def test_issue_36(connection_creator):
conn = await connection_creator()
c = await conn.cursor()
# kill connections[0]
await c.execute("show processlist")
kill_id = None
rows = await c.fe... | ids | assert | variable | tests/test_issues.py | test_issue_36 | 259 | null | |
aio-libs/aiomysql | import copy
from aiomysql import create_pool
import pytest
def ensure_mysql_version(mysql_server):
if mysql_server["db_type"] != "mysql" \
or mysql_server["server_version_tuple_short"] != (8, 0):
pytest.skip("Not applicable for {} version: {}"
.format(mysql_server["db_type"... | 'caching_sha2_password' | assert | string_literal | tests/test_sha_connection.py | test_cached_sha256_nopw | 84 | null | |
aio-libs/aiomysql | import datetime
import pytest
from sqlalchemy import MetaData, Table, Column, Integer, String
from sqlalchemy import func, DateTime, Boolean
from aiomysql import sa
meta = MetaData()
table = Table('sa_tbl_default_test', meta,
Column('id', Integer, nullable=False, primary_key=True),
Column... | 100 | assert | numeric_literal | tests/sa/test_sa_default.py | test_default_fields | 78 | null | |
aio-libs/aiomysql | import warnings
import aiomysql
import pytest
from aiomysql import sa, create_pool, DictCursor, Cursor
from sqlalchemy import MetaData, Table, Column, Integer, String, func, select
meta = MetaData()
tbl = Table('tbl', meta,
Column('id', Integer, nullable=False, primary_key=True),
Column('name... | cnt | assert | variable | tests/test_async_with.py | test_sa_transaction | 157 | null | |
aio-libs/aiomysql | import datetime
import pytest
from pymysql.err import Warning
import aiomysql
@pytest.mark.run_loop
async def test_issue_6(connection_creator):
# test for exception: TypeError: ord() expected a character,
# but string of length 0 found
conn = await connection_creator(db='mysql')
c = await conn.cursor... | 'mysql' | assert | string_literal | tests/test_issues.py | test_issue_6 | 67 | null | |
aio-libs/aiomysql | import asyncio
import gc
import os
import pytest
import aiomysql
def fill_my_cnf(mysql_params):
tests_root = os.path.abspath(os.path.dirname(__file__))
if "unix_socket" in mysql_params:
tmpl_path = "fixtures/my.cnf.unix.tmpl"
else:
tmpl_path = "fixtures/my.cnf.tcp.tmpl"
path1 = os.p... | 'root' | assert | string_literal | tests/test_connection.py | test_config_file_with_different_group | 69 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from pymysql import NotSupportedError
from aiomysql import ProgrammingError, InterfaceError, OperationalError
from aiomysql.cursors import SSCursor
DATA = [
('America', '', 'America/Jamaica'),
('America', '', 'America/Los_Angeles'),
('America', '', 'America/Lima'),
('Amer... | 1 | assert | numeric_literal | tests/test_sscursor.py | test_ssursor | 54 | null | |
aio-libs/aiomysql | import datetime
import pytest
from pymysql.err import Warning
import aiomysql
@pytest.mark.run_loop
async def test_issue_3(connection):
""" undefined methods datetime_or_None, date_or_None """
conn = connection
c = await conn.cursor()
await c.execute("drop table if exists issue3")
await c.execute... | None | assert | none_literal | tests/test_issues.py | test_issue_3 | 23 | null | |
aio-libs/aiomysql | import unittest
import sqlalchemy
from aiomysql.sa.connection import _distill_params
class DistillArgsTest(unittest.TestCase):
def test_distill_single_string(self):
self | [["arg"]]) | self.assertEqual | collection | tests/sa/test_sa_distil.py | test_distill_single_string | DistillArgsTest | 79 | null |
aio-libs/aiomysql | import builtins
import os
from unittest.mock import patch, MagicMock
import aiomysql
import pytest
from pymysql.constants import CLIENT
from pymysql.err import OperationalError
def table_local_file(connection, loop):
async def prepare_table(conn):
c = await conn.cursor()
await c.execute("DROP TAB... | RuntimeError, match="Received LOAD_LOCAL packet but local_infile option is false") | pytest.raises | complex_expr | tests/test_load_local.py | test_load_local_disabled | 108 | null | |
aio-libs/aiomysql | import functools
import unittest
from unittest import mock
import pytest
from sqlalchemy import MetaData, Table, Column, Integer, String, func, select
from aiomysql import sa
meta = MetaData()
tbl = Table('sa_tbl2', meta,
Column('id', Integer, nullable=False,
primary_key=True),
... | conn | assert | variable | tests/sa/test_sa_transaction.py | test_connection_attr | 80 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from aiomysql.connection import Connection
from aiomysql.pool import Pool
async def _set_global_conn_timeout(conn, t):
# create separate connection to setup global connection timeouts
# https://dev.mysql.com/doc/refman/5.1/en/server-system-variables
# .html#sysvar_interactive_... | [(2, 0)] | assert | collection | tests/test_pool.py | test_cancelled_connection | 506 | null | |
aio-libs/aiomysql | import unittest
import sqlalchemy
from aiomysql.sa.connection import _distill_params
class DistillArgsTest(unittest.TestCase):
def test_distill_single_list_strings(self):
self | [["foo", "bar"]]) | self.assertEqual | collection | tests/sa/test_sa_distil.py | test_distill_single_list_strings | DistillArgsTest | 40 | null |
aio-libs/aiomysql | import asyncio
import pytest
from aiomysql import ProgrammingError, Cursor, InterfaceError, OperationalError
from aiomysql.cursors import RE_INSERT_VALUES
async def _prepare(conn):
cur = await conn.cursor()
await cur.execute("DROP TABLE IF EXISTS tbl;")
await cur.execute("""CREATE TABLE tbl (
... | True | assert | bool_literal | tests/test_cursor.py | test_close | 126 | null | |
aio-libs/aiomysql | import datetime
import pytest
from pymysql.err import Warning
import aiomysql
async def disabled_test_issue_54(connection):
conn = connection
c = await conn.cursor()
await c.execute("drop table if exists issue54")
big_sql = "select * from issue54 where "
big_sql += " and ".join("%d=%d" % (i, i) f... | 11 | assert | numeric_literal | tests/test_issues.py | test_issue_79 | 352 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from pymysql import NotSupportedError
from aiomysql import ProgrammingError, InterfaceError, OperationalError
from aiomysql.cursors import SSCursor
DATA = [
('America', '', 'America/Jamaica'),
('America', '', 'America/Los_Angeles'),
('America', '', 'America/Lima'),
('Amer... | None | assert | none_literal | tests/test_sscursor.py | test_max_execution_time | 279 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from sqlalchemy import MetaData, Table, Column, Integer, String
from aiomysql import sa
meta = MetaData()
tbl = Table('sa_tbl3', meta,
Column('id', Integer, nullable=False,
primary_key=True),
Column('name', String(255)))
def make_engine(connect... | engine.maxsize | assert | complex_expr | tests/sa/test_sa_engine.py | test_maxsize | 96 | null | |
aio-libs/aiomysql | import functools
import unittest
from unittest import mock
import pytest
from sqlalchemy import MetaData, Table, Column, Integer, String, func, select
from aiomysql import sa
meta = MetaData()
tbl = Table('sa_tbl2', meta,
Column('id', Integer, nullable=False,
primary_key=True),
... | res1 | assert | variable | tests/sa/test_sa_transaction.py | test_without_transactions | 65 | null | |
aio-libs/aiomysql | import pytest
from aiomysql import DictCursor
def table(loop, connection, table_cleanup):
async def f():
cursor = await connection.cursor(DictCursor)
sql = """CREATE TABLE bulkinsert (id INT(11), name CHAR(20),
age INT, height INT, PRIMARY KEY (id))"""
await cursor.execute(... | sorted(result) | assert | func_call | tests/test_bulk_inserts.py | f | 23 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from sqlalchemy import MetaData, Table, Column, Integer, String
from aiomysql import sa
meta = MetaData()
tbl = Table('sa_tbl3', meta,
Column('id', Integer, nullable=False,
primary_key=True),
Column('name', String(255)))
def make_engine(connect... | ops | assert | variable | tests/sa/test_sa_engine.py | test_wait_closed | 177 | null | |
aio-libs/aiomysql | from unittest import mock
import pytest
from sqlalchemy import MetaData, Table, Column, Integer, String, func, select
from sqlalchemy.schema import DropTable, CreateTable
from sqlalchemy.sql.expression import bindparam
import aiomysql
from aiomysql import sa, Cursor
meta = MetaData()
tbl = Table('sa_tbl', meta,
... | rows | assert | variable | tests/sa/test_sa_connection.py | test_fetchall | 330 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from sqlalchemy import MetaData, Table, Column, Integer, String
from aiomysql import sa
meta = MetaData()
tbl = Table('sa_tbl3', meta,
Column('id', Integer, nullable=False,
primary_key=True),
Column('name', String(255)))
def make_engine(connect... | sa.InvalidRequestError) | pytest.raises | complex_expr | tests/sa/test_sa_engine.py | test_release_transacted | 137 | null | |
aio-libs/aiomysql | import asyncio
import gc
import os
import re
import ssl
import aiomysql
import pymysql
import pytest
import uvloop
def disable_gc():
gc_enabled = gc.isenabled()
if gc_enabled:
gc.disable()
gc.collect()
yield
if gc_enabled:
gc.collect()
gc.enable()
def pytest_generate_t... | len(set(ids)) | assert | func_call | tests/conftest.py | pytest_generate_tests | 67 | null | |
aio-libs/aiomysql | import datetime
import pytest
import aiomysql.cursors
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 = {'name': 'fred', 'age': 100,
'DOB': datetime.datetime(1911, 9, 12, 1,... | r | assert | variable | tests/test_dictcursor.py | test_dictcursor | 49 | null | |
aio-libs/aiomysql | from unittest import mock
import pytest
from sqlalchemy import MetaData, Table, Column, Integer, String, func, select
from sqlalchemy.schema import DropTable, CreateTable
from sqlalchemy.sql.expression import bindparam
import aiomysql
from aiomysql import sa, Cursor
meta = MetaData()
tbl = Table('sa_tbl', meta,
... | row[0] | assert | complex_expr | tests/sa/test_sa_connection.py | test_execute_text_select | 49 | null | |
aio-libs/aiomysql | import functools
import unittest
from unittest import mock
import pytest
from sqlalchemy import MetaData, Table, Column, Integer, String, func, select
from aiomysql import sa
meta = MetaData()
tbl = Table('sa_tbl2', meta,
Column('id', Integer, nullable=False,
primary_key=True),
... | res | assert | variable | tests/sa/test_sa_transaction.py | test_inner_transaction_rollback | 243 | null | |
aio-libs/aiomysql | import unittest
import sqlalchemy
from aiomysql.sa.connection import _distill_params
class DistillArgsTest(unittest.TestCase):
def test_distill_dict_multi_none_param(self):
self | [{"foo": "bar"}]) | self.assertEqual | collection | tests/sa/test_sa_distil.py | test_distill_dict_multi_none_param | DistillArgsTest | 22 | null |
aio-libs/aiomysql | import asyncio
import gc
import os
import pytest
import aiomysql
def fill_my_cnf(mysql_params):
tests_root = os.path.abspath(os.path.dirname(__file__))
if "unix_socket" in mysql_params:
tmpl_path = "fixtures/my.cnf.unix.tmpl"
else:
tmpl_path = "fixtures/my.cnf.tcp.tmpl"
path1 = os.p... | 0 | assert | numeric_literal | tests/test_connection.py | test_autocommit | 142 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from aiomysql.connection import Connection
from aiomysql.pool import Pool
@pytest.mark.run_loop
async def test_true_parallel_tasks(pool_creator, loop):
pool = await pool_creator(minsize=0, maxsize=1)
assert 1 == pool.maxsize
assert 0 == pool.minsize
assert 0 == pool.size
... | maxsize | assert | variable | tests/test_pool.py | test_true_parallel_tasks | 311 | null | |
aio-libs/aiomysql | import datetime
import json
import re
import time
import pytest
from pymysql.err import ProgrammingError
def datatype_table(loop, cursor, table_cleanup):
async def f():
await cursor.execute(
"CREATE TABLE test_datatypes (b bit, i int, l bigint, f real, s "
"varchar(32), u varchar(3... | r[-1] | assert | complex_expr | tests/test_basic.py | test_datatypes | 55 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from aiomysql import ProgrammingError, Cursor, InterfaceError, OperationalError
from aiomysql.cursors import RE_INSERT_VALUES
async def _prepare(conn):
cur = await conn.cursor()
await cur.execute("DROP TABLE IF EXISTS tbl;")
await cur.execute("""CREATE TABLE tbl (
... | r | assert | variable | tests/test_cursor.py | test_fetchmany_no_result | 194 | null | |
aio-libs/aiomysql | from unittest import mock
import pytest
from sqlalchemy import MetaData, Table, Column, Integer, String, func, select
from sqlalchemy.schema import DropTable, CreateTable
from sqlalchemy.sql.expression import bindparam
import aiomysql
from aiomysql import sa, Cursor
meta = MetaData()
tbl = Table('sa_tbl', meta,
... | row[1] | assert | complex_expr | tests/sa/test_sa_connection.py | test_execute_text_select | 52 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from aiomysql import ProgrammingError, Cursor, InterfaceError, OperationalError
from aiomysql.cursors import RE_INSERT_VALUES
async def _prepare(conn):
cur = await conn.cursor()
await cur.execute("DROP TABLE IF EXISTS tbl;")
await cur.execute("""CREATE TABLE tbl (
... | ret | assert | variable | tests/test_cursor.py | test_scroll_relative | 81 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from aiomysql import ProgrammingError, Cursor, InterfaceError, OperationalError
from aiomysql.cursors import RE_INSERT_VALUES
async def _prepare(conn):
cur = await conn.cursor()
await cur.execute("DROP TABLE IF EXISTS tbl;")
await cur.execute("""CREATE TABLE tbl (
... | None | assert | none_literal | tests/test_cursor.py | test_description | 42 | null | |
aio-libs/aiomysql | import warnings
import aiomysql
import pytest
from aiomysql import sa, create_pool, DictCursor, Cursor
from sqlalchemy import MetaData, Table, Column, Integer, String, func, select
meta = MetaData()
tbl = Table('tbl', meta,
Column('id', Integer, nullable=False, primary_key=True),
Column('name... | ret | assert | variable | tests/test_async_with.py | test_cursor | 47 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from pymysql import NotSupportedError
from aiomysql import ProgrammingError, InterfaceError, OperationalError
from aiomysql.cursors import SSCursor
DATA = [
('America', '', 'America/Jamaica'),
('America', '', 'America/Los_Angeles'),
('America', '', 'America/Lima'),
('Amer... | (big_str,) | assert | collection | tests/test_sscursor.py | test_sscursor_cancel | 173 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from pymysql import NotSupportedError
from aiomysql import ProgrammingError, InterfaceError, OperationalError
from aiomysql.cursors import SSCursor
DATA = [
('America', '', 'America/Jamaica'),
('America', '', 'America/Los_Angeles'),
('America', '', 'America/Lima'),
('Amer... | ret | assert | variable | tests/test_sscursor.py | test_sscursor_scroll_relative | 118 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from sqlalchemy import MetaData, Table, Column, Integer, String
from aiomysql import sa
meta = MetaData()
tbl = Table('sa_tbl3', meta,
Column('id', Integer, nullable=False,
primary_key=True),
Column('name', String(255)))
def make_engine(connect... | engine.freesize | assert | complex_expr | tests/sa/test_sa_engine.py | test_freesize | 110 | null | |
aio-libs/aiomysql | import pytest
from aiomysql import DictCursor
def table(loop, connection, table_cleanup):
async def f():
cursor = await connection.cursor(DictCursor)
sql = """CREATE TABLE bulkinsert (id INT(11), name CHAR(20),
age INT, height INT, PRIMARY KEY (id))"""
await cursor.execute(... | sorted(result, key=lambda k: k['id']) | assert | func_call | tests/test_bulk_inserts.py | f | 35 | null | |
aio-libs/aiomysql | import datetime
import pytest
from pymysql.err import Warning
import aiomysql
@pytest.mark.run_loop
async def test_issue_37(connection):
conn = connection
c = await conn.cursor()
assert 1 == (await c.execute("SELECT @foo"))
r = await c.fetchone()
assert (None,) == | r | assert | variable | tests/test_issues.py | test_issue_37 | 272 | null | |
aio-libs/aiomysql | import warnings
import aiomysql
import pytest
from aiomysql import sa, create_pool, DictCursor, Cursor
from sqlalchemy import MetaData, Table, Column, Integer, String, func, select
meta = MetaData()
tbl = Table('tbl', meta,
Column('id', Integer, nullable=False, primary_key=True),
Column('name... | msg | assert | variable | tests/test_async_with.py | test_incompatible_cursor_fails | 273 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from aiomysql import ProgrammingError, Cursor, InterfaceError, OperationalError
from aiomysql.cursors import RE_INSERT_VALUES
async def _prepare(conn):
cur = await conn.cursor()
await cur.execute("DROP TABLE IF EXISTS tbl;")
await cur.execute("""CREATE TABLE tbl (
... | 'id' | assert | string_literal | tests/test_cursor.py | test_description | 51 | null | |
aio-libs/aiomysql | import datetime
import pytest
from sqlalchemy import MetaData, Table, Column, Integer, String
from sqlalchemy import func, DateTime, Boolean
from aiomysql import sa
meta = MetaData()
table = Table('sa_tbl_default_test', meta,
Column('id', Integer, nullable=False, primary_key=True),
Column... | 'default test' | assert | string_literal | tests/sa/test_sa_default.py | test_default_fields | 79 | null | |
aio-libs/aiomysql | from unittest import mock
import pytest
from sqlalchemy import MetaData, Table, Column, Integer, String, func, select
from sqlalchemy.schema import DropTable, CreateTable
from sqlalchemy.sql.expression import bindparam
import aiomysql
from aiomysql import sa, Cursor
meta = MetaData()
tbl = Table('sa_tbl', meta,
... | ret | assert | variable | tests/sa/test_sa_connection.py | test_async_iter | 468 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from aiomysql import ProgrammingError, Cursor, InterfaceError, OperationalError
from aiomysql.cursors import RE_INSERT_VALUES
async def _prepare(conn):
cur = await conn.cursor()
await cur.execute("DROP TABLE IF EXISTS tbl;")
await cur.execute("""CREATE TABLE tbl (
... | conn | assert | variable | tests/test_cursor.py | test_cursor_properties | 67 | null | |
aio-libs/aiomysql | import warnings
import aiomysql
import pytest
from aiomysql import sa, create_pool, DictCursor, Cursor
from sqlalchemy import MetaData, Table, Column, Integer, String, func, select
meta = MetaData()
tbl = Table('tbl', meta,
Column('id', Integer, nullable=False, primary_key=True),
Column('name... | "Exit" | assert | string_literal | tests/test_async_with.py | test_sa_transaction_rollback | 180 | null | |
aio-libs/aiomysql | from aiomysql import create_pool
import pytest
@pytest.mark.run_loop
async def test_tls_connect(mysql_server, loop, mysql_params):
if "unix_socket" in mysql_params:
pytest.skip("TLS is not supported on unix sockets")
async with create_pool(**mysql_server['conn_params'],
loo... | values | assert | variable | tests/test_ssl.py | test_tls_connect | 22 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from sqlalchemy import MetaData, Table, Column, Integer, String
from aiomysql import sa
meta = MetaData()
tbl = Table('sa_tbl3', meta,
Column('id', Integer, nullable=False,
primary_key=True),
Column('name', String(255)))
def make_engine(connect... | engine.size | assert | complex_expr | tests/sa/test_sa_engine.py | test_size | 103 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from sqlalchemy import MetaData, Table, Column, Integer, String
from aiomysql import sa
meta = MetaData()
tbl = Table('sa_tbl3', meta,
Column('id', Integer, nullable=False,
primary_key=True),
Column('name', String(255)))
def make_engine(connect... | engine.name | assert | complex_expr | tests/sa/test_sa_engine.py | test_name | 69 | null | |
aio-libs/aiomysql | import warnings
import aiomysql
import pytest
from aiomysql import sa, create_pool, DictCursor, Cursor
from sqlalchemy import MetaData, Table, Column, Integer, String, func, select
meta = MetaData()
tbl = Table('tbl', meta,
Column('id', Integer, nullable=False, primary_key=True),
Column('name... | (42,) | assert | collection | tests/test_async_with.py | test_cursor_method | 67 | null | |
aio-libs/aiomysql | import pytest
from aiomysql import DictCursor
def table(loop, connection, table_cleanup):
async def f():
cursor = await connection.cursor(DictCursor)
sql = """CREATE TABLE bulkinsert (id INT(11), name CHAR(20),
age INT, height INT, PRIMARY KEY (id))"""
await cursor.execute(... | bytearray( b"REPLACE INTO bulkinsert (id, name, age, height) " + b"VALUES (0,'bob',21,123),(0,'jim',56,45)" ) | assert | func_call | tests/test_bulk_inserts.py | test_bulk_replace | 171 | null | |
aio-libs/aiomysql | import pytest
from aiomysql import DictCursor
def table(loop, connection, table_cleanup):
async def f():
cursor = await connection.cursor(DictCursor)
sql = """CREATE TABLE bulkinsert (id INT(11), name CHAR(20),
age INT, height INT, PRIMARY KEY (id))"""
await cursor.execute(... | data) | assert_* | variable | tests/test_bulk_inserts.py | test_bulk_insert | 51 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from pymysql.err import ProgrammingError
@pytest.mark.run_loop
async def test_nextset(cursor):
await cursor.execute("SELECT 1; SELECT 2;")
r = await cursor.fetchall()
assert [(1,)] == list(r)
r = await cursor.nextset()
assert r
r = await cursor.fetchall()
ass... | None | assert | none_literal | tests/test_nextset.py | test_nextset | 19 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from pymysql import NotSupportedError
from aiomysql import ProgrammingError, InterfaceError, OperationalError
from aiomysql.cursors import SSCursor
DATA = [
('America', '', 'America/Jamaica'),
('America', '', 'America/Los_Angeles'),
('America', '', 'America/Lima'),
('Amer... | 1969 | assert | numeric_literal | tests/test_sscursor.py | test_max_execution_time | 307 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from pymysql.err import ProgrammingError
@pytest.mark.xfail
@pytest.mark.run_loop
async def test_multi_cursorxx(connection):
cur1 = await connection.cursor()
cur2 = await connection.cursor()
await cur1.execute("SELECT 1; SELECT 2;")
await cur2.execute("SELECT 42")
r1... | list(r1) | assert | func_call | tests/test_nextset.py | test_multi_cursorxx | 73 | null | |
aio-libs/aiomysql | import unittest
import sqlalchemy
from aiomysql.sa.connection import _distill_params
class DistillArgsTest(unittest.TestCase):
def test_distill_none(self):
self | []) | self.assertEqual | collection | tests/sa/test_sa_distil.py | test_distill_none | DistillArgsTest | 10 | null |
aio-libs/aiomysql | import builtins
import os
from unittest.mock import patch, MagicMock
import aiomysql
import pytest
from pymysql.constants import CLIENT
from pymysql.err import OperationalError
def table_local_file(connection, loop):
async def prepare_table(conn):
c = await conn.cursor()
await c.execute("DROP TAB... | OperationalError) | pytest.raises | variable | tests/test_load_local.py | test_no_file | 37 | null | |
aio-libs/aiomysql | import asyncio
import pytest
from pymysql import NotSupportedError
from aiomysql import ProgrammingError, InterfaceError, OperationalError
from aiomysql.cursors import SSCursor
DATA = [
('America', '', 'America/Jamaica'),
('America', '', 'America/Los_Angeles'),
('America', '', 'America/Lima'),
('Amer... | len(DATA) | assert | func_call | tests/test_sscursor.py | test_ssursor | 61 | null | |
aio-libs/aiomysql | import warnings
import aiomysql
import pytest
from aiomysql import sa, create_pool, DictCursor, Cursor
from sqlalchemy import MetaData, Table, Column, Integer, String, func, select
meta = MetaData()
tbl = Table('tbl', meta,
Column('id', Integer, nullable=False, primary_key=True),
Column('name... | RuntimeError) | pytest.raises | variable | tests/test_async_with.py | test_connection_exception | 84 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.