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 |
|---|---|---|---|---|---|---|---|---|---|
karlicoss/HPI | from __future__ import annotations
import collections.abc
import importlib
import inspect
import typing
from collections.abc import Callable, Iterable, Iterator, Sequence
from contextlib import contextmanager
from datetime import datetime
from pathlib import Path
from types import ModuleType
from typing import (
A... | 1 | assert | numeric_literal | src/my/core/stats.py | test_sig_required_params | 308 | null | |
karlicoss/HPI | from collections.abc import Iterator
import pytest
from more_itertools import one
from my.bluemaestro import Measurement, measurements
from my.core.cfg import tmp_config
from .common import testdata
def ok_measurements() -> Iterator[Measurement]:
for m in measurements():
assert not isinstance(m, Excepti... | 16.8 | assert | numeric_literal | src/my/tests/bluemaestro.py | test_old_db | 41 | null | |
karlicoss/HPI | from __future__ import annotations
import dataclasses
from collections.abc import Callable, Iterable, Iterator
from datetime import datetime, timezone
from pprint import pformat
from typing import (
TYPE_CHECKING,
Any,
Literal,
)
from decorator import decorator
from . import warnings
from .error import R... | pd.DataFrame(columns=['error'])) | assert_* | func_call | src/my/core/pandas.py | test_as_dataframe | 227 | null | |
karlicoss/HPI | from __future__ import annotations
import collections.abc
import importlib
import inspect
import typing
from collections.abc import Callable, Iterable, Iterator, Sequence
from contextlib import contextmanager
from datetime import datetime
from pathlib import Path
from types import ModuleType
from typing import (
A... | dd | assert | variable | src/my/core/stats.py | test_guess_datetime | 459 | null | |
karlicoss/HPI | from __future__ import annotations
import re
import traceback
from collections.abc import Callable, Iterable, Iterator
from datetime import date, datetime
from itertools import tee
from typing import Any, Literal, cast
from .types import Json
from .warnings import medium
ErrorPolicy = Literal["yield", "raise", "drop... | None | assert | none_literal | src/my/core/error.py | notnone | 26 | null | |
karlicoss/HPI | from __future__ import annotations
import warnings
from collections.abc import Callable, Hashable, Iterable, Iterator, Sized
from typing import TYPE_CHECKING, cast
import more_itertools
from decorator import decorator
from .. import warnings as core_warnings
def _identity[T, V](v: T) -> V: # type: ignore[type-var]... | [1, 2, 3] | assert | collection | src/my/core/utils/itertools.py | test_ensure_unique | 39 | null | |
karlicoss/HPI | from pathlib import Path
import pytest
import pytz
from my.body.weight import from_orgmode
from my.core.cfg import tmp_config
def test_body_weight() -> None:
weights = [0.0 if isinstance(x, Exception) else x.value for x in from_orgmode()]
assert weights == | [ 0.0, 62.0, 0.0, 61.0, 62.0, 0.0, ] | assert | collection | src/my/tests/body/weight.py | test_body_weight | 13 | null | |
karlicoss/HPI | import os
import zipfile
from pathlib import Path
import pytest
from kompress import CPath, ZipPath
from ..common import get_files
def test_no_files(tmp_path_cwd: Path) -> None:
'''
Test for empty matches. They work, but should result in warning
'''
assert get_files('') == | () | assert | collection | src/my/core/tests/test_get_files.py | test_no_files | 146 | null | |
karlicoss/HPI | from __future__ import annotations
REQUIRES = 'REQUIRES'
NOT_HPI_MODULE_VAR = '__NOT_HPI_MODULE__'
import ast
import logging
import os
import re
from collections.abc import Iterable, Sequence
from pathlib import Path
from typing import Any, NamedTuple, cast
def ignored(m: str) -> bool:
excluded = [
# leg... | m.name | assert | complex_expr | src/my/core/discovery_pure.py | test_excluded | 223 | null | |
karlicoss/HPI | from __future__ import annotations
import dataclasses
import importlib
import inspect
import itertools
from collections.abc import Callable, Iterable, Iterator
from datetime import datetime
from typing import Any, NamedTuple
import more_itertools
from . import error as err
from .error import Res, unwrap
from .types ... | 4 | assert | numeric_literal | src/my/core/query.py | test_drop_unsorted | 672 | null | |
karlicoss/HPI | from __future__ import annotations
import dataclasses
from collections.abc import Callable, Iterable, Iterator
from datetime import datetime, timezone
from pprint import pformat
from typing import (
TYPE_CHECKING,
Any,
Literal,
)
from decorator import decorator
from . import warnings
from .error import R... | 0 | assert | numeric_literal | src/my/core/pandas.py | test_check_dateish | 92 | null | |
karlicoss/HPI | from __future__ import annotations
import warnings
from collections.abc import Callable, Hashable, Iterable, Iterator, Sized
from typing import TYPE_CHECKING, cast
import more_itertools
from decorator import decorator
from .. import warnings as core_warnings
def _identity[T, V](v: T) -> V: # type: ignore[type-var]... | [] | assert | collection | src/my/core/utils/itertools.py | test_warn_if_empty_iterator | 174 | null | |
karlicoss/HPI | import os
import zipfile
from pathlib import Path
import pytest
from kompress import CPath, ZipPath
from ..common import get_files
def test_single_file(tmp_path_cwd: Path) -> None:
'''
Regular file path is just returned as is.
'''
# Exception if it doesn't exist"
with pytest.raises( | Exception) | pytest.raises | variable | src/my/core/tests/test_get_files.py | test_single_file | 17 | null | |
karlicoss/HPI | import os
import sys
from pathlib import Path
import pytest
import pytz
import my.config
from my.core import notnone
from my.demo import items, make_config
from .common import tmp_environ_set
@pytest.mark.parametrize('run_id', ['1', '2'])
def test_override_config(tmp_path: Path, run_id: str) -> None:
class user... | f'user_{run_id}' | assert | string_literal | src/my/core/tests/test_config.py | test_override_config | 31 | null | |
karlicoss/HPI | from __future__ import annotations
import os
import traceback
from collections.abc import Callable, Iterable, Sequence
from glob import glob as do_glob
from pathlib import Path
from typing import TYPE_CHECKING
from . import compat, warnings
PathIsh = Path | str
Paths = Sequence[PathIsh] | PathIsh
DEFAULT_GLOB = '*... | 'hello' | assert | string_literal | src/my/core/common.py | test_classproperty | 125 | null | |
karlicoss/HPI | from __future__ import annotations
from .common import skip_if_uses_optional_deps as pytestmark # noqa: F401
def test_cachew_dir_none() -> None:
from cachew import settings
settings.ENABLE = True # by default it's off in tests (see conftest.py)
from my.core.cachew import cache_dir, mcachew
from my... | [1, 1, 1] | assert | collection | src/my/core/tests/test_cachew.py | test_cachew_dir_none | 51 | null | |
karlicoss/HPI | from importlib import reload
from pathlib import Path
from my.core.common import get_valid_filename
ROOT = Path(__file__).parent.absolute()
OUTPUTS = ROOT / 'outputs'
import pytest
def test_hpi(prepare: str) -> None:
from my.polar import get_entries
assert len(list(get_entries())) > | 1 | assert | numeric_literal | old/test_polar.py | test_hpi | 15 | null | |
karlicoss/HPI | from pathlib import Path
import pytest
from ..structure import match_structure
structure_data: Path = Path(__file__).parent / "structure_data"
gdpr_expected = ("comments", "messages/index.csv", "profile")
def test_match_partial() -> None:
# a partial match should match both the 'broken' and 'gdpr_export' direc... | 2 | assert | numeric_literal | src/my/core/tests/structure.py | test_match_partial | 32 | null | |
karlicoss/HPI | from __future__ import annotations
import collections.abc
import importlib
import inspect
import typing
from collections.abc import Callable, Iterable, Iterator, Sequence
from contextlib import contextmanager
from datetime import datetime
from pathlib import Path
from types import ModuleType
from typing import (
A... | 1 + 1 | assert | complex_expr | src/my/core/stats.py | test_stat_iterable | 427 | null | |
karlicoss/HPI | from __future__ import annotations
import re
import time
from collections.abc import Callable, Iterator
from datetime import date, datetime, timedelta
from functools import cache
from typing import Any, NamedTuple
import more_itertools
from .query import (
ET,
OrderFunc,
QueryException,
Where,
_h... | parse_datetime_float(dt_float_s) | assert | func_call | src/my/core/query_range.py | test_parse_datetime_float | 548 | null | |
karlicoss/HPI | from __future__ import annotations
import re
import traceback
from collections.abc import Callable, Iterable, Iterator
from datetime import date, datetime
from itertools import tee
from typing import Any, Literal, cast
from .types import Json
from .warnings import medium
ErrorPolicy = Literal["yield", "raise", "drop... | [Exc('last'), 0, *results[:-1]] | assert | collection | src/my/core/error.py | test_sort_res_by | 147 | null | |
karlicoss/HPI | from collections.abc import Iterator
import pytest
from more_itertools import one
from my.bluemaestro import Measurement, measurements
from my.core.cfg import tmp_config
from .common import testdata
def ok_measurements() -> Iterator[Measurement]:
for m in measurements():
assert not isinstance(m, Excepti... | 1 | assert | numeric_literal | src/my/tests/bluemaestro.py | test | 29 | null | |
karlicoss/HPI | from __future__ import annotations
import re
import time
from collections.abc import Callable, Iterator
from datetime import date, datetime, timedelta
from functools import cache
from typing import Any, NamedTuple
import more_itertools
from .query import (
ET,
OrderFunc,
QueryException,
Where,
_h... | normal | assert | variable | src/my/core/query_range.py | test_filter_in_timeframe | 444 | null | |
karlicoss/HPI | from __future__ import annotations
from my.core import __NOT_HPI_MODULE__ # noqa: F401 # isort: skip
import re
from collections.abc import Callable, Iterable
from datetime import datetime
from enum import Enum
from html.parser import HTMLParser
from pathlib import Path
from typing import Any
from urllib.parse impor... | 0 | assert | numeric_literal | src/my/google/takeout/html.py | handle_endtag | TakeoutHTMLParser | 115 | null |
karlicoss/HPI | from __future__ import annotations
import dataclasses
from collections.abc import Callable, Iterable, Iterator
from datetime import datetime, timezone
from pprint import pformat
from typing import (
TYPE_CHECKING,
Any,
Literal,
)
from decorator import decorator
from . import warnings
from .error import R... | [] | assert | collection | src/my/core/pandas.py | test_check_dateish | 69 | null | |
karlicoss/HPI | from __future__ import annotations
from collections import OrderedDict
from collections.abc import Iterator
from contextlib import contextmanager
from typing import Any, cast
def ignore(w, *keys):
for k in keys:
w[k].ignore()
def zoom(w, *keys):
return [w[k].zoom() for k in keys]
def _wrap(j, parent... | KeyError) | pytest.raises | variable | src/my/core/konsume.py | test_zoom | 214 | null | |
karlicoss/HPI | from __future__ import annotations
import re
import time
from collections.abc import Callable, Iterator
from datetime import date, datetime, timedelta
from functools import cache
from typing import Any, NamedTuple
import more_itertools
from .query import (
ET,
OrderFunc,
QueryException,
Where,
_h... | ValueError, match=r"Could not parse time duration from") | pytest.raises | complex_expr | src/my/core/query_range.py | test_parse_timedelta_string | 528 | null | |
karlicoss/HPI | from __future__ import annotations
import os
import traceback
from collections.abc import Callable, Iterable, Sequence
from glob import glob as do_glob
from pathlib import Path
from typing import TYPE_CHECKING
from . import compat, warnings
PathIsh = Path | str
Paths = Sequence[PathIsh] | PathIsh
DEFAULT_GLOB = '*... | *args) | assert_* | complex_expr | src/my/core/common.py | assert_never | 160 | null | |
karlicoss/HPI | import os
import zipfile
from pathlib import Path
import pytest
from kompress import CPath, ZipPath
from ..common import get_files
def test_sort(tmp_path_cwd: Path) -> None:
"""
Checks that sorting only applies to globbed files.
Otherwise the order specified in get_files should be preserved.
"""
... | ( Path('dir3/subdir32/file'), # files under a glob should be sorted Path('dir2/subdir21/file1'), Path('dir2/subdir21/file2'), Path('dir2/subdir22/file1'), Path('dir2/subdir22/file2'), # Path('dir3/subdir31/file'), Path('dir1/file1'), Path('dir1/file2'), ) | assert | collection | src/my/core/tests/test_get_files.py | test_sort | 80 | null | |
karlicoss/HPI | from __future__ import annotations
REQUIRES = [
'kobuddy',
]
from collections.abc import Callable, Iterator
from dataclasses import dataclass
import kobuddy
from kobuddy import *
from kobuddy import Highlight, get_highlights
from my.core import (
Paths,
Stats,
get_files,
stat,
)
from my.core.cfg... | 3 | assert | numeric_literal | src/my/kobo.py | test_todos | 92 | null | |
karlicoss/HPI | import inspect
from pathlib import Path
import pytest
from more_itertools import ilen
from my.core.cfg import tmp_config
from my.pdfs import annotated_pdfs, annotations, get_annots
from .common import testdata
def with_config():
# extra_data = Path(__file__).absolute().parent / 'extra/data/polar'
# assert e... | EXPECTED_HIGHLIGHTS | assert | variable | src/my/tests/pdfs.py | test_get_annots | 66 | null | |
karlicoss/HPI | from __future__ import annotations
import importlib.util
import os
import pkgutil
import sys
from collections.abc import Iterable
from itertools import chain
from pathlib import Path
from types import ModuleType
from .discovery_pure import HPIModule, _is_not_module_src, has_stats, ignored
def modules() -> Iterable[H... | disabled | assert | variable | src/my/core/util.py | test_good_modules | 213 | null | |
karlicoss/HPI | from collections.abc import Iterator
from datetime import UTC, datetime, timedelta
import pytest
from more_itertools import ilen
import my.ip.all as ip_module
from my.ip.common import IP
from my.location.fallback import via_ip
from ..shared_tz_config import config # noqa: F401 # autoused fixture
def test_ip_fallb... | 1 | assert | numeric_literal | src/my/tests/location/fallback.py | test_ip_fallback | 38 | null | |
karlicoss/HPI | from __future__ import annotations
import re
import traceback
from collections.abc import Callable, Iterable, Iterator
from datetime import date, datetime
from itertools import tee
from typing import Any, Literal, cast
from .types import Json
from .warnings import medium
ErrorPolicy = Literal["yield", "raise", "drop... | dt | assert | variable | src/my/core/error.py | test_datetime_errors | 268 | null | |
karlicoss/HPI | from __future__ import annotations
import datetime
import warnings
from collections.abc import Callable
from dataclasses import asdict, is_dataclass
from decimal import Decimal
from functools import cache
from pathlib import Path
from typing import Any, NamedTuple
from .error import error_to_json
from .pytest import ... | {'x': 1, 'y': 2.0} | assert | collection | src/my/core/serialize.py | test_dumps_namedtuple | 261 | null | |
karlicoss/HPI | from __future__ import annotations
import re
import time
from collections.abc import Callable, Iterator
from datetime import date, datetime, timedelta
from functools import cache
from typing import Any, NamedTuple
import more_itertools
from .query import (
ET,
OrderFunc,
QueryException,
Where,
_h... | None | assert | none_literal | src/my/core/query_range.py | _parse_range | 157 | null | |
karlicoss/HPI | from collections.abc import Iterator
from datetime import UTC, datetime, timedelta
import pytest
from more_itertools import ilen
import my.ip.all as ip_module
from my.ip.common import IP
from my.location.fallback import via_ip
from ..shared_tz_config import config # noqa: F401 # autoused fixture
def test_ip_fallb... | 0 | assert | numeric_literal | src/my/tests/location/fallback.py | test_ip_fallback | 34 | null | |
karlicoss/HPI | from __future__ import annotations
import collections.abc
import importlib
import inspect
import typing
from collections.abc import Callable, Iterable, Iterator, Sequence
from contextlib import contextmanager
from datetime import datetime
from pathlib import Path
from types import ModuleType
from typing import (
A... | {'count': 3} | assert | collection | src/my/core/stats.py | test_stat | 110 | null | |
karlicoss/HPI | from __future__ import annotations
import code
import contextlib
import functools
import importlib
import importlib.util
import inspect
import os
import shlex
import shutil
import sys
import tempfile
import traceback
import warnings
from collections.abc import Callable, Iterable, Sequence
from contextlib import ExitSt... | None | assert | none_literal | src/my/core/__main__.py | modules_check | 311 | null | |
karlicoss/HPI | from pathlib import Path
import pytest
from ..structure import match_structure
structure_data: Path = Path(__file__).parent / "structure_data"
gdpr_expected = ("comments", "messages/index.csv", "profile")
def test_gdpr_structure_exists() -> None:
with match_structure(structure_data, expected=gdpr_expected) as ... | (structure_data / "gdpr_subdirs" / "gdpr_export",) | assert | collection | src/my/core/tests/structure.py | test_gdpr_structure_exists | 14 | null | |
karlicoss/HPI | from __future__ import annotations
import warnings
from collections.abc import Callable, Hashable, Iterable, Iterator, Sized
from typing import TYPE_CHECKING, cast
import more_itertools
from decorator import decorator
from .. import warnings as core_warnings
def _identity[T, V](v: T) -> V: # type: ignore[type-var]... | x1 | assert | variable | src/my/core/utils/itertools.py | test_check_if_hashable | 255 | null | |
karlicoss/HPI | import os
import sys
from pathlib import Path
import pytest
import pytz
import my.config
from my.core import notnone
from my.demo import items, make_config
from .common import tmp_environ_set
@pytest.mark.skip(reason="won't work at the moment because of inheritance")
def test_dynamic_config_simplenamespace(tmp_path... | 'user3' | assert | string_literal | src/my/core/tests/test_config.py | test_dynamic_config_simplenamespace | 47 | null | |
karlicoss/HPI | from __future__ import annotations
import dataclasses
import importlib
import inspect
import itertools
from collections.abc import Callable, Iterable, Iterator
from datetime import datetime
from typing import Any, NamedTuple
import more_itertools
from . import error as err
from .error import Res, unwrap
from .types ... | 6 | assert | numeric_literal | src/my/core/query.py | test_drop_exceptions | 682 | null | |
karlicoss/HPI | from __future__ import annotations
import inspect
import os
import pkgutil
import re
from collections.abc import Iterator, MutableSequence, Sequence
from typing import Any
from . import warnings
def handle_legacy_import(
parent_module_name: str,
legacy_submodule_name: str,
parent_module_path: MutableSequ... | 'b' | assert | string_literal | src/my/core/hpi_compat.py | test_always_supports_sequence_next | 226 | null | |
karlicoss/HPI | import os
import zipfile
from pathlib import Path
import pytest
from kompress import CPath, ZipPath
from ..common import get_files
def test_single_file(tmp_path_cwd: Path) -> None:
'''
Regular file path is just returned as is.
'''
# Exception if it doesn't exist"
with pytest.raises(Exception):
... | (Path('file.ext'),) | assert | collection | src/my/core/tests/test_get_files.py | test_single_file | 25 | null | |
karlicoss/HPI | from __future__ import annotations
import re
import time
from collections.abc import Callable, Iterator
from datetime import date, datetime, timedelta
from functools import cache
from typing import Any, NamedTuple
import more_itertools
from .query import (
ET,
OrderFunc,
QueryException,
Where,
_h... | [_Float(2.5), _Float(3.5), _Float(4.5), _Float(5.5)] | assert | collection | src/my/core/query_range.py | test_query_range_float_value_type | 455 | null | |
betodealmeida/shillelagh | from datetime import date
import pytest
from pytest_mock import MockerFixture
from requests import Session
from requests_mock.mocker import Mocker
from shillelagh.adapters.api.socrata import Number, SocrataAPI
from shillelagh.backends.apsw.db import connect
from shillelagh.exceptions import ProgrammingError
from shil... | {"X-App-Token": "YYY"} | assert | collection | tests/adapters/api/socrata_test.py | test_socrata_app_token_connection | 124 | null | |
betodealmeida/shillelagh | import datetime
import json
from collections.abc import Iterable
from typing import Any
import apsw
import pytest
from pytest_mock import MockerFixture
from shillelagh.backends.apsw.vt import (
VTModule,
VTTable,
_add_sqlite_constraint,
convert_rows_from_sqlite,
convert_rows_to_sqlite,
get_all... | (1, 23, "Bob", "3") | assert | collection | tests/backends/apsw/vt_test.py | test_cursor | 370 | null | |
betodealmeida/shillelagh | from collections.abc import Iterator
from datetime import datetime
from typing import Any, Optional
import pytest
from shillelagh.adapters.base import Adapter
from shillelagh.adapters.registry import AdapterLoader
from shillelagh.backends.apsw.db import connect
from shillelagh.exceptions import NotSupportedError
from... | [(20, "Alice", 0)] | assert | collection | tests/adapters/base_test.py | test_limit_offset | 262 | null | |
betodealmeida/shillelagh | import json
import subprocess
import sys
import apsw
import pytest
from pytest_mock import MockerFixture
from shillelagh.adapters.registry import AdapterLoader
from shillelagh.backends.apsw.db import connect
from shillelagh.exceptions import ProgrammingError
from shillelagh.functions import date_trunc, get_metadata, ... | 3 | assert | numeric_literal | tests/functions_test.py | test_upgrade_all_fail | 183 | null | |
betodealmeida/shillelagh | import pytest
from shillelagh.filters import (
Endpoint,
Equal,
Impossible,
IsNotNull,
IsNull,
Like,
NotEqual,
Operator,
Range,
Side,
)
def test_range() -> None:
"""
Test ``Range``.
"""
operations = {
(Operator.GT, 0),
(Operator.LT, 10),
... | 4 | assert | numeric_literal | tests/filters_test.py | test_range | 179 | null | |
betodealmeida/shillelagh | from datetime import datetime, timezone
from freezegun import freeze_time
from shillelagh.adapters.memory.virtual import int_to_base26
from shillelagh.backends.apsw.db import connect
from shillelagh.fields import FastISODateTime, IntBoolean, String, StringInteger
def test_int_to_base26() -> None:
"""
Test th... | "b" | assert | string_literal | tests/adapters/memory/virtual_test.py | test_int_to_base26 | 19 | null | |
betodealmeida/shillelagh | from unittest import mock
from unittest.mock import MagicMock
import sqlalchemy
from sqlalchemy.engine.url import make_url
from shillelagh.backends.apsw.dialects.metricflow import (
MetricFlowDialect,
TableMetricFlowAPI,
get_sqla_type,
)
from shillelagh.fields import Boolean, DateTime, Decimal, Integer, S... | ["main"] | assert | collection | tests/backends/apsw/dialects/metricflow_test.py | test_metricflow_dialect_get_schema_names | 297 | null | |
betodealmeida/shillelagh | from collections.abc import Iterator
from datetime import datetime
from typing import Any, Optional
import pytest
from shillelagh.adapters.base import Adapter
from shillelagh.adapters.registry import AdapterLoader
from shillelagh.backends.apsw.db import connect
from shillelagh.exceptions import NotSupportedError
from... | [(23, "Bob", 3)] | assert | collection | tests/adapters/base_test.py | test_limit_offset | 257 | null | |
betodealmeida/shillelagh | import re
import pytest
from requests_mock.mocker import Mocker
from yarl import URL
from shillelagh.adapters.api.generic_json import GenericJSONAPI
from shillelagh.backends.apsw.db import connect
from shillelagh.exceptions import ProgrammingError
from shillelagh.typing import Maybe
baseurl = URL("https://api.stloui... | [(1, "[10, 20]"), (2, "[11]")] | assert | collection | tests/adapters/api/generic_json_test.py | test_generic_json | 98 | null | |
betodealmeida/shillelagh | import base64
from datetime import datetime, timezone
from decimal import Decimal
from typing import Any
from unittest.mock import MagicMock, call
import pandas as pd
import pyarrow as pa
import pytest
from pytest_mock import MockerFixture
from shillelagh.adapters.api.dbt_metricflow import (
DbtMetricFlowAPI,
... | InternalError) | pytest.raises | variable | tests/adapters/api/dbt_metricflow_test.py | test_get_data_no_cursor | 543 | null | |
betodealmeida/shillelagh | import base64
from datetime import datetime, timezone
from decimal import Decimal
from typing import Any
from unittest.mock import MagicMock, call
import pandas as pd
import pyarrow as pa
import pytest
from pytest_mock import MockerFixture
from shillelagh.adapters.api.dbt_metricflow import (
DbtMetricFlowAPI,
... | {"orders": "Count of orders."} | assert | collection | tests/adapters/api/dbt_metricflow_test.py | test_build_orderbys | 900 | null | |
betodealmeida/shillelagh | import datetime
from typing import Any
import pytest
from pytest_mock import MockerFixture
from shillelagh.adapters.registry import AdapterLoader, UnsafeAdaptersError
from shillelagh.backends.sqlglot.db import connect
from shillelagh.exceptions import InterfaceError, NotSupportedError, ProgrammingError
from shillelag... | 2 | assert | numeric_literal | tests/backends/sqlglot/db_test.py | test_connect | 34 | null | |
betodealmeida/shillelagh | from datetime import date, datetime, time, timezone
from shillelagh.backends.apsw.db import connect
from shillelagh.fields import String
from shillelagh.types import (
STRING,
Binary,
Date,
DateFromTicks,
Time,
TimeFromTicks,
Timestamp,
TimestampFromTicks,
)
def test_comparison() -> No... | String | assert | variable | tests/types_test.py | test_comparison | 87 | null | |
betodealmeida/shillelagh | from typing import cast
from unittest.mock import MagicMock
from urllib.parse import urlparse
import pytest
from botocore import UNSIGNED
from pytest_mock import MockerFixture
from shillelagh.adapters.api.s3select import (
CSVSerializationType,
S3SelectAPI,
get_input_serialization,
)
from shillelagh.backe... | [] | assert | collection | tests/adapters/api/s3select_test.py | test_impossible_condition | 232 | null | |
betodealmeida/shillelagh | from datetime import date
import pytest
from pytest_mock import MockerFixture
from requests import Session
from requests_mock.mocker import Mocker
from shillelagh.adapters.api.socrata import Number, SocrataAPI
from shillelagh.backends.apsw.db import connect
from shillelagh.exceptions import ProgrammingError
from shil... | {"X-App-Token": "XXX"} | assert | collection | tests/adapters/api/socrata_test.py | test_socrata_app_token_url | 88 | null | |
betodealmeida/shillelagh | import datetime
import decimal
import sys
from typing import Union
import pytest
from shillelagh.adapters.registry import registry
from shillelagh.backends.apsw.db import connect
from shillelagh.exceptions import ProgrammingError
from shillelagh.fields import (
Blob,
Boolean,
Date,
DateTime,
Decim... | 1 | assert | numeric_literal | tests/fields_test.py | test_integer | 70 | null | |
betodealmeida/shillelagh | import base64
from datetime import datetime, timezone
from decimal import Decimal
from typing import Any
from unittest.mock import MagicMock, call
import pandas as pd
import pyarrow as pa
import pytest
from pytest_mock import MockerFixture
from shillelagh.adapters.api.dbt_metricflow import (
DbtMetricFlowAPI,
... | "NULL" | assert | string_literal | tests/adapters/api/dbt_metricflow_test.py | test_timestamp | 668 | null | |
betodealmeida/shillelagh | from unittest import mock
import pytest
from sqlalchemy import MetaData, Table, create_engine, func, inspect, select
from shillelagh.adapters.registry import AdapterLoader
from shillelagh.backends.apsw import db
from shillelagh.backends.apsw.dialects.base import APSWDialect
from shillelagh.exceptions import Programmi... | APSWDialect.dbapi() | assert | func_call | tests/backends/apsw/dialects/base_test.py | test_import_dbapi | 83 | null | |
betodealmeida/shillelagh | from datetime import date, datetime, time, timedelta
from typing import cast
import pytest
from shillelagh.adapters.api.gsheets.parsing.base import LITERAL, Token
from shillelagh.adapters.api.gsheets.parsing.date import (
AMPM,
AP,
DD,
DDD,
MM,
MMM,
MMMM,
MMMMM,
SS,
YY,
YYY... | "3" | assert | string_literal | tests/adapters/api/gsheets/parsing/date_test.py | test_h_token | 144 | null | |
betodealmeida/shillelagh | import pytest
from shillelagh.filters import (
Endpoint,
Equal,
Impossible,
IsNotNull,
IsNull,
Like,
NotEqual,
Operator,
Range,
Side,
)
def test_range() -> None:
"""
Test ``Range``.
"""
operations = {
(Operator.GT, 0),
(Operator.LT, 10),
... | 2 | assert | numeric_literal | tests/filters_test.py | test_range | 178 | null | |
betodealmeida/shillelagh | from unittest import mock
import pytest
from sqlalchemy import MetaData, Table, create_engine, func, inspect, select
from shillelagh.adapters.registry import AdapterLoader
from shillelagh.backends.sqlglot import db
from shillelagh.backends.sqlglot.dialects.base import SQLGlotDialect
from shillelagh.exceptions import ... | True | assert | bool_literal | tests/backends/sqlglot/dialects/base_test.py | test_dialect_ping | 63 | null | |
betodealmeida/shillelagh | import pytest
from shillelagh.adapters.api.gsheets.parsing.base import tokenize
from shillelagh.adapters.api.gsheets.parsing.number import (
AT,
COLOR,
COMMA,
DIGITS,
FRACTION,
LITERAL,
PERCENT,
PERIOD,
STAR,
UNDERSCORE,
E,
InvalidValue,
condition_matches,
fix_pe... | "" | assert | string_literal | tests/adapters/api/gsheets/parsing/number_test.py | test_digits_token | 38 | null | |
betodealmeida/shillelagh | from datetime import date, datetime, time, timedelta
from typing import cast
import pytest
from shillelagh.adapters.api.gsheets.parsing.base import LITERAL, Token
from shillelagh.adapters.api.gsheets.parsing.date import (
AMPM,
AP,
DD,
DDD,
MM,
MMM,
MMMM,
MMMMM,
SS,
YY,
YYY... | "01" | assert | string_literal | tests/adapters/api/gsheets/parsing/date_test.py | test_hhplus_token | 172 | null | |
betodealmeida/shillelagh | from datetime import date, datetime, time, timedelta
from typing import cast
import pytest
from shillelagh.adapters.api.gsheets.parsing.base import LITERAL, Token
from shillelagh.adapters.api.gsheets.parsing.date import (
AMPM,
AP,
DD,
DDD,
MM,
MMM,
MMMM,
MMMMM,
SS,
YY,
YYY... | "a" | assert | string_literal | tests/adapters/api/gsheets/parsing/date_test.py | test_ap_token | 611 | null | |
betodealmeida/shillelagh | import datetime
import decimal
import sys
from typing import Union
import pytest
from shillelagh.adapters.registry import registry
from shillelagh.backends.apsw.db import connect
from shillelagh.exceptions import ProgrammingError
from shillelagh.fields import (
Blob,
Boolean,
Date,
DateTime,
Decim... | 0 | assert | numeric_literal | tests/fields_test.py | test_int_boolean | 318 | null | |
betodealmeida/shillelagh | from datetime import date, datetime, time, timedelta
from typing import cast
import pytest
from shillelagh.adapters.api.gsheets.parsing.base import LITERAL, Token
from shillelagh.adapters.api.gsheets.parsing.date import (
AMPM,
AP,
DD,
DDD,
MM,
MMM,
MMMM,
MMMMM,
SS,
YY,
YYY... | "1" | assert | string_literal | tests/adapters/api/gsheets/parsing/date_test.py | test_h_token | 146 | null | |
betodealmeida/shillelagh | import pytest
from pytest_mock import MockerFixture
from shillelagh.adapters.file.csvfile import CSVFile
from shillelagh.adapters.registry import AdapterLoader
from shillelagh.exceptions import InterfaceError
from ..fakes import FakeAdapter
def test_register(registry: AdapterLoader) -> None:
"""
Test that we... | CSVFile | assert | variable | tests/adapters/registry_test.py | test_register | 55 | null | |
betodealmeida/shillelagh | import datetime
import json
from collections.abc import Iterable
from typing import Any
import apsw
import pytest
from pytest_mock import MockerFixture
from shillelagh.backends.apsw.vt import (
VTModule,
VTTable,
_add_sqlite_constraint,
convert_rows_from_sqlite,
convert_rows_to_sqlite,
get_all... | Exception) | pytest.raises | variable | tests/backends/apsw/vt_test.py | test_cursor_with_constraints_invalid_filter | 427 | null | |
betodealmeida/shillelagh | import re
import pytest
from requests_mock.mocker import Mocker
from yarl import URL
from shillelagh.adapters.api.generic_json import GenericJSONAPI
from shillelagh.backends.apsw.db import connect
from shillelagh.exceptions import ProgrammingError
from shillelagh.typing import Maybe
baseurl = URL("https://api.stloui... | True | assert | bool_literal | tests/adapters/api/generic_json_test.py | test_supports | 158 | null | |
betodealmeida/shillelagh | from pytest_mock import MockerFixture
from sqlalchemy.engine.url import make_url
from shillelagh.backends.multicorn import db
from shillelagh.backends.multicorn.db import Cursor
from shillelagh.backends.multicorn.dialects.base import (
Multicorn2Dialect,
get_adapter_for_table_name,
)
from shillelagh.exceptions... | True | assert | bool_literal | tests/backends/multicorn/dialects/base_test.py | test_has_table | 66 | null | |
betodealmeida/shillelagh | from datetime import date, datetime, time, timedelta
from typing import cast
import pytest
from shillelagh.adapters.api.gsheets.parsing.base import LITERAL, Token
from shillelagh.adapters.api.gsheets.parsing.date import (
AMPM,
AP,
DD,
DDD,
MM,
MMM,
MMMM,
MMMMM,
SS,
YY,
YYY... | "p" | assert | string_literal | tests/adapters/api/gsheets/parsing/date_test.py | test_ap_token | 610 | null | |
betodealmeida/shillelagh | from collections.abc import Iterator
from datetime import datetime
from typing import Any, Optional
import pytest
from shillelagh.adapters.base import Adapter
from shillelagh.adapters.registry import AdapterLoader
from shillelagh.backends.apsw.db import connect
from shillelagh.exceptions import NotSupportedError
from... | [ (None, datetime(2021, 1, 1, 0, 0), None, None), ] | assert | collection | tests/adapters/base_test.py | test_type_conversion | 315 | null | |
betodealmeida/shillelagh | from datetime import date
import pytest
from pytest_mock import MockerFixture
from requests import Session
from requests_mock.mocker import Mocker
from shillelagh.adapters.api.socrata import Number, SocrataAPI
from shillelagh.backends.apsw.db import connect
from shillelagh.exceptions import ProgrammingError
from shil... | [(672076105.0,)] | assert | collection | tests/adapters/api/socrata_test.py | test_integration | 253 | null | |
betodealmeida/shillelagh | import datetime
import dateutil.tz
from shillelagh.adapters.api.gsheets.fields import (
GSheetsBoolean,
GSheetsDate,
GSheetsDateTime,
GSheetsDuration,
GSheetsNumber,
GSheetsString,
GSheetsTime,
)
from shillelagh.fields import ISODateTime, Order
def test_GSheetsDateTime() -> None:
"""
... | None | assert | none_literal | tests/adapters/api/gsheets/fields_test.py | test_GSheetsDateTime | 38 | null | |
betodealmeida/shillelagh | import psycopg2
import pytest
from pytest_mock import MockerFixture
from shillelagh.adapters.registry import AdapterLoader
from shillelagh.backends.multicorn.db import Cursor, CursorFactory, connect
from shillelagh.exceptions import ProgrammingError
from ...fakes import FakeAdapter
def test_drop_table(mocker: Mocker... | "one") | assert_* | string_literal | tests/backends/multicorn/db_test.py | test_drop_table | 211 | null | |
betodealmeida/shillelagh | from datetime import date
import pytest
from pytest_mock import MockerFixture
from requests import Session
from requests_mock.mocker import Mocker
from shillelagh.adapters.api.socrata import Number, SocrataAPI
from shillelagh.backends.apsw.db import connect
from shillelagh.exceptions import ProgrammingError
from shil... | 0 | assert | numeric_literal | tests/adapters/api/socrata_test.py | test_get_cost | 266 | null | |
betodealmeida/shillelagh | from datetime import datetime, timezone
from pathlib import Path
import apsw
import pytest
from freezegun import freeze_time
from pyfakefs.fake_filesystem import FakeFilesystem
from requests_mock.mocker import Mocker
from shillelagh.adapters.file.csvfile import CSVFile, RowTracker
from shillelagh.backends.apsw.db imp... | {"col0_": 1} | assert | collection | tests/adapters/file/csvfile_test.py | test_row_tracker | 350 | null | |
betodealmeida/shillelagh | import re
import pytest
from requests_mock.mocker import Mocker
from yarl import URL
from shillelagh.adapters.api.generic_json import GenericJSONAPI
from shillelagh.backends.apsw.db import connect
from shillelagh.exceptions import ProgrammingError
from shillelagh.typing import Maybe
baseurl = URL("https://api.stloui... | {"col_0", "col_1", "col_2"} | assert | collection | tests/adapters/api/generic_json_test.py | test_generic_json_array | 329 | null | |
betodealmeida/shillelagh | from collections.abc import Iterator
from datetime import timedelta
from typing import Any
import pytest
from pytest_mock import MockerFixture
from shillelagh.exceptions import ImpossibleFilterError, ProgrammingError
from shillelagh.fields import Boolean, Field, Float, Integer, Order, String
from shillelagh.filters i... | [] | assert | collection | tests/lib_test.py | test_filter_data | 414 | null | |
betodealmeida/shillelagh | import datetime
from typing import Any, Optional
from unittest import mock
import apsw
import pytest
from pytest_mock import MockerFixture
from shillelagh.adapters.registry import AdapterLoader, UnsafeAdaptersError
from shillelagh.backends.apsw.db import (
APSWConnection,
connect,
convert_binding,
get... | [] | assert | collection | tests/backends/apsw/db_test.py | test_connect_schema_prefix | 80 | null | |
betodealmeida/shillelagh | from collections.abc import Iterator
from datetime import timedelta
from typing import Any
import pytest
from pytest_mock import MockerFixture
from shillelagh.exceptions import ImpossibleFilterError, ProgrammingError
from shillelagh.fields import Boolean, Field, Float, Integer, Order, String
from shillelagh.filters i... | 3 | assert | numeric_literal | tests/lib_test.py | test_analyze | 146 | null | |
betodealmeida/shillelagh | from unittest import mock
import pytest
from sqlalchemy import MetaData, Table, create_engine, func, inspect, select
from shillelagh.adapters.registry import AdapterLoader
from shillelagh.backends.sqlglot import db
from shillelagh.backends.sqlglot.dialects.base import SQLGlotDialect
from shillelagh.exceptions import ... | ["main"] | assert | collection | tests/backends/sqlglot/dialects/base_test.py | test_get_schema_names | 87 | null | |
betodealmeida/shillelagh | import datetime
import decimal
import sys
from typing import Union
import pytest
from shillelagh.adapters.registry import registry
from shillelagh.backends.apsw.db import connect
from shillelagh.exceptions import ProgrammingError
from shillelagh.fields import (
Blob,
Boolean,
Date,
DateTime,
Decim... | "0" | assert | string_literal | tests/fields_test.py | test_int_boolean | 321 | null | |
betodealmeida/shillelagh | import pytest
from pytest_mock import MockerFixture
from shillelagh.adapters.file.csvfile import CSVFile
from shillelagh.adapters.registry import AdapterLoader
from shillelagh.exceptions import InterfaceError
from ..fakes import FakeAdapter
def test_load_error(registry: AdapterLoader) -> None:
"""
Test error... | InterfaceError) | pytest.raises | variable | tests/adapters/registry_test.py | test_load_error | 37 | null | |
betodealmeida/shillelagh | from inspect import isfunction, ismethod
import pytest
from shillelagh.backends.apsw import db as dbapi
def test_cursor() -> None:
"""
Test that the cursor implements required methods.
"""
connection = dbapi.connect(":memory:")
cursor = connection.cursor()
# attributes
assert cursor.desc... | 1 | assert | numeric_literal | tests/backends/apsw/dbapi_test.py | test_cursor | 64 | null | |
betodealmeida/shillelagh | from typing import cast
from unittest.mock import MagicMock
from urllib.parse import urlparse
import pytest
from botocore import UNSIGNED
from pytest_mock import MockerFixture
from shillelagh.adapters.api.s3select import (
CSVSerializationType,
S3SelectAPI,
get_input_serialization,
)
from shillelagh.backe... | "s3") | assert_* | string_literal | tests/adapters/api/s3select_test.py | test_s3select_with_kwargs_auth | 172 | null | |
betodealmeida/shillelagh | import itertools
from typing import cast
import dateutil.tz
import pytest
from pytest_mock import MockerFixture
from shillelagh.adapters.api.gsheets.fields import (
GSheetsBoolean,
GSheetsDate,
GSheetsDateTime,
GSheetsNumber,
GSheetsString,
GSheetsTime,
)
from shillelagh.adapters.api.gsheets.l... | "test" | assert | string_literal | tests/adapters/api/gsheets/lib_test.py | test_get_value_from_cell | 366 | null | |
betodealmeida/shillelagh | from datetime import datetime, timedelta, timezone
from typing import Any
import pytest
from pytest_mock import MockerFixture
from requests import Session
from requests_mock.mocker import Mocker
from shillelagh.adapters.api.weatherapi import WeatherAPI, combine_time_filters
from shillelagh.backends.apsw.db import con... | 7 | assert | numeric_literal | tests/adapters/api/weatherapi_test.py | test_window | 769 | null | |
betodealmeida/shillelagh | from unittest import mock
import pytest
from sqlalchemy import MetaData, Table, create_engine, func, inspect, select
from shillelagh.adapters.registry import AdapterLoader
from shillelagh.backends.sqlglot import db
from shillelagh.backends.sqlglot.dialects.base import SQLGlotDialect
from shillelagh.exceptions import ... | SQLGlotDialect.dbapi() | assert | func_call | tests/backends/sqlglot/dialects/base_test.py | test_import_dbapi | 94 | null | |
betodealmeida/shillelagh | import json
import subprocess
import sys
import apsw
import pytest
from pytest_mock import MockerFixture
from shillelagh.adapters.registry import AdapterLoader
from shillelagh.backends.apsw.db import connect
from shillelagh.exceptions import ProgrammingError
from shillelagh.functions import date_trunc, get_metadata, ... | ProgrammingError) | pytest.raises | variable | tests/functions_test.py | test_get_metadata | 52 | null | |
betodealmeida/shillelagh | from collections import defaultdict
from multicorn import Qual, SortKey
from pytest_mock import MockerFixture
from shillelagh.adapters.registry import AdapterLoader
from shillelagh.backends.multicorn.fdw import (
MulticornForeignDataWrapper,
get_all_bounds,
)
from shillelagh.filters import Operator
from ...f... | [] | assert | collection | tests/backends/multicorn/fdw_test.py | test_fdw | 30 | null | |
betodealmeida/shillelagh | from collections.abc import Iterator
from datetime import datetime
from typing import Any, Optional
import pytest
from shillelagh.adapters.base import Adapter
from shillelagh.adapters.registry import AdapterLoader
from shillelagh.backends.apsw.db import connect
from shillelagh.exceptions import NotSupportedError
from... | [ ( None, datetime(2021, 1, 1, 0, 0), None, None, ), ] | assert | collection | tests/adapters/base_test.py | test_type_conversion | 290 | null | |
betodealmeida/shillelagh | from collections.abc import Iterator
from datetime import timedelta
from typing import Any
import pytest
from pytest_mock import MockerFixture
from shillelagh.exceptions import ImpossibleFilterError, ProgrammingError
from shillelagh.fields import Boolean, Field, Float, Integer, Order, String
from shillelagh.filters i... | [range(0, 8)] | assert | collection | tests/lib_test.py | test_row_id_manager | 69 | null | |
betodealmeida/shillelagh | import datetime
import json
from collections.abc import Iterable
from typing import Any
import apsw
import pytest
from pytest_mock import MockerFixture
from shillelagh.backends.apsw.vt import (
VTModule,
VTTable,
_add_sqlite_constraint,
convert_rows_from_sqlite,
convert_rows_to_sqlite,
get_all... | True | assert | bool_literal | tests/backends/apsw/vt_test.py | test_virtual_best_index_object | 140 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.