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 |
|---|---|---|---|---|---|---|---|---|---|
openapi-generators/openapi-python-client | from typing import Literal
import pytest
from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestStringLiteralEnum:
def test_enum_prop(self, MyModel):
assert... | MyModel(enum_prop="A")) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_enums_and_consts.py | test_enum_prop | TestStringLiteralEnum | 272 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestArraySchemas:
def test_array_of_object(self, ModelWithArrayOfObjects, SimpleObject):
asse | ModelWithArrayOfObjects(array_prop=[SimpleObject(name="a"), SimpleObject(name="b")])) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_arrays.py | test_array_of_object | TestArraySchemas | 55 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestSimpleTypeList:
def test_decode_encode(self, MyModel):
assert_model_decode_encode(MyModel, {"stringOrI... | MyModel(string_or_int_prop=1)) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_unions.py | test_decode_encode | TestSimpleTypeList | 28 | null |
openapi-generators/openapi-python-client | from typing import Any, Dict
import re
from click.testing import Result
import pytest
from end_to_end_tests.generated_client import generate_client_from_inline_spec, GeneratedClientContext
def with_generated_client_fixture(
openapi_spec: str,
name: str="generated_client",
config: str="",
extra_args: ... | output | assert | variable | end_to_end_tests/functional_tests/helpers.py | __init__ | _GeneratorWarningsParser | 121 | null |
openapi-generators/openapi-python-client | from typing import Any
from end_to_end_tests.functional_tests.helpers import (
with_generated_code_import,
with_generated_client_fixture,
)
class TestEndpointDocstrings:
def test_description(self, get_simple_thing_sync):
assert DocstringParser(get_simple_thing_sync).lines[0] == | "Get a simple thing." | assert | string_literal | end_to_end_tests/functional_tests/generated_code_execution/test_docstrings.py | test_description | TestEndpointDocstrings | 139 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestArraysWithPrefixItems:
def test_single_prefix_item(self, ModelWithSinglePrefixItem):
asse | ModelWithSinglePrefixItem(array_prop=["a"])) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_arrays.py | test_single_prefix_item | TestArraysWithPrefixItems | 108 | null |
openapi-generators/openapi-python-client | import datetime
import uuid
import pytest
from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestRequiredAndOptionalProperties:
def test_type_hints(self, MyModel):... | "str | Unset") | assert_* | string_literal | end_to_end_tests/functional_tests/generated_code_execution/test_properties.py | test_type_hints | TestRequiredAndOptionalProperties | 73 | null |
openapi-generators/openapi-python-client | from unittest.mock import MagicMock
import httpx
import pytest
from end_to_end_tests.functional_tests.helpers import (
with_generated_client_fixture,
with_generated_code_import,
)
class TestPathParameterEncoding:
def test_path_params_with_normal_chars_work(self, sync_detailed, Client):
"""Test t... | expected_url | assert | variable | end_to_end_tests/functional_tests/generated_code_execution/test_path_parameters.py | test_path_params_with_normal_chars_work | TestPathParameterEncoding | 69 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import (
assert_bad_schema,
inline_spec_should_fail,
with_generated_client_fixture,
)
class TestEnumAndConstInvalidSchemas:
def test_enum_unsupported_type(self, generated_client):
assert_bad_schema(generated_client, "WithUnsupportedType", | "Unsupported enum type") | assert_* | string_literal | end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_enums_and_consts.py | test_enum_unsupported_type | TestEnumAndConstInvalidSchemas | 48 | null |
openapi-generators/openapi-python-client | from end_to_end_tests.functional_tests.helpers import assert_bad_schema, with_generated_client_fixture
class TestUnionInvalidSchemas:
def test_invalid_property(self, generated_client):
assert_bad_schema(generated_client, "UnionWithMalformedVariant", | "Invalid property in union") | assert_* | string_literal | end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_unions.py | test_invalid_property | TestUnionInvalidSchemas | 28 | null |
openapi-generators/openapi-python-client | import datetime
import uuid
import pytest
from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestRequiredAndOptionalProperties:
def test_required_and_optional(self... | MyModel(req1="a", req2="b", opt="c")) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_properties.py | test_required_and_optional | TestRequiredAndOptionalProperties | 52 | null |
openapi-generators/openapi-python-client | from typing import Literal
import pytest
from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestConst:
def test_valid_int(self, MyModel):
asse | MyModel(must_be_thirty=30)) | assert_* | func_call | end_to_end_tests/functional_tests/generated_code_execution/test_enums_and_consts.py | test_valid_int | TestConst | 226 | null |
openapi-generators/openapi-python-client | import datetime
import uuid
import pytest
from end_to_end_tests.functional_tests.helpers import (
assert_model_decode_encode,
assert_model_property_type_hint,
with_generated_client_fixture,
with_generated_code_imports,
)
class TestBasicModelProperties:
@pytest.mark.parametrize(
"bad_data"... | Exception) | pytest.raises | variable | end_to_end_tests/functional_tests/generated_code_execution/test_properties.py | test_decode_error_not_object | TestBasicModelProperties | 130 | null |
openapi-generators/openapi-python-client | from typing import Any
from end_to_end_tests.functional_tests.helpers import (
with_generated_code_import,
with_generated_client_fixture,
)
class TestEndpointDocstrings:
def test_response_union_type(self, post_simple_thing_sync):
returns_line = DocstringParser(post_simple_thing_sync).get_section(... | ( "GoodResponse | ErrorResponse", "ErrorResponse | GoodResponse", ) | assert | collection | end_to_end_tests/functional_tests/generated_code_execution/test_docstrings.py | test_response_union_type | TestEndpointDocstrings | 148 | null |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_traversing_tree_2d():
x = np.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8, dtype=np.float64)
wp = pywt.WaveletPacket2D(data=x, wavelet='db1', mode='symmetric')
assert_(... | lambda: wp['f']) | assert_* | complex_expr | pywt/tests/test_wp2d.py | test_traversing_tree_2d | 33 | null | |
PyWavelets/pywt | import os
import pickle
from itertools import product
import numpy as np
import pytest
from numpy.testing import (
assert_allclose,
assert_almost_equal,
assert_equal,
assert_raises,
)
import pywt
def ref_gaus(LB, UB, N, num):
X = np.linspace(LB, UB, N)
F0 = (2./np.pi)**(1./4.)*np.exp(-(X**2))... | Fb) | assert_* | variable | pywt/tests/test_cwt_wavelets.py | test_shan | 163 | null | |
PyWavelets/pywt | import operator
from functools import reduce
from itertools import product
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_accessing_node_attributes_nd():
x = np.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8, dtype=np.float64)
wp = pywt.WaveletPa... | np.zeros((2, 2)) - 4) | assert_* | func_call | pywt/tests/test_wpnd.py | test_accessing_node_attributes_nd | 49 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose
import pywt
def check_coefficients_orthogonal(wavelet):
epsilon = 5e-11
level = 5
w = pywt.Wavelet(wavelet)
phi, psi, x = w.wavefun(level=level)
# Lowpass filter coefficients sum to sqrt2
res = np.... | psi_d_expect) | assert_* | variable | pywt/tests/test_wavelet.py | test_wavefun_bior13 | 266 | null | |
PyWavelets/pywt | from itertools import combinations
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
dtypes_in = [np.int8, np.float16, np.float32, np.float64, np.complex64,
np.complex128]
dtypes_out = [np.float64, np.float32, np.float32, np.float64, np.comple... | r) | assert_* | variable | pywt/tests/test_multidim.py | test_dwdtn_idwtn_allwavelets | 69 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_array_equal, assert_raises
import pywt
dtypes_in = [np.int8, np.float16, np.float32, np.float64, np.complex64,
np.complex128]
dtypes_out = [np.float64, np.float32, np.float32, np.float64, np.complex64,
np.complex1... | cA0) | assert_* | variable | pywt/tests/test_dwt_idwt.py | test_dwt_single_axis | 161 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_acess_path():
x = [1, 2, 3, 4, 5, 6, 7, 8]
wp = pywt.WaveletPacket(data=x, wavelet='db1', mode='symmetric')
assert_(wp['a'].path == 'a')
assert_(wp['aa'].pa... | lambda: wp['aaaa'].path) | assert_* | complex_expr | pywt/tests/test_wp.py | test_acess_path | 49 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_raises
import pywt
def test_ContinuousWavelet_errs():
assert_raises(ValueError, pywt.ContinuousWavelet, | 'qwertz') | assert_* | string_literal | pywt/tests/test__pywt.py | test_ContinuousWavelet_errs | 136 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_2d_roundtrip():
# test case corresponding to PyWavelets issue 447
original = pywt.data.camera()
wp = pywt.WaveletPacket2D(data=original, wavelet='db3', mode='smo... | r) | assert_* | variable | pywt/tests/test_wp2d.py | test_2d_roundtrip | 203 | null | |
PyWavelets/pywt | import os
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_raises
import pywt.data
data_dir = os.path.join(os.path.dirname(__file__), 'data')
wavelab_data_file = os.path.join(data_dir, 'wavelab_test_signals.npz')
wavelab_result_dict = np.load(wavelab_data_file)
def test_wavelab_signals(... | 512) | assert_* | numeric_literal | pywt/tests/test_data.py | test_wavelab_signals | 75 | null | |
PyWavelets/pywt | from itertools import combinations
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
dtypes_in = [np.int8, np.float16, np.float32, np.float64, np.complex64,
np.complex128]
dtypes_out = [np.float64, np.float32, np.float32, np.float64, np.comple... | coefs2) | assert_* | variable | pywt/tests/test_multidim.py | test_negative_axes | 345 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_data_reconstruction_delete_nodes_2d():
x = np.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8, dtype=np.float64)
wp = pywt.WaveletPacket2D(data=x, wavelet='db1', mode='symmetri... | lambda: new_wp['va']) | assert_* | complex_expr | pywt/tests/test_wp2d.py | test_data_reconstruction_delete_nodes_2d | 151 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_wavelet_packet_axes():
rstate = np.random.RandomState(0)
shape = (32, 16)
x = rstate.standard_normal(shape)
for axes in [(0, 1), (1, 0), (-2, 1)]:
wp... | x.dtype) | assert_* | complex_expr | pywt/tests/test_wp2d.py | test_wavelet_packet_axes | 225 | null | |
PyWavelets/pywt | import os
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_raises
import pywt.data
data_dir = os.path.join(os.path.dirname(__file__), 'data')
wavelab_data_file = os.path.join(data_dir, 'wavelab_test_signals.npz')
wavelab_result_dict = np.load(wavelab_data_file)
def test_data_aero():
... | ref) | assert_* | variable | pywt/tests/test_data.py | test_data_aero | 20 | null | |
PyWavelets/pywt | import numpy as np
import pytest
from numpy.testing import assert_allclose
import pywt
from pywt import data
from pywt._utils import AxisError
tol_single = 1e-6
tol_double = 1e-13
atol = 1e-7
@pytest.mark.parametrize('wavelet', ['db2', 'sym4', 'coif5'])
@pytest.mark.parametrize('transform', ['dwt', 'swt'])
@pytest.m... | y) | assert_* | variable | pywt/tests/test_mra.py | test_mra_roundtrip | 47 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
float_dtypes = [np.float32, np.float64, np.complex64, np.complex128]
real_dtypes = [np.float32, np.float64]
def _sign(x):
# Matlab-like sign function (numpy uses a different convention).
return x / ... | 'less') | assert_* | string_literal | pywt/tests/test_thresholding.py | test_threshold | 97 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_allclose, assert_equal, assert_raises
import pywt
def test_dwt_short_input_allmodes():
# some test cases where the input is shorter than the DWT filter
x = [1, 3, 2]
wavelet = 'db2'
# manually pad each end by the filter size (4 for 'db2' used here)
... | expected_result[0]) | assert_* | complex_expr | pywt/tests/test_modes.py | test_dwt_short_input_allmodes | 97 | null | |
PyWavelets/pywt | import warnings
from copy import deepcopy
from itertools import combinations, permutations
import numpy as np
import pytest
from numpy.testing import (
assert_,
assert_allclose,
assert_array_equal,
assert_equal,
)
import pywt
from pywt._extensions._swt import swt_axis
dtypes_in = [np.int8, np.float16... | xr) | assert_* | variable | pywt/tests/test_swt.py | test_swt_roundtrip_dtypes | 201 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose
import pywt
def check_coefficients_orthogonal(wavelet):
epsilon = 5e-11
level = 5
w = pywt.Wavelet(wavelet)
phi, psi, x = w.wavefun(level=level)
# Lowpass filter coefficients sum to sqrt2
res = np.... | phi_d_expect) | assert_* | variable | pywt/tests/test_wavelet.py | test_wavefun_bior13 | 264 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose
import pywt
def test_wavelet_properties():
w = pywt.Wavelet('db3')
# Name
assert_(w.name == 'db3')
assert_(w.short_family_name == 'db')
assert_(w.family_name, 'Daubechies')
# String representation
... | dec_hi) | assert_* | variable | pywt/tests/test_wavelet.py | test_wavelet_properties | 35 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_raises
import pywt
def test_dwt_max_level():
assert_(pywt.dwt_max_level(16, 2) == 4)
assert_(pywt.dwt_max_level(16, 8) == 1)
assert_(pywt.dwt_max_level(16, 9) == 1)
assert_(pywt.dwt_max_level(16, 10) == 0)
assert_(pywt.d... | -1) | assert_* | numeric_literal | pywt/tests/test__pywt.py | test_dwt_max_level | 131 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_allclose, assert_equal, assert_raises
import pywt
def test_dwt_idwt_allmodes():
# Test that :func:`dwt` and :func:`idwt` can be performed using every mode
x = [1, 2, 1, 5, -1, 8, 4, 6]
dwt_results = {
'zero': ([-0.03467518, 1.73309178, 3.40612438... | dwt_results[mode][1]) | assert_* | complex_expr | pywt/tests/test_modes.py | test_dwt_idwt_allmodes | 70 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_reconstructing_data():
x = [1, 2, 3, 4, 5, 6, 7, 8]
wp = pywt.WaveletPacket(data=x, wavelet='db1', mode='symmetric')
# Create another Wavelet Packet and feed it... | x) | assert_* | variable | pywt/tests/test_wp.py | test_reconstructing_data | 103 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose
import pywt
def test_wavelet_properties():
w = pywt.Wavelet('db3')
# Name
assert_(w.name == 'db3')
assert_(w.short_family_name == 'db')
assert_(w.family_name, 'Daubechies')
# String representation
... | rec_lo) | assert_* | variable | pywt/tests/test_wavelet.py | test_wavelet_properties | 36 | null | |
PyWavelets/pywt | import warnings
from copy import deepcopy
from itertools import combinations, permutations
import numpy as np
import pytest
from numpy.testing import (
assert_,
assert_allclose,
assert_array_equal,
assert_equal,
)
import pywt
from pywt._extensions._swt import swt_axis
dtypes_in = [np.int8, np.float16... | r1) | assert_* | variable | pywt/tests/test_swt.py | test_swt2_axes | 296 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_traversing_tree_2d():
x = np.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8, dtype=np.float64)
wp = pywt.WaveletPacket2D(data=x, wavelet='db1', mode='symmetric')
assert_(... | -np.ones((4, 4))) | assert_* | func_call | pywt/tests/test_wp2d.py | test_traversing_tree_2d | 24 | null | |
PyWavelets/pywt | import warnings
import numpy as np
import pytest
from numpy.testing import assert_array_equal
import pywt
def test_mode_equivalence():
old_new = [('zpd', 'zero'),
('cpd', 'constant'),
('sym', 'symmetric'),
('ppd', 'periodic'),
('sp1', 'smooth'),
... | pywt.dwt(x, 'db2', mode=new)) | assert_* | func_call | pywt/tests/test_deprecations.py | test_mode_equivalence | 75 | null | |
PyWavelets/pywt | import operator
from functools import reduce
from itertools import product
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_traversing_tree_nd():
x = np.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8, dtype=np.float64)
wp = pywt.WaveletPacketND(dat... | -np.ones((4, 4))) | assert_* | func_call | pywt/tests/test_wpnd.py | test_traversing_tree_nd | 26 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_allclose, assert_equal, assert_raises
import pywt
def test_available_modes():
modes = ['zero', 'constant', 'symmetric', 'periodic', 'smooth',
'periodization', 'reflect', 'antisymmetric', 'antireflect']
assert_equal(pywt.Modes.modes, modes)
... | 2) | assert_* | numeric_literal | pywt/tests/test_modes.py | test_available_modes | 13 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_allclose, assert_equal, assert_raises
import pywt
def test_available_modes():
modes = ['zero', 'constant', 'symmetric', 'periodic', 'smooth',
'periodization', 'reflect', 'antisymmetric', 'antireflect']
assert_equal(pywt.Modes.modes, | modes) | assert_* | variable | pywt/tests/test_modes.py | test_available_modes | 12 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose
import pywt
def check_coefficients_orthogonal(wavelet):
epsilon = 5e-11
level = 5
w = pywt.Wavelet(wavelet)
phi, psi, x = w.wavefun(level=level)
# Lowpass filter coefficients sum to sqrt2
res = np.... | wavelet.name | assert | complex_expr | pywt/tests/test_wavelet.py | test_wavelet_pickle | 278 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose
import pywt
def check_coefficients_orthogonal(wavelet):
epsilon = 5e-11
level = 5
w = pywt.Wavelet(wavelet)
phi, psi, x = w.wavefun(level=level)
# Lowpass filter coefficients sum to sqrt2
res = np.... | psi_r_expect) | assert_* | variable | pywt/tests/test_wavelet.py | test_wavefun_bior13 | 267 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_allclose, assert_equal, assert_raises
import pywt
def test_default_mode():
# The default mode should be 'symmetric'
x = [1, 2, 1, 5, -1, 8, 4, 6]
cA, cD = pywt.dwt(x, 'db2')
cA2, cD2 = pywt.dwt(x, 'db2', mode='symmetric')
assert_allclose(cA, cA2)... | cD2) | assert_* | variable | pywt/tests/test_modes.py | test_default_mode | 107 | null | |
PyWavelets/pywt | import operator
from functools import reduce
from itertools import product
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_data_reconstruction_delete_nodes_nd():
x = np.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8, dtype=np.float64)
wp = pywt.Wa... | x) | assert_* | variable | pywt/tests/test_wpnd.py | test_data_reconstruction_delete_nodes_nd | 112 | null | |
PyWavelets/pywt | from itertools import combinations
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
dtypes_in = [np.int8, np.float16, np.float32, np.float64, np.complex64,
np.complex128]
dtypes_out = [np.float64, np.float32, np.float32, np.float64, np.comple... | data) | assert_* | variable | pywt/tests/test_multidim.py | test_idwtn_axes | 275 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_reconstructing_data():
x = [1, 2, 3, 4, 5, 6, 7, 8]
wp = pywt.WaveletPacket(data=x, wavelet='db1', mode='symmetric')
# Create another Wavelet Packet and feed it... | np.arange(1, 9)) | assert_* | func_call | pywt/tests/test_wp.py | test_reconstructing_data | 110 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_allclose, assert_equal, assert_raises
import pywt
def test_default_mode():
# The default mode should be 'symmetric'
x = [1, 2, 1, 5, -1, 8, 4, 6]
cA, cD = pywt.dwt(x, 'db2')
cA2, cD2 = pywt.dwt(x, 'db2', mode='symmetric')
assert_allclose(cA, cA2)... | x) | assert_* | variable | pywt/tests/test_modes.py | test_default_mode | 108 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
float_dtypes = [np.float32, np.float64, np.complex64, np.complex128]
real_dtypes = [np.float32, np.float64]
def _sign(x):
# Matlab-like sign function (numpy uses a different convention).
return x / ... | 'foo') | assert_* | string_literal | pywt/tests/test_thresholding.py | test_threshold | 100 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_array_equal, assert_raises
import pywt
dtypes_in = [np.int8, np.float16, np.float32, np.float64, np.complex64,
np.complex128]
dtypes_out = [np.float64, np.float32, np.float32, np.float64, np.complex64,
np.complex1... | x0) | assert_* | variable | pywt/tests/test_dwt_idwt.py | test_idwt_single_axis | 179 | null | |
PyWavelets/pywt | import operator
from functools import reduce
from itertools import product
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_data_reconstruction_delete_nodes_nd():
x = np.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8, dtype=np.float64)
wp = pywt.Wa... | lambda: new_wp['ad'+'aa']) | assert_* | complex_expr | pywt/tests/test_wpnd.py | test_data_reconstruction_delete_nodes_nd | 116 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_raises
import pywt
def test_dwt_max_level():
assert_(pywt.dwt_max_level(16, 2) == 4)
assert_(pywt.dwt_max_level(16, 8) == 1)
assert_(pywt.dwt_max_level(16, 9) == 1)
assert_(pywt.dwt_max_level(16, 10) == 0)
assert_(pywt.d... | 'mexh') | assert_* | string_literal | pywt/tests/test__pywt.py | test_dwt_max_level | 127 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_traversing_tree_2d():
x = np.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8, dtype=np.float64)
wp = pywt.WaveletPacket2D(data=x, wavelet='db1', mode='symmetric')
assert_(... | np.zeros((4, 4))) | assert_* | func_call | pywt/tests/test_wp2d.py | test_traversing_tree_2d | 23 | null | |
PyWavelets/pywt | import warnings
from itertools import combinations
import numpy as np
import pytest
from numpy.testing import (
assert_,
assert_allclose,
assert_almost_equal,
assert_array_equal,
assert_equal,
assert_raises,
assert_raises_regex,
)
import pywt
dtypes_in = [np.int8, np.float16, np.float32, ... | r) | assert_* | variable | pywt/tests/test_multilevel.py | test_waverec_all_wavelets_modes | 158 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_raises
import pywt
def test_wavelist():
for name in pywt.wavelist(family='coif'):
assert_(name.startswith('coif'))
assert_('cgau7' in pywt.wavelist(kind='continuous'))
assert_('sym20' in pywt.wavelist(kind='discrete'))
... | pywt.wavelist) | assert_* | complex_expr | pywt/tests/test__pywt.py | test_wavelist | 158 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose
import pywt
def test_wavelet_properties():
w = pywt.Wavelet('db3')
# Name
assert_(w.name == 'db3')
assert_(w.short_family_name == 'db')
assert_(w.family_name, 'Daubechies')
# String representation
... | dec_lo) | assert_* | variable | pywt/tests/test_wavelet.py | test_wavelet_properties | 34 | null | |
PyWavelets/pywt | import warnings
from itertools import combinations
import numpy as np
import pytest
from numpy.testing import (
assert_,
assert_allclose,
assert_almost_equal,
assert_array_equal,
assert_equal,
assert_raises,
assert_raises_regex,
)
import pywt
dtypes_in = [np.int8, np.float16, np.float32, ... | []) | assert_* | collection | pywt/tests/test_multilevel.py | test_coeffs_to_array | 417 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_raises
import pywt
def test_compare_downcoef_coeffs():
rstate = np.random.RandomState(1234)
r = rstate.randn(16)
# compare downcoef against wavedec outputs
for nlevels in [1, 2, 3]:
for wavelet in pywt.wavelist():
... | coeffs[0]) | assert_* | complex_expr | pywt/tests/test__pywt.py | test_compare_downcoef_coeffs | 64 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_array_equal, assert_raises
import pywt
dtypes_in = [np.int8, np.float16, np.float32, np.float64, np.complex64,
np.complex128]
dtypes_out = [np.float64, np.float32, np.float32, np.float64, np.complex64,
np.complex1... | x1) | assert_* | variable | pywt/tests/test_dwt_idwt.py | test_idwt_single_axis | 180 | null | |
PyWavelets/pywt | import os
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_raises
import pywt.data
data_dir = os.path.join(os.path.dirname(__file__), 'data')
wavelab_data_file = os.path.join(data_dir, 'wavelab_test_signals.npz')
wavelab_result_dict = np.load(wavelab_data_file)
def test_wavelab_signals(... | val.size) | assert_* | complex_expr | pywt/tests/test_data.py | test_wavelab_signals | 67 | null | |
PyWavelets/pywt | import warnings
from functools import partial
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
import pywt
from pywt._pytest import futures, max_workers, uses_futures
def _assert_all_coeffs_equal(coefs1, coefs2):
# return True only if all coefficients of SWT or DWT m... | a2) | assert_* | variable | pywt/tests/test_concurrent.py | test_concurrent_cwt | 106 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_collecting_nodes_2d():
x = np.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8, dtype=np.float64)
wp = pywt.WaveletPacket2D(data=x, wavelet='db1', mode='symmetric')
assert_... | 'invalid_order') | assert_* | string_literal | pywt/tests/test_wp2d.py | test_collecting_nodes_2d | 106 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
float_dtypes = [np.float32, np.float64, np.complex64, np.complex128]
real_dtypes = [np.float32, np.float64]
def _sign(x):
# Matlab-like sign function (numpy uses a different convention).
return x / ... | data.dtype) | assert_* | complex_expr | pywt/tests/test_thresholding.py | test_nonnegative_garotte | 116 | null | |
PyWavelets/pywt | import warnings
from itertools import combinations
import numpy as np
import pytest
from numpy.testing import (
assert_,
assert_allclose,
assert_almost_equal,
assert_array_equal,
assert_equal,
assert_raises,
assert_raises_regex,
)
import pywt
dtypes_in = [np.int8, np.float16, np.float32, ... | x1r) | assert_* | variable | pywt/tests/test_multilevel.py | test_ravel_wavedec2_with_lists | 630 | null | |
PyWavelets/pywt | from itertools import combinations
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
dtypes_in = [np.int8, np.float16, np.float32, np.float64, np.complex64,
np.complex128]
dtypes_out = [np.float64, np.float32, np.float32, np.float64, np.comple... | x) | assert_* | variable | pywt/tests/test_multidim.py | test_idwtn_mixed_complex_dtype | 373 | null | |
PyWavelets/pywt | import warnings
from copy import deepcopy
from itertools import combinations, permutations
import numpy as np
import pytest
from numpy.testing import (
assert_,
assert_allclose,
assert_array_equal,
assert_equal,
)
import pywt
from pywt._extensions._swt import swt_axis
dtypes_in = [np.int8, np.float16... | 2) | assert_* | numeric_literal | pywt/tests/test_swt.py | test_swt_max_level | 79 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_allclose, assert_equal, assert_raises
import pywt
def test_dwt_short_input_allmodes():
# some test cases where the input is shorter than the DWT filter
x = [1, 3, 2]
wavelet = 'db2'
# manually pad each end by the filter size (4 for 'db2' used here)
... | expected_result[1]) | assert_* | complex_expr | pywt/tests/test_modes.py | test_dwt_short_input_allmodes | 98 | null | |
PyWavelets/pywt | from numpy.testing import assert_allclose, assert_almost_equal
import pywt
def test_intwave_orthogonal():
w = pywt.Wavelet('db1')
int_psi, x = pywt.integrate_wavelet(w, precision=12)
ix = x < 0.5
# For x < 0.5, the integral is equal to x
assert_allclose(int_psi[ix], | x[ix]) | assert_* | complex_expr | pywt/tests/test_functions.py | test_intwave_orthogonal | 41 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_raises
import pywt
def test_downcoef_errs():
# invalid part string (not 'a' or 'd')
assert_raises(ValueError, pywt.downcoef, 'f', np.ones(16), | 'haar') | assert_* | string_literal | pywt/tests/test__pywt.py | test_downcoef_errs | 45 | null | |
PyWavelets/pywt | from itertools import combinations
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
dtypes_in = [np.int8, np.float16, np.float32, np.float64, np.complex64,
np.complex128]
dtypes_out = [np.float64, np.float32, np.float32, np.float64, np.comple... | rec2) | assert_* | variable | pywt/tests/test_multidim.py | test_negative_axes | 349 | null | |
PyWavelets/pywt | import operator
from functools import reduce
from itertools import product
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_traversing_tree_nd():
x = np.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8, dtype=np.float64)
wp = pywt.WaveletPacketND(dat... | lambda: wp['f']) | assert_* | complex_expr | pywt/tests/test_wpnd.py | test_traversing_tree_nd | 38 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_db3_roundtrip():
original = np.arange(512)
wp = pywt.WaveletPacket(data=original, wavelet='db3', mode='smooth',
maxlevel=3)
r = wp.re... | r) | assert_* | variable | pywt/tests/test_wp.py | test_db3_roundtrip | 206 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
float_dtypes = [np.float32, np.float64, np.complex64, np.complex128]
real_dtypes = [np.float32, np.float64]
def _sign(x):
# Matlab-like sign function (numpy uses a different convention).
return x / ... | [[0, 0]] * 2) | assert_* | collection | pywt/tests/test_thresholding.py | test_threshold | 36 | null | |
PyWavelets/pywt | import warnings
from copy import deepcopy
from itertools import combinations, permutations
import numpy as np
import pytest
from numpy.testing import (
assert_,
assert_allclose,
assert_array_equal,
assert_equal,
)
import pywt
from pywt._extensions._swt import swt_axis
dtypes_in = [np.int8, np.float16... | r2) | assert_* | variable | pywt/tests/test_swt.py | test_swt2_axes | 298 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_traversing_tree_2d():
x = np.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8, dtype=np.float64)
wp = pywt.WaveletPacket2D(data=x, wavelet='db1', mode='symmetric')
assert_(... | np.array([[36.]])) | assert_* | func_call | pywt/tests/test_wp2d.py | test_traversing_tree_2d | 30 | null | |
PyWavelets/pywt | import os
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_raises
import pywt.data
data_dir = os.path.join(os.path.dirname(__file__), 'data')
wavelab_data_file = os.path.join(data_dir, 'wavelab_test_signals.npz')
wavelab_result_dict = np.load(wavelab_data_file)
def test_wavelab_signals(... | pywt.data.demo_signal(signal)) | assert_* | func_call | pywt/tests/test_data.py | test_wavelab_signals | 65 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose
import pywt
def check_coefficients_orthogonal(wavelet):
epsilon = 5e-11
level = 5
w = pywt.Wavelet(wavelet)
phi, psi, x = w.wavefun(level=level)
# Lowpass filter coefficients sum to sqrt2
res = np.... | psi_expect) | assert_* | variable | pywt/tests/test_wavelet.py | test_wavefun_sym3 | 228 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_acess_path():
x = [1, 2, 3, 4, 5, 6, 7, 8]
wp = pywt.WaveletPacket(data=x, wavelet='db1', mode='symmetric')
assert_(wp['a'].path == 'a')
assert_(wp['aa'].pa... | lambda: wp['ac'].path) | assert_* | complex_expr | pywt/tests/test_wp.py | test_acess_path | 52 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_raises
import pywt
def test_upcoef_reconstruct():
data = np.arange(3)
a = pywt.downcoef('a', data, 'haar')
d = pywt.downcoef('d', data, 'haar')
rec = (pywt.upcoef('a', a, 'haar', take=3) +
pywt.upcoef('d', d, 'ha... | data) | assert_* | variable | pywt/tests/test__pywt.py | test_upcoef_reconstruct | 17 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_wavelet_packet_dtypes():
rstate = np.random.RandomState(0)
N = 32
for dtype in [np.float32, np.float64, np.complex64, np.complex128]:
x = rstate.randn(N)... | transform_dtype) | assert_* | variable | pywt/tests/test_wp.py | test_wavelet_packet_dtypes | 197 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_raises
import pywt
def test_dwt_max_level():
assert_(pywt.dwt_max_level(16, 2) == 4)
assert_(pywt.dwt_max_level(16, 8) == 1)
assert_(pywt.dwt_max_level(16, 9) == 1)
assert_(pywt.dwt_max_level(16, 10) == 0)
assert_(pywt.d... | 1) | assert_* | numeric_literal | pywt/tests/test__pywt.py | test_dwt_max_level | 130 | null | |
PyWavelets/pywt | import operator
from functools import reduce
from itertools import product
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_traversing_tree_nd():
x = np.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8, dtype=np.float64)
wp = pywt.WaveletPacketND(dat... | np.zeros((4, 4))) | assert_* | func_call | pywt/tests/test_wpnd.py | test_traversing_tree_nd | 25 | null | |
PyWavelets/pywt | import numpy as np
import pytest
from numpy.testing import assert_allclose
import pywt
from pywt import data
from pywt._utils import AxisError
tol_single = 1e-6
tol_double = 1e-13
atol = 1e-7
@pytest.mark.parametrize('wavelet', ['db2', 'sym4', 'coif5'])
@pytest.mark.parametrize('transform', ['dwt', 'swt'])
@pytest.m... | ValueError) | pytest.raises | variable | pywt/tests/test_mra.py | test_mra_roundtrip | 36 | null | |
PyWavelets/pywt | import operator
from functools import reduce
from itertools import product
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_traversing_tree_nd():
x = np.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8, dtype=np.float64)
wp = pywt.WaveletPacketND(dat... | 5) | assert_* | numeric_literal | pywt/tests/test_wpnd.py | test_traversing_tree_nd | 42 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_raises
import pywt
def test_compare_downcoef_coeffs():
rstate = np.random.RandomState(1234)
r = rstate.randn(16)
# compare downcoef against wavedec outputs
for nlevels in [1, 2, 3]:
for wavelet in pywt.wavelist():
... | coeffs[1]) | assert_* | complex_expr | pywt/tests/test__pywt.py | test_compare_downcoef_coeffs | 65 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_allclose, assert_equal, assert_raises
import pywt
def test_default_mode():
# The default mode should be 'symmetric'
x = [1, 2, 1, 5, -1, 8, 4, 6]
cA, cD = pywt.dwt(x, 'db2')
cA2, cD2 = pywt.dwt(x, 'db2', mode='symmetric')
assert_allclose(cA, | cA2) | assert_* | variable | pywt/tests/test_modes.py | test_default_mode | 106 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_array_equal, assert_raises
import pywt
dtypes_in = [np.int8, np.float16, np.float32, np.float64, np.complex64,
np.complex128]
dtypes_out = [np.float64, np.float32, np.float32, np.float64, np.complex64,
np.complex1... | cD1) | assert_* | variable | pywt/tests/test_dwt_idwt.py | test_dwt_single_axis | 165 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_accessing_node_attributes_2d():
x = np.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8, dtype=np.float64)
wp = pywt.WaveletPacket2D(data=x, wavelet='db1', mode='symmetric')
... | np.zeros((2, 2)) - 4) | assert_* | func_call | pywt/tests/test_wp2d.py | test_accessing_node_attributes_2d | 40 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_allclose, assert_equal, assert_raises
import pywt
def test_dwt_idwt_allmodes():
# Test that :func:`dwt` and :func:`idwt` can be performed using every mode
x = [1, 2, 1, 5, -1, 8, 4, 6]
dwt_results = {
'zero': ([-0.03467518, 1.73309178, 3.40612438... | dwt_results[mode][0]) | assert_* | complex_expr | pywt/tests/test_modes.py | test_dwt_idwt_allmodes | 69 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_raises
import pywt
def test_downcoef_multilevel():
rstate = np.random.RandomState(1234)
r = rstate.randn(16)
nlevels = 3
# calling with level=1 nlevels times
a1 = r.copy()
for i in range(nlevels):
a1 = pywt.d... | a3) | assert_* | variable | pywt/tests/test__pywt.py | test_downcoef_multilevel | 30 | null | |
PyWavelets/pywt | from itertools import combinations
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
dtypes_in = [np.int8, np.float16, np.float32, np.float64, np.complex64,
np.complex128]
dtypes_out = [np.float64, np.float32, np.float32, np.float64, np.comple... | data2) | assert_* | variable | pywt/tests/test_multidim.py | test_per_axis_wavelets_and_modes | 431 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose
import pywt
def check_coefficients_orthogonal(wavelet):
epsilon = 5e-11
level = 5
w = pywt.Wavelet(wavelet)
phi, psi, x = w.wavefun(level=level)
# Lowpass filter coefficients sum to sqrt2
res = np.... | phi_expect) | assert_* | variable | pywt/tests/test_wavelet.py | test_wavefun_sym3 | 227 | null | |
PyWavelets/pywt | import warnings
from copy import deepcopy
from itertools import combinations, permutations
import numpy as np
import pytest
from numpy.testing import (
assert_,
assert_allclose,
assert_array_equal,
assert_equal,
)
import pywt
from pywt._extensions._swt import swt_axis
dtypes_in = [np.int8, np.float16... | x) | assert_* | variable | pywt/tests/test_swt.py | test_iswt_mixed_dtypes | 506 | null | |
PyWavelets/pywt | import os
import pickle
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pywt
def test_wavelet_packet_axis():
rstate = np.random.RandomState(0)
shape = (32, 16)
x = rstate.standard_normal(shape)
for axis in [0, 1, -1]:
wp = pywt.Wavelet... | x.dtype) | assert_* | complex_expr | pywt/tests/test_wp.py | test_wavelet_packet_axis | 228 | null | |
PyWavelets/pywt | import warnings
from itertools import combinations
import numpy as np
import pytest
from numpy.testing import (
assert_,
assert_allclose,
assert_almost_equal,
assert_array_equal,
assert_equal,
assert_raises,
assert_raises_regex,
)
import pywt
dtypes_in = [np.int8, np.float16, np.float32, ... | x) | assert_* | variable | pywt/tests/test_multilevel.py | test_waverec_odd_length | 126 | null | |
PyWavelets/pywt | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_array_equal, assert_raises
import pywt
dtypes_in = [np.int8, np.float16, np.float32, np.float64, np.complex64,
np.complex128]
dtypes_out = [np.float64, np.float32, np.float32, np.float64, np.complex64,
np.complex1... | cA) | assert_* | variable | pywt/tests/test_dwt_idwt.py | test_dwt_axis_arg | 195 | null | |
PyWavelets/pywt | import os
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_raises
import pywt.data
data_dir = os.path.join(os.path.dirname(__file__), 'data')
wavelab_data_file = os.path.join(data_dir, 'wavelab_test_signals.npz')
wavelab_result_dict = np.load(wavelab_data_file)
def test_wavelab_signals(... | 0) | assert_* | numeric_literal | pywt/tests/test_data.py | test_wavelab_signals | 78 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.