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 |
|---|---|---|---|---|---|---|---|---|---|
reubano/meza | import itertools as it
import requests
import responses
from io import StringIO
from operator import itemgetter
import pytest
from meza import fntools as ft, io, stats
def setup_module():
"""site initialization"""
global initialized
initialized = True
print("Site Module Setup\n")
class TestIterStri... | count | assert | variable | tests/test_fntools.py | test_fill | TestIterStringIO | 135 | null |
reubano/meza | import itertools as it
from decimal import Decimal
from functools import partial
from operator import itemgetter, truediv, eq, is_not, contains
from collections import defaultdict
import pytest
from meza import process as pr, stats, fntools as ft
def setup_module():
"""site initialization"""
global initiali... | result | assert | variable | tests/test_process.py | test_merge | Test | 125 | null |
reubano/meza | import itertools as it
from decimal import Decimal
from functools import partial
from operator import itemgetter, truediv, eq, is_not, contains
from collections import defaultdict
import pytest
from meza import process as pr, stats, fntools as ft
def setup_module():
"""site initialization"""
global initiali... | ValueError) | pytest.raises | variable | tests/test_process.py | test_typecast | Test | 35 | null |
reubano/meza | import itertools as it
import requests
import responses
from io import StringIO
from operator import itemgetter
import pytest
from meza import fntools as ft, io, stats
def setup_module():
"""site initialization"""
global initialized
initialized = True
print("Site Module Setup\n")
class TestIterStri... | 2 | assert | numeric_literal | tests/test_fntools.py | test_objectify | TestIterStringIO | 201 | null |
reubano/meza | import itertools as it
from os import path as p
from json import loads
from tempfile import TemporaryFile
from io import StringIO, BytesIO
from decimal import Decimal
from urllib.request import urlopen
from contextlib import closing
import requests
import responses
import pygogo as gogo
import pytest
from meza impor... | next(records) | assert | func_call | tests/test_io.py | test_utf8 | TestUnicodeReader | 117 | null |
reubano/meza | import itertools as it
import requests
import responses
from io import StringIO
from operator import itemgetter
import pytest
from meza import fntools as ft, io, stats
def setup_module():
"""site initialization"""
global initialized
initialized = True
print("Site Module Setup\n")
class TestIterStri... | previous | assert | variable | tests/test_fntools.py | test_fill | TestIterStringIO | 119 | null |
reubano/meza | import itertools as it
from os import path as p
from json import loads
from tempfile import TemporaryFile
from io import StringIO, BytesIO
from decimal import Decimal
from urllib.request import urlopen
from contextlib import closing
import requests
import responses
import pygogo as gogo
import pytest
from meza impor... | lines[2] | assert | complex_expr | tests/test_io.py | test_lines | TestIterStringIO | 71 | null |
reubano/meza | import itertools as it
from os import path as p
from json import loads
from tempfile import TemporaryFile
from io import StringIO, BytesIO
from decimal import Decimal
from urllib.request import urlopen
from contextlib import closing
import requests
import responses
import pygogo as gogo
import pytest
from meza impor... | geojson | assert | variable | tests/test_io.py | test_geojson_with_crs | TestGeoJSON | 554 | null |
reubano/meza | import itertools as it
from decimal import Decimal
from functools import partial
from operator import itemgetter, truediv, eq, is_not, contains
from collections import defaultdict
import pytest
from meza import process as pr, stats, fntools as ft
def setup_module():
"""site initialization"""
global initiali... | list(filled) | assert | func_call | tests/test_process.py | test_fillempty | Test | 105 | null |
reubano/meza | import itertools as it
from decimal import Decimal
from functools import partial
from operator import itemgetter, truediv, eq, is_not, contains
from collections import defaultdict
import pytest
from meza import process as pr, stats, fntools as ft
def setup_module():
"""site initialization"""
global initiali... | result["count"] | assert | complex_expr | tests/test_process.py | test_detect_types | Test | 52 | null |
reubano/meza | import itertools as it
from os import path as p
from json import loads
from tempfile import TemporaryFile
from io import StringIO, BytesIO
from decimal import Decimal
from urllib.request import urlopen
from contextlib import closing
import requests
import responses
import pygogo as gogo
import pytest
from meza impor... | KeyError) | pytest.raises | variable | tests/test_io.py | test_get_reader | TestInput | 361 | null |
reubano/meza | import itertools as it
from os import path as p
from json import loads
from tempfile import TemporaryFile
from io import StringIO, BytesIO
from decimal import Decimal
from urllib.request import urlopen
from contextlib import closing
import requests
import responses
import pygogo as gogo
import pytest
from meza impor... | len(records) | assert | func_call | tests/test_io.py | test_csv_last_row | TestInput | 300 | null |
reubano/meza | import itertools as it
import requests
import responses
from io import StringIO
from operator import itemgetter
import pytest
from meza import fntools as ft, io, stats
def setup_module():
"""site initialization"""
global initialized
initialized = True
print("Site Module Setup\n")
class TestIterStri... | ft.byte(content) | assert | func_call | tests/test_fntools.py | test_byte_array | TestIterStringIO | 79 | null |
reubano/meza | import itertools as it
from decimal import Decimal
from functools import partial
from operator import itemgetter, truediv, eq, is_not, contains
from collections import defaultdict
import pytest
from meza import process as pr, stats, fntools as ft
def setup_module():
"""site initialization"""
global initiali... | next(records) | assert | func_call | tests/test_process.py | test_detect_types | Test | 68 | null |
reubano/meza | import itertools as it
import requests
import responses
from io import StringIO
from operator import itemgetter
import pytest
from meza import fntools as ft, io, stats
def setup_module():
"""site initialization"""
global initialized
initialized = True
print("Site Module Setup\n")
class TestIterStri... | next(ft.chunk(content, 5)) | assert | func_call | tests/test_fntools.py | test_chunk | TestIterStringIO | 148 | null |
reubano/meza | import itertools as it
import requests
import responses
from io import StringIO
from operator import itemgetter
import pytest
from meza import fntools as ft, io, stats
def setup_module():
"""site initialization"""
global initialized
initialized = True
print("Site Module Setup\n")
class TestIterStri... | ft.afterish("1001", ".") | assert | func_call | tests/test_fntools.py | test_afterish | TestIterStringIO | 84 | null |
reubano/meza | import itertools as it
import requests
import responses
from io import StringIO
from operator import itemgetter
import pytest
from meza import fntools as ft, io, stats
def setup_module():
"""site initialization"""
global initialized
initialized = True
print("Site Module Setup\n")
class TestIterStri... | ft.strip("spam") | assert | func_call | tests/test_fntools.py | test_strip | TestIterStringIO | 33 | null |
reubano/meza | import itertools as it
import requests
import responses
from io import StringIO
from operator import itemgetter
import pytest
from meza import fntools as ft, io, stats
def setup_module():
"""site initialization"""
global initialized
initialized = True
print("Site Module Setup\n")
class TestIterStri... | {"one": 1, "two": 2} | assert | collection | tests/test_fntools.py | test_objectify | TestIterStringIO | 202 | null |
reubano/meza | import itertools as it
from os import path as p
from json import loads
from tempfile import TemporaryFile
from io import StringIO, BytesIO
from decimal import Decimal
from urllib.request import urlopen
from contextlib import closing
import requests
import responses
import pygogo as gogo
import pytest
from meza impor... | record | assert | variable | tests/test_io.py | test_geojson | TestGeoJSON | 515 | null |
arogozhnikov/einops | import subprocess
import tempfile
from doctest import testmod
from pathlib import Path
import numpy as np
import pytest
import einops
import einops.layers
from einops._backends import AbstractBackend
from einops.einops import _optimize_transformation, parse_shape, rearrange
from einops.tests import collect_test_backe... | RuntimeError) | pytest.raises | variable | einops/tests/test_other.py | test_failures | 177 | null | |
arogozhnikov/einops | import subprocess
import tempfile
from doctest import testmod
from pathlib import Path
import numpy as np
import pytest
import einops
import einops.layers
from einops._backends import AbstractBackend
from einops.einops import _optimize_transformation, parse_shape, rearrange
from einops.tests import collect_test_backe... | parsed2 | assert | variable | einops/tests/test_other.py | test_parse_shape_imperative | 98 | null | |
arogozhnikov/einops | import pickle
from collections import namedtuple
import numpy as np
import pytest
from einops import EinopsError, rearrange, reduce
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
__author__ = "Alex Rogozhnikov"
testcase = namedtuple("testcas... | None | assert | none_literal | einops/tests/test_layers.py | test_einmix_decomposition | 370 | null | |
arogozhnikov/einops | import pickle
from collections import namedtuple
import numpy as np
import pytest
from einops import EinopsError, rearrange, reduce
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
__author__ = "Alex Rogozhnikov"
testcase = namedtuple("testcas... | model2.predict_on_batch(input)) | assert_* | func_call | einops/tests/test_layers.py | test_keras_layer | 302 | null | |
arogozhnikov/einops | import pickle
from collections import namedtuple
import numpy as np
import pytest
from einops import EinopsError, rearrange, reduce
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
__author__ = "Alex Rogozhnikov"
testcase = namedtuple("testcas... | model3(input)) | assert_* | func_call | einops/tests/test_layers.py | test_torch_layer | 222 | null | |
arogozhnikov/einops | import subprocess
import tempfile
from doctest import testmod
from pathlib import Path
import numpy as np
import pytest
import einops
import einops.layers
from einops._backends import AbstractBackend
from einops.einops import _optimize_transformation, parse_shape, rearrange
from einops.tests import collect_test_backe... | (10 * 20 * 20, 30, 1 * 2) | assert | collection | einops/tests/test_other.py | test_parse_shape_symbolic | 216 | null | |
arogozhnikov/einops | import pytest
from einops import EinopsError
from einops.parsing import AnonymousAxis, ParsedExpression, _ellipsis
__author__ = "Alex Rogozhnikov"
def test_parse_expression():
parsed = ParsedExpression("a1 b1 c1 d1")
assert parsed.identifiers == {"a1", "b1", "c1", "d1"}
assert parsed.composition ==... | 2 | assert | numeric_literal | einops/tests/test_parsing.py | test_parse_expression | 117 | null | |
arogozhnikov/einops | import itertools
import numpy as np
import pytest
from einops import EinopsError
from einops.einops import _enumerate_directions, rearrange, reduce, repeat
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
imp_op_backends = collect_test_backends... | result[tuple(pick[permutation])] | assert | func_call | einops/tests/test_ops.py | test_rearrange_permutations_numpy | 197 | null | |
arogozhnikov/einops | import numpy as np
import pytest
from einops import parse_shape, rearrange, reduce
from einops.tests import is_backend_tested
from einops.tests.test_ops import imp_op_backends
def test9(x):
# squeeze - unsqueeze
y = reduce(x, "b c h w -> b c () ()", reduction="max")
assert tuple(y.shape) ... | (10, 20, 1, 1) | assert | collection | einops/tests/test_examples.py | test9 | 66 | null | |
arogozhnikov/einops | import pickle
from collections import namedtuple
import numpy as np
import pytest
from einops import EinopsError, rearrange, reduce
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
__author__ = "Alex Rogozhnikov"
testcase = namedtuple("testcas... | 0.5 | assert | numeric_literal | einops/tests/test_layers.py | test_reduce_imperative | 148 | null | |
arogozhnikov/einops | import string
from typing import Any, Callable
import numpy as np
import pytest
from einops.einops import EinopsError, _compactify_pattern_for_einsum, einsum
from einops.tests import collect_test_backends
def test_layer():
for backend in collect_test_backends(layers=True, symbolic=False):
rng = np.random... | out_shape | assert | variable | einops/tests/test_einsum.py | test_layer | 181 | null | |
arogozhnikov/einops | import pickle
from collections import namedtuple
import numpy as np
import pytest
from einops import EinopsError, rearrange, reduce
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
__author__ = "Alex Rogozhnikov"
testcase = namedtuple("testcas... | model3.predict_on_batch(input)) | assert_* | func_call | einops/tests/test_layers.py | test_keras_layer | 293 | null | |
arogozhnikov/einops | import string
from typing import Any, Callable
import numpy as np
import pytest
from einops.einops import EinopsError, _compactify_pattern_for_einsum, einsum
from einops.tests import collect_test_backends
def test_functional():
# Functional tests:
backends = filter(lambda x: x.framework_name in valid_backend... | true_out_array) | assert_* | variable | einops/tests/test_einsum.py | test_functional | 230 | null | |
arogozhnikov/einops | import string
from typing import Any, Callable
import numpy as np
import pytest
from einops.einops import EinopsError, _compactify_pattern_for_einsum, einsum
from einops.tests import collect_test_backends
def test_functional_errors():
# Specific backend does not matter, as errors are raised
# during the patt... | NotImplementedError, match=r"^Singleton") | pytest.raises | complex_expr | einops/tests/test_einsum.py | test_functional_errors | 275 | null | |
arogozhnikov/einops | from io import StringIO
__author__ = "Alex Rogozhnikov"
from pathlib import Path
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
def render_notebook(filename: Path, replacements: dict[str, str]) -> str:
"""Takes path to the notebook, returns executed and rendered version
:param filen... | result | assert | variable | scripts/test_notebooks.py | test_notebook_2_with_all_backends | 55 | null | |
arogozhnikov/einops | import string
from typing import Any, Callable
import numpy as np
import pytest
from einops.einops import EinopsError, _compactify_pattern_for_einsum, einsum
from einops.tests import collect_test_backends
def test_functional_errors():
# Specific backend does not matter, as errors are raised
# during the patt... | RuntimeError, match=r"^Unknown axis") | pytest.raises | complex_expr | einops/tests/test_einsum.py | test_functional_errors | 327 | null | |
arogozhnikov/einops | import pickle
from collections import namedtuple
import numpy as np
import pytest
from einops import EinopsError, rearrange, reduce
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
__author__ = "Alex Rogozhnikov"
testcase = namedtuple("testcas... | [] | assert | collection | einops/tests/test_layers.py | test_einmix_decomposition | 396 | null | |
arogozhnikov/einops | import dataclasses
import numpy as np
import pytest
from einops import EinopsError, asnumpy, pack, unpack
from einops.tests import collect_test_backends
rng = np.random.default_rng()
def pack_unpack(xs, pattern):
x, ps = pack(xs, pattern)
unpacked = unpack(xs, ps, pattern)
assert len(unpacked) == len(xs... | ps2 | assert | variable | einops/tests/test_packing.py | test_pack_unpack_array_api | 300 | null | |
arogozhnikov/einops | import os
import sys
from pathlib import Path
from subprocess import Popen
__author__ = "Alex Rogozhnikov"
def run(cmd, **env):
# keeps printing output when testing
cmd = cmd.split(" ") if isinstance(cmd, str) else cmd
print("running:", cmd)
p = Popen(cmd, cwd=str(Path(__file__).parent), env={**os.env... | 0 | assert | numeric_literal | einops/tests/run_tests.py | main | 85 | null | |
arogozhnikov/einops | import itertools
import numpy as np
import pytest
from einops import EinopsError
from einops.einops import _enumerate_directions, rearrange, reduce, repeat
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
imp_op_backends = collect_test_backends... | len(axes2) | assert | func_call | einops/tests/test_ops.py | test_enumerating_directions | 393 | null | |
arogozhnikov/einops | import itertools
import numpy as np
import pytest
from einops import EinopsError
from einops.einops import _enumerate_directions, rearrange, reduce, repeat
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
imp_op_backends = collect_test_backends... | ax2.shape | assert | complex_expr | einops/tests/test_ops.py | test_enumerating_directions | 396 | null | |
arogozhnikov/einops | import dataclasses
import numpy as np
import pytest
from einops import EinopsError, asnumpy, pack, unpack
from einops.tests import collect_test_backends
rng = np.random.default_rng()
def pack_unpack(xs, pattern):
x, ps = pack(xs, pattern)
unpacked = unpack(xs, ps, pattern)
assert len(unpacked) == len(xs... | b.shape | assert | complex_expr | einops/tests/test_packing.py | check | 69 | null | |
arogozhnikov/einops | import numpy as np
import pytest
from einops import parse_shape, rearrange, reduce
from einops.tests import is_backend_tested
from einops.tests.test_ops import imp_op_backends
def test2(x):
# view / reshape
y = rearrange(x, "b c h w -> b (c h w)")
assert tuple(y.shape) == | (10, 20 * 30 * 40) | assert | collection | einops/tests/test_examples.py | test2 | 19 | null | |
arogozhnikov/einops | import dataclasses
import numpy as np
import pytest
from einops import EinopsError, asnumpy, pack, unpack
from einops.tests import collect_test_backends
rng = np.random.default_rng()
def pack_unpack(xs, pattern):
x, ps = pack(xs, pattern)
unpacked = unpack(xs, ps, pattern)
assert len(unpacked) == len(xs... | 0 | assert | numeric_literal | einops/tests/test_packing.py | test_pack_unpack_with_numpy | 168 | null | |
arogozhnikov/einops | import subprocess
import tempfile
from doctest import testmod
from pathlib import Path
import numpy as np
import pytest
import einops
import einops.layers
from einops._backends import AbstractBackend
from einops.einops import _optimize_transformation, parse_shape, rearrange
from einops.tests import collect_test_backe... | expected | assert | variable | einops/tests/test_other.py | test_parse_shape_symbolic_ellipsis | 243 | null | |
arogozhnikov/einops | import string
from typing import Any, Callable
import numpy as np
import pytest
from einops.einops import EinopsError, _compactify_pattern_for_einsum, einsum
from einops.tests import collect_test_backends
def test_functional():
# Functional tests:
backends = filter(lambda x: x.framework_name in valid_backend... | true_pattern | assert | variable | einops/tests/test_einsum.py | test_functional | 207 | null | |
arogozhnikov/einops | import pickle
from collections import namedtuple
import numpy as np
import pytest
from einops import EinopsError, rearrange, reduce
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
__author__ = "Alex Rogozhnikov"
testcase = namedtuple("testcas... | model4(input)) | assert_* | func_call | einops/tests/test_layers.py | test_torch_layer | 226 | null | |
arogozhnikov/einops | import string
from typing import Any, Callable
import numpy as np
import pytest
from einops.einops import EinopsError, _compactify_pattern_for_einsum, einsum
from einops.tests import collect_test_backends
def test_functional_errors():
# Specific backend does not matter, as errors are raised
# during the patt... | RuntimeError, match=r"^Too many axes") | pytest.raises | complex_expr | einops/tests/test_einsum.py | test_functional_errors | 320 | null | |
arogozhnikov/einops | import pytest
from einops import EinopsError
from einops.parsing import AnonymousAxis, ParsedExpression, _ellipsis
__author__ = "Alex Rogozhnikov"
def test_parse_expression():
parsed = ParsedExpression("a1 b1 c1 d1")
assert parsed.identifiers == {"a1", "b1", "c1", "d1"}
assert parsed.composition ==... | set() | assert | func_call | einops/tests/test_parsing.py | test_parse_expression | 92 | null | |
arogozhnikov/einops | import pickle
from collections import namedtuple
import numpy as np
import pytest
from einops import EinopsError, rearrange, reduce
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
__author__ = "Alex Rogozhnikov"
testcase = namedtuple("testcas... | model4.predict_on_batch(input)) | assert_* | func_call | einops/tests/test_layers.py | test_keras_layer | 305 | null | |
arogozhnikov/einops | import pickle
from collections import namedtuple
import numpy as np
import pytest
from einops import EinopsError, rearrange, reduce
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
__author__ = "Alex Rogozhnikov"
testcase = namedtuple("testcas... | model3(input + 1)) | assert_* | func_call | einops/tests/test_layers.py | test_torch_layer | 223 | null | |
arogozhnikov/einops | import dataclasses
import numpy as np
import pytest
from einops import EinopsError, asnumpy, pack, unpack
from einops.tests import collect_test_backends
rng = np.random.default_rng()
def pack_unpack(xs, pattern):
x, ps = pack(xs, pattern)
unpacked = unpack(xs, ps, pattern)
assert len(unpacked) == len(xs... | b.dtype | assert | complex_expr | einops/tests/test_packing.py | check | 68 | null | |
arogozhnikov/einops | import string
from typing import Any, Callable
import numpy as np
import pytest
from einops.einops import EinopsError, _compactify_pattern_for_einsum, einsum
from einops.tests import collect_test_backends
def test_functional_errors():
# Specific backend does not matter, as errors are raised
# during the patt... | ValueError, match=r"^The last argument") | pytest.raises | complex_expr | einops/tests/test_einsum.py | test_functional_errors | 337 | null | |
arogozhnikov/einops | import itertools
import numpy as np
import pytest
from einops import EinopsError
from einops.einops import _enumerate_directions, rearrange, reduce, repeat
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
imp_op_backends = collect_test_backends... | input.shape | assert | complex_expr | einops/tests/test_ops.py | test_rearrange_permutations_numpy | 206 | null | |
arogozhnikov/einops | import os
import sys
from pathlib import Path
from subprocess import Popen
__author__ = "Alex Rogozhnikov"
def run(cmd, **env):
# keeps printing output when testing
cmd = cmd.split(" ") if isinstance(cmd, str) else cmd
print("running:", cmd)
p = Popen(cmd, cwd=str(Path(__file__).parent), env={**os.env... | run("pip install {} --progress-bar off -q".format(" ".join(other_dependencies))) | assert | func_call | einops/tests/run_tests.py | main | 69 | null | |
arogozhnikov/einops | import dataclasses
import numpy as np
import pytest
from einops import EinopsError, asnumpy, pack, unpack
from einops.tests import collect_test_backends
rng = np.random.default_rng()
def pack_unpack(xs, pattern):
x, ps = pack(xs, pattern)
unpacked = unpack(xs, ps, pattern)
assert len(unpacked) == | len(xs) | assert | func_call | einops/tests/test_packing.py | pack_unpack | 15 | null | |
arogozhnikov/einops | import itertools
import numpy as np
import pytest
from einops import EinopsError
from einops.einops import _enumerate_directions, rearrange, reduce, repeat
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
imp_op_backends = collect_test_backends... | EinopsError) | pytest.raises | variable | einops/tests/test_ops.py | test_collapsed_ellipsis_errors_out | 47 | null | |
arogozhnikov/einops | import os
import sys
from pathlib import Path
from subprocess import Popen
__author__ = "Alex Rogozhnikov"
def run(cmd, **env):
# keeps printing output when testing
cmd = cmd.split(" ") if isinstance(cmd, str) else cmd
print("running:", cmd)
p = Popen(cmd, cwd=str(Path(__file__).parent), env={**os.env... | run("pip install {} --progress-bar off -q".format(" ".join(pip_instructions))) | assert | func_call | einops/tests/run_tests.py | main | 74 | null | |
arogozhnikov/einops | import numpy as np
import pytest
from einops import parse_shape, rearrange, reduce
from einops.tests import is_backend_tested
from einops.tests.test_ops import imp_op_backends
def test8(x):
# max-pooling
y = reduce(x, "b c (h h1) (w w1) -> b c h w", reduction="max", h1=2, w1=2)
assert tup... | (10, 20, 30 // 2, 40 // 2) | assert | collection | einops/tests/test_examples.py | test8 | 60 | null | |
arogozhnikov/einops | import subprocess
import tempfile
from doctest import testmod
from pathlib import Path
import numpy as np
import pytest
import einops
import einops.layers
from einops._backends import AbstractBackend
from einops.einops import _optimize_transformation, parse_shape, rearrange
from einops.tests import collect_test_backe... | is_float | assert | variable | einops/tests/test_other.py | test_is_float_type | 254 | null | |
arogozhnikov/einops | import pytest
from einops import EinopsError
from einops.parsing import AnonymousAxis, ParsedExpression, _ellipsis
__author__ = "Alex Rogozhnikov"
def test_anonymous_axes():
a, b = AnonymousAxis("2"), AnonymousAxis("2")
assert a != | b | assert | variable | einops/tests/test_parsing.py | test_anonymous_axes | 23 | null | |
arogozhnikov/einops | import pytest
from einops import EinopsError
from einops.parsing import AnonymousAxis, ParsedExpression, _ellipsis
__author__ = "Alex Rogozhnikov"
def test_anonymous_axes():
a, b = AnonymousAxis("2"), AnonymousAxis("2")
assert a != b
c, d = AnonymousAxisPlaceholder(2), AnonymousAxisPlaceholder(3)
ass... | [c, 2, c] | assert | collection | einops/tests/test_parsing.py | test_anonymous_axes | 27 | null | |
arogozhnikov/einops | from io import StringIO
__author__ = "Alex Rogozhnikov"
from pathlib import Path
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
def render_notebook(filename: Path, replacements: dict[str, str]) -> str:
"""Takes path to the notebook, returns executed and rendered version
:param filen... | nb_as_str | assert | variable | scripts/test_notebooks.py | render_notebook | 30 | null | |
arogozhnikov/einops | import itertools
import numpy as np
import pytest
from einops import EinopsError
from einops.einops import _enumerate_directions, rearrange, reduce, repeat
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
imp_op_backends = collect_test_backends... | 0 | assert | numeric_literal | einops/tests/test_ops.py | test_rearrange_consistency_numpy | 159 | null | |
arogozhnikov/einops | import numpy as np
import pytest
from einops import parse_shape, rearrange, reduce
from einops.tests import is_backend_tested
from einops.tests.test_ops import imp_op_backends
def test3(x):
# depth-to-space
y = rearrange(x, "b (c h1 w1) h w -> b c (h h1) (w w1)", h1=2, w1=2)
assert tuple(... | (10, 5, 30 * 2, 40 * 2) | assert | collection | einops/tests/test_examples.py | test3 | 25 | null | |
arogozhnikov/einops | import numpy as np
import pytest
from einops import parse_shape, rearrange, reduce
from einops.tests import is_backend_tested
from einops.tests.test_ops import imp_op_backends
def test9(x):
# squeeze - unsqueeze
y = reduce(x, "b c h w -> b c () ()", reduction="max")
assert tuple(y.shape) =... | (20, 10) | assert | collection | einops/tests/test_examples.py | test9 | 68 | null | |
arogozhnikov/einops | import pytest
from einops import EinopsError
from einops.parsing import AnonymousAxis, ParsedExpression, _ellipsis
__author__ = "Alex Rogozhnikov"
def test_parse_expression():
parsed = ParsedExpression("a1 b1 c1 d1")
assert parsed.identifiers == {"a1", "b1", "c1", "d1"}
assert parsed.composition ==... | 6 | assert | numeric_literal | einops/tests/test_parsing.py | test_parse_expression | 116 | null | |
arogozhnikov/einops | import string
from typing import Any, Callable
import numpy as np
import pytest
from einops.einops import EinopsError, _compactify_pattern_for_einsum, einsum
from einops.tests import collect_test_backends
def test_functional_symbolic():
backends = filter(
lambda x: x.framework_name in valid_backends_func... | expected_out_data) | assert_* | variable | einops/tests/test_einsum.py | test_functional_symbolic | 262 | null | |
arogozhnikov/einops | import numpy as np
import pytest
from einops import parse_shape, rearrange, reduce
from einops.tests import is_backend_tested
from einops.tests.test_ops import imp_op_backends
def test1(x):
# transpose
y = rearrange(x, "b c h w -> b h w c")
assert tuple(y.shape) == | (10, 30, 40, 20) | assert | collection | einops/tests/test_examples.py | test1 | 13 | null | |
arogozhnikov/einops | import numpy as np
import pytest
from einops import parse_shape, rearrange, reduce
from einops.tests import is_backend_tested
from einops.tests.test_ops import imp_op_backends
def test11(x):
# concatenate
tensors = list(x + 0) # 0 is needed https://github.com/tensorflow/tensorflow/issues/23185
... | (30, 10 * 40, 20) | assert | collection | einops/tests/test_examples.py | test11 | 82 | null | |
arogozhnikov/einops | import pytest
from einops import EinopsError
from einops.parsing import AnonymousAxis, ParsedExpression, _ellipsis
__author__ = "Alex Rogozhnikov"
def test_invalid_expressions():
# double ellipsis should raise an error
ParsedExpression("... a b c d")
with pytest.raises( | EinopsError) | pytest.raises | variable | einops/tests/test_parsing.py | test_invalid_expressions | 54 | null | |
arogozhnikov/einops | import itertools
import numpy as np
import pytest
from einops import EinopsError
from einops.einops import _enumerate_directions, rearrange, reduce, repeat
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
imp_op_backends = collect_test_backends... | result[1, 2, 0] | assert | complex_expr | einops/tests/test_ops.py | test_rearrange_consistency_numpy | 183 | null | |
arogozhnikov/einops | import pickle
from collections import namedtuple
import numpy as np
import pytest
from einops import EinopsError, rearrange, reduce
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
__author__ = "Alex Rogozhnikov"
testcase = namedtuple("testcas... | value2 | assert | variable | einops/tests/test_layers.py | test_flax_layers | 352 | null | |
arogozhnikov/einops | import pickle
from collections import namedtuple
import numpy as np
import pytest
from einops import EinopsError, rearrange, reduce
from einops.tests import FLOAT_REDUCTIONS as REDUCTIONS
from einops.tests import collect_test_backends, is_backend_tested
__author__ = "Alex Rogozhnikov"
testcase = namedtuple("testcas... | model4(input + 1)) | assert_* | func_call | einops/tests/test_layers.py | test_torch_layer | 227 | null | |
arogozhnikov/einops | import subprocess
import tempfile
from doctest import testmod
from pathlib import Path
import numpy as np
import pytest
import einops
import einops.layers
from einops._backends import AbstractBackend
from einops.einops import _optimize_transformation, parse_shape, rearrange
from einops.tests import collect_test_backe... | 0 | assert | numeric_literal | einops/tests/test_other.py | test_backends_installed | 52 | null | |
datarobot/syftr | from pathlib import Path
from syftr.configuration import cfg
from syftr.studies import StudyConfig
from tests.check_trials import check_trials_are_flawless
from tests.e2e.optimization import run_and_test_optimization
PARAM_LIST = ["rag_mode"]
def test_no_rag_seeding():
study_config_file = Path(cfg.paths.test_stu... | 9 | assert | numeric_literal | tests/e2e/test_no_rag.py | test_no_rag_seeding | 19 | null | |
datarobot/syftr | from pathlib import Path
import optuna
import pytest
from syftr.configuration import cfg
from syftr.studies import StudyConfig
from tests.check_trials import check_trials_are_flawless
from tests.e2e.optimization import run_and_test_optimization
def test_seeding_with_search_space_violation_and_exception():
study_... | ValueError) | pytest.raises | variable | tests/e2e/test_seeding.py | test_seeding_with_search_space_violation_and_exception | 73 | null | |
datarobot/syftr | import pathlib
from pathlib import Path
from unittest.mock import MagicMock, patch
import optuna
import pandas as pd
import pytest
from syftr import api
from syftr.configuration import cfg
from syftr.studies import StudyConfig
MOCK_STUDY = MagicMock(spec=optuna.Study)
MOCK_STUDY.study_name = "example-dr-docs"
TRIALS... | api.SyftrStudyStatus.COMPLETED | assert | complex_expr | tests/unit/test_api.py | test_status_completed | 108 | null | |
datarobot/syftr | import math
import typing as T
from syftr.studies import (
FewShotRetriever,
Hybrid,
LLMConfig,
QueryDecomposition,
Reranker,
Retriever,
SearchSpace,
Splitter,
TopK,
)
MINIMAL_LLMS: T.List[str] = ["llmA", "llmB"]
def _get_minimal_splitter() -> Splitter:
return Splitter(
... | r.top_k.get_cardinality() * len(r.methods) * len(r.query_decomposition_enabled) * r.hybrid.get_cardinality() * r.query_decomposition.get_cardinality() * r.fusion.get_cardinality() | assert | func_call | tests/unit/test_cardinality.py | test_retiever_cardinality | 94 | null | |
datarobot/syftr | import logging
import typing as T
import pytest
from syftr.embeddings.timeouts import EmbeddingPreemptiveTimeoutError
from syftr.huggingface_helper import get_embedding_model
from syftr.logger import logger
from syftr.storage import FinanceBenchHF, PartitionMap
from syftr.studies import StudyConfig
def test_embeddin... | caplog.text | assert | complex_expr | tests/functional/test_embedding_models.py | test_embedding_model_skip_timeout | 50 | null | |
datarobot/syftr | import math
import typing as T
from syftr.studies import (
FewShotRetriever,
Hybrid,
LLMConfig,
QueryDecomposition,
Reranker,
Retriever,
SearchSpace,
Splitter,
TopK,
)
MINIMAL_LLMS: T.List[str] = ["llmA", "llmB"]
def _get_minimal_splitter() -> Splitter:
return Splitter(
... | 4 | assert | numeric_literal | tests/unit/test_cardinality.py | test_splitter_cardinality | 31 | null | |
datarobot/syftr | import math
import typing as T
from syftr.studies import (
FewShotRetriever,
Hybrid,
LLMConfig,
QueryDecomposition,
Reranker,
Retriever,
SearchSpace,
Splitter,
TopK,
)
MINIMAL_LLMS: T.List[str] = ["llmA", "llmB"]
def _get_minimal_splitter() -> Splitter:
return Splitter(
... | 1 | assert | numeric_literal | tests/unit/test_cardinality.py | test_topk_cardinality | 43 | null | |
datarobot/syftr | import datasets
from syftr.storage import (
BrightHF,
CragTask3HF,
DRDocsHF,
FinanceBenchHF,
HotPotQAHF,
MultiHopRAGHF,
PartitionMap,
PhantomWikiV001HF,
PhantomWikiv050,
SyntheticCragTask3HF,
SyntheticFinanceBenchHF,
SyntheticHotPotQAHF,
)
def test_drdocs_hf():
"""D... | 2 | assert | numeric_literal | tests/functional/test_hf_datasets.py | test_drdocs_hf | 31 | null | |
datarobot/syftr | import datasets
from syftr.storage import (
BrightHF,
CragTask3HF,
DRDocsHF,
FinanceBenchHF,
HotPotQAHF,
MultiHopRAGHF,
PartitionMap,
PhantomWikiV001HF,
PhantomWikiv050,
SyntheticCragTask3HF,
SyntheticFinanceBenchHF,
SyntheticHotPotQAHF,
)
def test_multihoprag_hf():
... | 0 | assert | numeric_literal | tests/functional/test_hf_datasets.py | test_multihoprag_hf | 848 | null | |
datarobot/syftr | import pytest
from syftr.configuration import cfg
from syftr.studies import StudyConfig
from tests.check_trials import check_trials_are_flawless
from tests.e2e.optimization import run_and_test_optimization
@pytest.mark.parametrize(
"config_file_name",
[
"test-tools-anthropic-haiku-35.yaml",
# ... | 5 | assert | numeric_literal | tests/e2e/test_tools.py | test_agents_with_tool_use | 28 | null | |
datarobot/syftr | import pathlib
from pathlib import Path
from unittest.mock import MagicMock, patch
import optuna
import pandas as pd
import pytest
from syftr import api
from syftr.configuration import cfg
from syftr.studies import StudyConfig
MOCK_STUDY = MagicMock(spec=optuna.Study)
MOCK_STUDY.study_name = "example-dr-docs"
TRIALS... | None | assert | none_literal | tests/unit/test_api.py | test_pareto_df | 44 | null | |
datarobot/syftr | import time
from pathlib import Path
import pytest
from syftr import api
from syftr.configuration import cfg
EXAMPLE_STUDY_CONFIG_PATH = Path(cfg.paths.studies_dir / "example-dr-docs.yaml")
NON_EXISTANT_STUDY_CONFIG_PATH = Path(
cfg.paths.test_studies_dir / "hotpot-toy-non-existent.yaml"
)
def test_get_study_ge... | "Cannot find study example-dr-docs in the database." | assert | string_literal | tests/integration/test_api_e2e.py | test_get_study_get_delete | 76 | null | |
datarobot/syftr | import time
from pathlib import Path
import pytest
from syftr import api
from syftr.configuration import cfg
EXAMPLE_STUDY_CONFIG_PATH = Path(cfg.paths.studies_dir / "example-dr-docs.yaml")
NON_EXISTANT_STUDY_CONFIG_PATH = Path(
cfg.paths.test_studies_dir / "hotpot-toy-non-existent.yaml"
)
def test_start_stop()... | api.SyftrStudyStatus.RUNNING | assert | complex_expr | tests/integration/test_api_e2e.py | test_start_stop | 19 | null | |
datarobot/syftr | import pytest
from syftr.evaluation.evaluator_factory import json_parser_function
@pytest.mark.parametrize(
"data,expected_score,expected_reasoning",
[
(
'{"score": 1e2, "reasoning": "Looks good."}',
1e2,
"Looks good.",
),
(
'Reasoning mi... | expected_reasoning | assert | variable | tests/unit/test_evaluator_factory.py | test_json_parser | 107 | null | |
datarobot/syftr | from pathlib import Path
from syftr.configuration import cfg
from syftr.helpers import get_baselines_from_trials
from syftr.optuna_helper import (
get_completed_trials,
get_flows_from_trials,
get_pareto_flows,
)
from syftr.studies import StudyConfig
from syftr.tuner.qa_tuner import run
from tests.check_tri... | study_config.pareto.replacement_llm_name | assert | complex_expr | tests/e2e/test_meta.py | test_separate_pareto_replace_llm_evaluation | 105 | null | |
datarobot/syftr | import time
from pathlib import Path
import pytest
from syftr import api
from syftr.configuration import cfg
EXAMPLE_STUDY_CONFIG_PATH = Path(cfg.paths.studies_dir / "example-dr-docs.yaml")
NON_EXISTANT_STUDY_CONFIG_PATH = Path(
cfg.paths.test_studies_dir / "hotpot-toy-non-existent.yaml"
)
def test_stop_not_run... | "This study is not running. Run it first." | assert | string_literal | tests/integration/test_api_e2e.py | test_stop_not_running | 83 | null | |
datarobot/syftr | def test_reranker_flow_rag(hotpot_reranker_flow, correctness_evaluator):
question = "Who is Adam Collis?"
response, duration, call_data = hotpot_reranker_flow.generate(question)
assert duration > | 0 | assert | numeric_literal | tests/functional/test_reranker.py | test_reranker_flow_rag | 5 | null | |
datarobot/syftr | from pathlib import Path
import optuna
import pytest
from syftr.configuration import cfg
from syftr.studies import StudyConfig
from tests.check_trials import check_trials_are_flawless
from tests.e2e.optimization import run_and_test_optimization
def test_seeding_individual_and_variations():
study_config_file_name... | len(df_all) | assert | func_call | tests/e2e/test_seeding.py | test_seeding_individual_and_variations | 28 | null | |
datarobot/syftr | import pathlib
from pathlib import Path
from unittest.mock import MagicMock, patch
import optuna
import pandas as pd
import pytest
from syftr import api
from syftr.configuration import cfg
from syftr.studies import StudyConfig
MOCK_STUDY = MagicMock(spec=optuna.Study)
MOCK_STUDY.study_name = "example-dr-docs"
TRIALS... | api.SyftrStudyStatus.INITIALIZED | assert | complex_expr | tests/unit/test_api.py | test_status_non_existent | 113 | null | |
datarobot/syftr | import math
import typing as T
from syftr.studies import (
FewShotRetriever,
Hybrid,
LLMConfig,
QueryDecomposition,
Reranker,
Retriever,
SearchSpace,
Splitter,
TopK,
)
MINIMAL_LLMS: T.List[str] = ["llmA", "llmB"]
def _get_minimal_splitter() -> Splitter:
return Splitter(
... | expected_rag_card | assert | variable | tests/unit/test_cardinality.py | test_search_space_cardinality | 157 | null | |
datarobot/syftr | import typing as T
import numpy as np
import pandas as pd
from syftr.helpers import get_flows_from_trials
NON_NAN_COLUMNS = [
"number",
"values_0",
"values_1",
"datetime_start",
"datetime_complete",
"duration",
"user_attrs_dataset",
"user_attrs_flow",
"user_attrs_flow_name",
"... | df_trials.columns | assert | complex_expr | tests/check_trials.py | check_trials_are_flawless | 66 | null | |
datarobot/syftr | import pytest
from syftr.tuner.core import get_flow_name
@pytest.mark.parametrize(
"rag_mode, expected",
[
("no_rag", "Flow"),
("rag", "RAGFlow"),
("react_rag_agent", "ReActAgentFlow"),
("critique_rag_agent", "CritiqueAgentFlow"),
("sub_question_rag", "SubQuestionRAGFlo... | expected | assert | variable | tests/unit/test_flow.py | test_flow_name | 18 | null | |
datarobot/syftr | import datasets
from syftr.storage import (
BrightHF,
CragTask3HF,
DRDocsHF,
FinanceBenchHF,
HotPotQAHF,
MultiHopRAGHF,
PartitionMap,
PhantomWikiV001HF,
PhantomWikiv050,
SyntheticCragTask3HF,
SyntheticFinanceBenchHF,
SyntheticHotPotQAHF,
)
def test_crag_hf():
def _t... | 1 | assert | numeric_literal | tests/functional/test_hf_datasets.py | test_crag_hf | 168 | null | |
datarobot/syftr | import datasets
from syftr.storage import (
BrightHF,
CragTask3HF,
DRDocsHF,
FinanceBenchHF,
HotPotQAHF,
MultiHopRAGHF,
PartitionMap,
PhantomWikiV001HF,
PhantomWikiv050,
SyntheticCragTask3HF,
SyntheticFinanceBenchHF,
SyntheticHotPotQAHF,
)
def test_crag_hf():
def _t... | 7 | assert | numeric_literal | tests/functional/test_hf_datasets.py | test_crag_hf | 176 | null | |
datarobot/syftr | import datasets
from syftr.storage import (
BrightHF,
CragTask3HF,
DRDocsHF,
FinanceBenchHF,
HotPotQAHF,
MultiHopRAGHF,
PartitionMap,
PhantomWikiV001HF,
PhantomWikiv050,
SyntheticCragTask3HF,
SyntheticFinanceBenchHF,
SyntheticHotPotQAHF,
)
def test_drdocs_hf():
"""D... | 5 | assert | numeric_literal | tests/functional/test_hf_datasets.py | test_drdocs_hf | 42 | null | |
datarobot/syftr | import pathlib
from pathlib import Path
from unittest.mock import MagicMock, patch
import optuna
import pandas as pd
import pytest
from syftr import api
from syftr.configuration import cfg
from syftr.studies import StudyConfig
MOCK_STUDY = MagicMock(spec=optuna.Study)
MOCK_STUDY.study_name = "example-dr-docs"
TRIALS... | "Cannot find study non_existent_study in the database." | assert | string_literal | tests/unit/test_api.py | test_get_study_non_existent_in_db | 119 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.