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
asteroid-team/asteroid
import torch import pytest import numpy as np from asteroid.dsp.spatial import xcorr @pytest.mark.parametrize("seq_len_input", [1390]) @pytest.mark.parametrize("seq_len_ref", [1390, 1290]) @pytest.mark.parametrize("batch_size", [1, 2]) @pytest.mark.parametrize("n_mics_input", [1]) @pytest.mark.parametrize("n_mics_ref"...
(seq_len_input - seq_len_ref) + 1
assert
collection
tests/dsp/spatial_test.py
test_xcorr
17
null
asteroid-team/asteroid
import itertools import argparse from collections.abc import MutableMapping import torch from torch.testing import assert_close import pytest import numpy as np from asteroid import utils from asteroid.utils import prepare_parser_from_dict, parse_args_as_dict def parser(): # Create dictionary as from .yml file ...
tensors)
assert_*
variable
tests/utils/utils_test.py
test_transfer
67
null
asteroid-team/asteroid
import torch import pytest from asteroid.dsp.deltas import concat_deltas, compute_delta @pytest.mark.parametrize("dim", [1, 2, -1, -2]) @pytest.mark.parametrize("order", [1, 2]) def test_concat_deltas(dim, order): phase_shape = [2, 257, 100] phase = torch.randn(*phase_shape) cat_deltas = concat_deltas(pha...
list(cat_deltas.shape)
assert
func_call
tests/dsp/deltas_tests.py
test_concat_deltas
22
null
asteroid-team/asteroid
import pytest import torch from torch.testing import assert_close import warnings from asteroid_filterbanks import STFTFB, Encoder, transforms from asteroid.losses import PITLossWrapper from asteroid.losses import sdr, mse from asteroid.losses import deep_clustering_loss, SingleSrcPMSQE from asteroid.losses import Sin...
wo_src_wrapper(est_targets, targets, return_est=True)[1])
assert_*
func_call
tests/losses/loss_functions_test.py
test_sisdr_and_mse
75
null
asteroid-team/asteroid
import torch import pytest from torch import nn from asteroid import torch_utils def test_pad_fail(): x = torch.randn(10, 16000, 1) y = torch.randn(10, 16234, 1) with pytest.raises(
NotImplementedError)
pytest.raises
variable
tests/utils/torch_utils_test.py
test_pad_fail
17
null
asteroid-team/asteroid
import torch from torch.testing import assert_close import pytest import math from asteroid import complex_nn as cnn from asteroid.utils.deprecation_utils import VisibleDeprecationWarning from asteroid_filterbanks import transforms def test_complex_mul_wrapper(): a = torch.randn(10, 10, dtype=torch.complex64) ...
cnn.torch_complex_from_reim( torch.relu(a.real) - torch.relu(a.imag), torch.relu(a.real) + torch.relu(a.imag) ))
assert_*
func_call
tests/complex_nn_test.py
test_complex_mul_wrapper
60
null
asteroid-team/asteroid
import pytest import itertools import torch from torch import nn, optim from torch.utils import data from torch.testing import assert_close import pytorch_lightning as pl from pytorch_lightning import Trainer from asteroid.losses import PITLossWrapper from asteroid.losses import sdr from asteroid.losses import single...
self.epoch
assert
complex_expr
tests/losses/sinkpit_wrapper_test.py
on_train_epoch_end
_TestCallback
109
null
asteroid-team/asteroid
import pytest import torch from torch.testing import assert_close from asteroid.masknn import activations from torch import nn def activation_mapping(): mapping_list = [ (nn.Identity, "linear"), (nn.ReLU, "relu"), (nn.PReLU, "prelu"), (nn.LeakyReLU, "leaky_relu"), (nn.Sigmo...
Custom
assert
variable
tests/masknn/activations_test.py
test_register
59
null
asteroid-team/asteroid
from unittest import mock import numpy as np import pytest from asteroid.metrics import get_metrics, MetricTracker def test_metric_tracker(): metric_tracker = MetricTracker(sample_rate=8000, metrics_list=["si_sdr", "stoi"]) for i in range(5): mix = np.random.randn(1, 4000) clean = np.random.ran...
metric_tracker.as_df()
assert
func_call
tests/metrics_test.py
test_metric_tracker
87
null
asteroid-team/asteroid
import pytest import itertools import torch from torch.testing import assert_close from asteroid.losses import PITLossWrapper, pairwise_mse def bad_loss_func_ndim0(y_pred, y_true): return torch.randn(1).mean() def bad_loss_func_ndim1(y_pred, y_true): return torch.randn(1) def good_batch_loss_func(y_pred, y_...
w_mean)
assert_*
variable
tests/losses/pit_wrapper_test.py
test_permreduce
98
null
asteroid-team/asteroid
import os import json import shutil import pytest from asteroid.models import save_publishable, upload_publishable, ConvTasNet from asteroid.data.wham_dataset import WhamDataset def populate_wham_dir(path): wham_files = ["s1", "s2", "noise", "mix_single", "mix_clean", "mix_both"] os.makedirs(path, exist_ok=Tr...
"INRIA"
assert
string_literal
tests/models/publish_test.py
test_upload
51
null
asteroid-team/asteroid
import torch from torch.testing import assert_close import pytest import math from asteroid import complex_nn as cnn from asteroid.utils.deprecation_utils import VisibleDeprecationWarning from asteroid_filterbanks import transforms def test_torch_complex_from_reim(): comp = torch.randn(10, 12, dtype=torch.complex...
comp)
assert_*
variable
tests/complex_nn_test.py
test_torch_complex_from_reim
26
null
asteroid-team/asteroid
import pytest import torch from asteroid.losses import MixITLossWrapper from asteroid.losses import pairwise_neg_sisdr, multisrc_neg_sisdr def good_batch_loss_func(y_pred, y_true): batch, *_ = y_true.shape return torch.randn(batch) @pytest.mark.parametrize("batch_size", [1, 2, 8]) @pytest.mark.parametrize("n...
est_targets.shape
assert
complex_expr
tests/losses/mixit_wrapper_test.py
test_mixitwrapper_as_pit_wrapper
24
null
asteroid-team/asteroid
import pytest import itertools import torch from torch.testing import assert_close from asteroid.losses import PITLossWrapper, pairwise_mse def bad_loss_func_ndim0(y_pred, y_true): return torch.randn(1).mean() def bad_loss_func_ndim1(y_pred, y_true): return torch.randn(1) def good_batch_loss_func(y_pred, y_...
AssertionError)
pytest.raises
variable
tests/losses/pit_wrapper_test.py
test_wrapper
35
null
asteroid-team/asteroid
import pytest import torch from torch.testing import assert_close import warnings from asteroid_filterbanks import STFTFB, Encoder, transforms from asteroid.losses import PITLossWrapper from asteroid.losses import sdr, mse from asteroid.losses import deep_clustering_loss, SingleSrcPMSQE from asteroid.losses import Sin...
ref.shape[0]
assert
complex_expr
tests/losses/loss_functions_test.py
test_pmsqe
151
null
asteroid-team/asteroid
import torch from torch.testing import assert_close import pytest import math from asteroid import complex_nn as cnn from asteroid.utils.deprecation_utils import VisibleDeprecationWarning from asteroid_filterbanks import transforms def test_bound_complex_mask_raises(): with pytest.raises(
ValueError)
pytest.raises
variable
tests/complex_nn_test.py
test_bound_complex_mask_raises
74
null
asteroid-team/asteroid
import pytest import torch from torch.testing import assert_close from asteroid.masknn import activations from torch import nn def activation_mapping(): mapping_list = [ (nn.Identity, "linear"), (nn.ReLU, "relu"), (nn.PReLU, "prelu"), (nn.LeakyReLU, "leaky_relu"), (nn.Sigmo...
asteroid_act(inp))
assert_*
func_call
tests/masknn/activations_test.py
test_activations
30
null
asteroid-team/asteroid
import torch import pytest from torch.testing import assert_close import numpy as np import soundfile as sf import asteroid from asteroid import models from asteroid_filterbanks import make_enc_dec from asteroid.dsp import LambdaOverlapAdd from asteroid.models.fasnet import FasNetTAC from asteroid.separate import separ...
Custom
assert
variable
tests/models/models_test.py
test_register
292
null
asteroid-team/asteroid
import itertools import argparse from collections.abc import MutableMapping import torch from torch.testing import assert_close import pytest import numpy as np from asteroid import utils from asteroid.utils import prepare_parser_from_dict, parse_args_as_dict def parser(): # Create dictionary as from .yml file ...
True
assert
bool_literal
tests/utils/utils_test.py
test_boolean
44
null
asteroid-team/asteroid
import pytest import itertools import torch from torch import nn, optim from torch.utils import data from torch.testing import assert_close import pytorch_lightning as pl from pytorch_lightning import Trainer from asteroid.losses import PITLossWrapper from asteroid.losses import sdr from asteroid.losses import single...
self.f(epoch)
assert
func_call
tests/losses/sinkpit_wrapper_test.py
on_train_epoch_end
_TestCallback
110
null
asteroid-team/asteroid
import itertools import argparse from collections.abc import MutableMapping import torch from torch.testing import assert_close import pytest import numpy as np from asteroid import utils from asteroid.utils import prepare_parser_from_dict, parse_args_as_dict def parser(): # Create dictionary as from .yml file ...
dict(tensors)
assert
func_call
tests/utils/utils_test.py
test_transfer
71
null
asteroid-team/asteroid
from unittest import mock import numpy as np import pytest from asteroid.metrics import get_metrics, MetricTracker @pytest.mark.parametrize("fs", [8000, 16000]) def test_get_metrics(fs): mix = np.random.randn(1, 16000) clean = np.random.randn(2, 16000) est = np.random.randn(2, 16000) metrics_dict = get...
metrics_dict["si_sdr"]
assert
complex_expr
tests/metrics_test.py
test_get_metrics
17
null
asteroid-team/asteroid
from unittest import mock import numpy as np import pytest from asteroid.metrics import get_metrics, MetricTracker @pytest.mark.parametrize("average", [True, False]) @pytest.mark.parametrize("filename", [None, "example.wav"]) def test_ignore_errors(filename, average): mix = np.random.randn(1, 4000) clean = np....
None
assert
none_literal
tests/metrics_test.py
test_ignore_errors
70
null
asteroid-team/asteroid
import numpy as np from asteroid.dsp.normalization import normalize_estimates def test_normalization(): mix = (np.random.rand(1600) - 0.5) * 2 # random [-1,1[ est = (np.random.rand(2, 1600) - 0.5) * 10 est_normalized = normalize_estimates(est, mix) assert np.max(est_normalized) <
1
assert
numeric_literal
tests/dsp/normalization_test.py
test_normalization
11
null
asteroid-team/asteroid
import torch from torch.testing import assert_close import pytest import math from asteroid import complex_nn as cnn from asteroid.utils.deprecation_utils import VisibleDeprecationWarning from asteroid_filterbanks import transforms def test_torch_complex_from_magphase(): shape = (1, 257, 100) mag = torch.rand...
mag)
assert_*
variable
tests/complex_nn_test.py
test_torch_complex_from_magphase
20
null
asteroid-team/asteroid
import torch import pytest from torch.testing import assert_close import numpy as np import soundfile as sf import asteroid from asteroid import models from asteroid_filterbanks import make_enc_dec from asteroid.dsp import LambdaOverlapAdd from asteroid.models.fasnet import FasNetTAC from asteroid.separate import separ...
model.sample_rate
assert
complex_expr
tests/models/models_test.py
_default_test_model
267
null
asteroid-team/asteroid
import pytest import torch from torch.testing import assert_close from asteroid.masknn import activations from torch import nn def activation_mapping(): mapping_list = [ (nn.Identity, "linear"), (nn.ReLU, "relu"), (nn.PReLU, "prelu"), (nn.LeakyReLU, "leaky_relu"), (nn.Sigmo...
asteroid_softmax(inp))
assert_*
func_call
tests/masknn/activations_test.py
test_softmax
37
null
asteroid-team/asteroid
from asteroid.scripts import asteroid_versions, asteroid_cli def test_asteroid_versions(): versions = asteroid_versions.asteroid_versions() assert "Asteroid" in
versions
assert
variable
tests/cli_test.py
test_asteroid_versions
6
null
asteroid-team/asteroid
import itertools import argparse from collections.abc import MutableMapping import torch from torch.testing import assert_close import pytest import numpy as np from asteroid import utils from asteroid.utils import prepare_parser_from_dict, parse_args_as_dict def parser(): # Create dictionary as from .yml file ...
( (1 * d, c, "ks3", "st3", "pad3"), (1 * c, b, "ks2", "st2", "pad2"), (1 * b, a, "ks1", "st1", "pad1"), )
assert
collection
tests/utils/utils_test.py
test_unet_decoder_args
113
null
asteroid-team/asteroid
import pytest import itertools import torch from torch.testing import assert_close from asteroid.losses import PITLossWrapper, pairwise_mse def bad_loss_func_ndim0(y_pred, y_true): return torch.randn(1).mean() def bad_loss_func_ndim1(y_pred, y_true): return torch.randn(1) def good_batch_loss_func(y_pred, y_...
est_targets.shape
assert
complex_expr
tests/losses/pit_wrapper_test.py
test_wrapper
41
null
asteroid-team/asteroid
import itertools import argparse from collections.abc import MutableMapping import torch from torch.testing import assert_close import pytest import numpy as np from asteroid import utils from asteroid.utils import prepare_parser_from_dict, parse_args_as_dict def parser(): # Create dictionary as from .yml file ...
( (1 * d, c, "ks3", "st3", "pad3"), (2 * c, b, "ks2", "st2", "pad2"), (2 * b, a, "ks1", "st1", "pad1"), )
assert
collection
tests/utils/utils_test.py
test_unet_decoder_args
118
null
asteroid-team/asteroid
import pytest from torch import nn, optim from asteroid.engine import optimizers from torch_optimizer import Ranger def optim_mapping(): mapping_list = [ (optim.Adam, "adam"), (optim.SGD, "sgd"), (optim.RMSprop, "rmsprop"), (Ranger, "ranger"), ] return mapping_list @pytest....
asteroid_optim
assert
variable
tests/engine/optimizers_test.py
test_get_instance_returns_instance
64
null
asteroid-team/asteroid
import os import json import shutil import pytest from asteroid.models import save_publishable, upload_publishable, ConvTasNet from asteroid.data.wham_dataset import WhamDataset def populate_wham_dir(path): wham_files = ["s1", "s2", "noise", "mix_single", "mix_clean", "mix_both"] os.makedirs(path, exist_ok=Tr...
"Manuel Pariente"
assert
string_literal
tests/models/publish_test.py
test_upload
50
null
asteroid-team/asteroid
import torch import pytest from torch.testing import assert_close import numpy as np import soundfile as sf import asteroid from asteroid import models from asteroid_filterbanks import make_enc_dec from asteroid.dsp import LambdaOverlapAdd from asteroid.models.fasnet import FasNetTAC from asteroid.separate import separ...
model
assert
variable
tests/models/models_test.py
test_get
275
null
asteroid-team/asteroid
import torch from torch.testing import assert_close import pytest from asteroid.dsp.overlap_add import LambdaOverlapAdd @pytest.mark.parametrize("length", [1390, 8372]) @pytest.mark.parametrize("batch_size", [1, 2]) @pytest.mark.parametrize("n_src", [1, 2]) @pytest.mark.parametrize("window", ["hann", None]) @pytest.m...
oladded)
assert_*
variable
tests/dsp/overlap_add_test.py
test_overlap_add
19
null
asteroid-team/asteroid
import pytest import itertools import torch from torch.testing import assert_close from asteroid.losses import PITLossWrapper, pairwise_mse def bad_loss_func_ndim0(y_pred, y_true): return torch.randn(1).mean() def bad_loss_func_ndim1(y_pred, y_true): return torch.randn(1) def good_batch_loss_func(y_pred, y_...
0
assert
numeric_literal
tests/losses/pit_wrapper_test.py
test_permutation
73
null
asteroid-team/asteroid
import pytest import torch from torch.testing import assert_close import warnings from asteroid_filterbanks import STFTFB, Encoder, transforms from asteroid.losses import PITLossWrapper from asteroid.losses import sdr, mse from asteroid.losses import deep_clustering_loss, SingleSrcPMSQE from asteroid.losses import Sin...
wo_src_wrapper(est_targets, targets))
assert_*
func_call
tests/losses/loss_functions_test.py
test_sisdr_and_mse
71
null
asteroid-team/asteroid
from typing import Tuple import torch import pytest from torch.testing import assert_close from asteroid.models import ( DCCRNet, DCUNet, DeMask, ConvTasNet, DPRNNTasNet, DPTNet, LSTMTasNet, SuDORMRFNet, SuDORMRFImprovedNet, ) @torch.no_grad() def assert_consistency(model, traced, ...
out)
assert_*
variable
tests/jit/jit_models_test.py
assert_consistency
23
null
asteroid-team/asteroid
import itertools import argparse from collections.abc import MutableMapping import torch from torch.testing import assert_close import pytest import numpy as np from asteroid import utils from asteroid.utils import prepare_parser_from_dict, parse_args_as_dict def parser(): # Create dictionary as from .yml file ...
False
assert
bool_literal
tests/utils/utils_test.py
test_boolean
48
null
asteroid-team/asteroid
import pytest import itertools import torch from torch.testing import assert_close from asteroid.losses import PITLossWrapper, pairwise_mse def bad_loss_func_ndim0(y_pred, y_true): return torch.randn(1).mean() def bad_loss_func_ndim1(y_pred, y_true): return torch.randn(1) def good_batch_loss_func(y_pred, y_...
reordered)
assert_*
variable
tests/losses/pit_wrapper_test.py
test_permutation
74
null
asteroid-team/asteroid
from asteroid.scripts import asteroid_versions, asteroid_cli def test_infer_device(monkeypatch): """Test that inference is performed on the PyTorch device given by '--device'. We can't properly test this in environments with only CPU device available. As an approximation we test that the '.to()' method of...
"cuda:42"
assert
string_literal
tests/cli_test.py
test_infer_device
46
null
asteroid-team/asteroid
import pytest import itertools import torch from torch import nn, optim from torch.utils import data from torch.testing import assert_close import pytorch_lightning as pl from pytorch_lightning import Trainer from asteroid.losses import PITLossWrapper from asteroid.losses import sdr from asteroid.losses import single...
AssertionError)
pytest.raises
variable
tests/losses/sinkpit_wrapper_test.py
test_wrapper
48
null
asteroid-team/asteroid
import pytest import torch from torch.testing import assert_close from asteroid.masknn import activations from torch import nn def activation_mapping(): mapping_list = [ (nn.Identity, "linear"), (nn.ReLU, "relu"), (nn.PReLU, "prelu"), (nn.LeakyReLU, "leaky_relu"), (nn.Sigmo...
None
assert
none_literal
tests/masknn/activations_test.py
test_get_none
49
null
asteroid-team/asteroid
import itertools import argparse from collections.abc import MutableMapping import torch from torch.testing import assert_close import pytest import numpy as np from asteroid import utils from asteroid.utils import prepare_parser_from_dict, parse_args_as_dict def parser(): # Create dictionary as from .yml file ...
plain_args.main_key
assert
complex_expr
tests/utils/utils_test.py
test_namespace_dic
28
null
asteroid-team/asteroid
import torch import pytest from asteroid.dsp.deltas import concat_deltas, compute_delta @pytest.mark.parametrize("dim", [1, 2, -1, -2]) def test_delta(dim): phase = torch.randn(2, 257, 100) delta_phase = compute_delta(phase, dim=dim) assert phase.shape ==
delta_phase.shape
assert
complex_expr
tests/dsp/deltas_tests.py
test_delta
11
null
asteroid-team/asteroid
import pytest import torch from torch.testing import assert_close from asteroid.masknn import activations from torch import nn def activation_mapping(): mapping_list = [ (nn.Identity, "linear"), (nn.ReLU, "relu"), (nn.PReLU, "prelu"), (nn.LeakyReLU, "leaky_relu"), (nn.Sigmo...
activations.get(torch_softmax)
assert
func_call
tests/masknn/activations_test.py
test_softmax
38
null
asteroid-team/asteroid
import pytest import torch from torch.testing import assert_close import warnings from asteroid_filterbanks import STFTFB, Encoder, transforms from asteroid.losses import PITLossWrapper from asteroid.losses import sdr, mse from asteroid.losses import deep_clustering_loss, SingleSrcPMSQE from asteroid.losses import Sin...
no_batch_ok)
assert_*
variable
tests/losses/loss_functions_test.py
test_sisdr_and_mse_shape_checks
93
null
asteroid-team/asteroid
import pytest import torch from torch import nn from asteroid.masknn import norms def test_get_none(): assert norms.get(None) is
None
assert
none_literal
tests/masknn/norms_test.py
test_get_none
34
null
asteroid-team/asteroid
import pytest import itertools import torch from torch import nn, optim from torch.utils import data from torch.testing import assert_close import pytorch_lightning as pl from pytorch_lightning import Trainer from asteroid.losses import PITLossWrapper from asteroid.losses import sdr from asteroid.losses import single...
(self.epoch + 1) * self.n_batch
assert
collection
tests/losses/sinkpit_wrapper_test.py
on_train_batch_end
_TestCallback
105
null
asteroid-team/asteroid
import torch import pytest from torch.testing import assert_close from asteroid_filterbanks import make_enc_dec from asteroid.models.base_models import BaseEncoderMaskerDecoder @pytest.mark.parametrize( "filter_bank_name", ("free", "stft", "analytic_free", "param_sinc"), ) @pytest.mark.parametrize( "infere...
out)
assert_*
variable
tests/jit/jit_filterbanks_test.py
test_jit_filterbanks
33
null
asteroid-team/asteroid
import pytest import torch from torch import nn from asteroid.masknn import norms @pytest.mark.parametrize("norm_str", ["gLN", "cLN", "cgLN", "bN", "fgLN"]) @pytest.mark.parametrize("channel_size", [8, 128, 4]) def test_norms(norm_str, channel_size): norm_layer = norms.get(norm_str) # Use get on the class ...
norm_layer
assert
variable
tests/masknn/norms_test.py
test_norms
14
null
asteroid-team/asteroid
import numpy as np from asteroid.dsp.normalization import normalize_estimates def test_normalization(): mix = (np.random.rand(1600) - 0.5) * 2 # random [-1,1[ est = (np.random.rand(2, 1600) - 0.5) * 10 est_normalized = normalize_estimates(est, mix) assert np.max(est_normalized) < 1 assert np.mi...
-1
assert
numeric_literal
tests/dsp/normalization_test.py
test_normalization
12
null
asteroid-team/asteroid
import torch import pytest from torch.testing import assert_close import numpy as np import soundfile as sf import asteroid from asteroid import models from asteroid_filterbanks import make_enc_dec from asteroid.dsp import LambdaOverlapAdd from asteroid.models.fasnet import FasNetTAC from asteroid.separate import separ...
RuntimeError)
pytest.raises
variable
tests/models/models_test.py
test_convtasnet_sep
87
null
asteroid-team/asteroid
import torch from torch.testing import assert_close import pytest import math from asteroid import complex_nn as cnn from asteroid.utils.deprecation_utils import VisibleDeprecationWarning from asteroid_filterbanks import transforms def test_torch_complex_from_magphase(): shape = (1, 257, 100) mag = torch.rand...
phase)
assert_*
variable
tests/complex_nn_test.py
test_torch_complex_from_magphase
21
null
asteroid-team/asteroid
import pytest import torch from torch import nn from asteroid.masknn import norms def test_register(): class Custom(nn.Module): def __init__(self): super().__init__() norms.register_norm(Custom) cls = norms.get("Custom") assert cls ==
Custom
assert
variable
tests/masknn/norms_test.py
test_register
44
null
asteroid-team/asteroid
import pytest import torch from torch.testing import assert_close import warnings from asteroid_filterbanks import STFTFB, Encoder, transforms from asteroid.losses import PITLossWrapper from asteroid.losses import sdr, mse from asteroid.losses import deep_clustering_loss, SingleSrcPMSQE from asteroid.losses import Sin...
TypeError)
pytest.raises
variable
tests/losses/loss_functions_test.py
assert_loss_checks_shape
34
null
asteroid-team/asteroid
import os import json import shutil import pytest from asteroid.models import save_publishable, upload_publishable, ConvTasNet from asteroid.data.wham_dataset import WhamDataset def populate_wham_dir(path): wham_files = ["s1", "s2", "noise", "mix_single", "mix_clean", "mix_both"] os.makedirs(path, exist_ok=Tr...
[d["identifier"] for d in meta["communities"]]
assert
collection
tests/models/publish_test.py
test_upload
52
null
asteroid-team/asteroid
import torch from torch.testing import assert_close import pytest import math from asteroid import complex_nn as cnn from asteroid.utils.deprecation_utils import VisibleDeprecationWarning from asteroid_filterbanks import transforms def test_onreim(): inp = torch.randn(10, 10, dtype=torch.complex64) # Identity...
inp)
assert_*
variable
tests/complex_nn_test.py
test_onreim
33
null
asteroid-team/asteroid
import itertools import argparse from collections.abc import MutableMapping import torch from torch.testing import assert_close import pytest import numpy as np from asteroid import utils from asteroid.utils import prepare_parser_from_dict, parse_args_as_dict def parser(): # Create dictionary as from .yml file ...
max(1, sig_len - desired)
assert
func_call
tests/utils/utils_test.py
test_get_start_stop
100
null
asteroid-team/asteroid
import os import pytest from asteroid.utils import hub_utils HF_EXAMPLE_MODEL_IDENTIFER = "julien-c/DPRNNTasNet-ks16_WHAM_sepclean" HF_EXAMPLE_MODEL_IDENTIFER_URL = "https://huggingface.co/julien-c/DPRNNTasNet-ks16_WHAM_sepclean" REVISION_ID_ONE_SPECIFIC_COMMIT = "8ab5ef18ef2eda141dd11a5d037a8bede7804ce4" @pytest.ma...
path1
assert
variable
tests/utils/hub_utils_test.py
test_hf_download
39
null
asteroid-team/asteroid
import torch import pytest from torch.testing import assert_close import numpy as np import soundfile as sf import asteroid from asteroid import models from asteroid_filterbanks import make_enc_dec from asteroid.dsp import LambdaOverlapAdd from asteroid.models.fasnet import FasNetTAC from asteroid.separate import separ...
ValueError)
pytest.raises
variable
tests/models/models_test.py
test_register
294
null
asteroid-team/asteroid
import itertools import argparse from collections.abc import MutableMapping import torch from torch.testing import assert_close import pytest import numpy as np from asteroid import utils from asteroid.utils import prepare_parser_from_dict, parse_args_as_dict def parser(): # Create dictionary as from .yml file ...
list(tensors)
assert
func_call
tests/utils/utils_test.py
test_transfer
69
null
asteroid-team/asteroid
import torch from torch.testing import assert_close import pytest from asteroid.dsp.consistency import mixture_consistency def test_consistency_raise(): mix = torch.randn(10, 1, 1, 160) est = torch.randn(10, 2, 160) with pytest.raises(
RuntimeError)
pytest.raises
variable
tests/dsp/consistency_test.py
test_consistency_raise
39
null
asteroid-team/asteroid
from unittest import mock import numpy as np import pytest from asteroid.metrics import get_metrics, MetricTracker @pytest.mark.parametrize("filename", [None, "example.wav"]) def test_error_msg(filename): mix = np.random.randn(1, 4000) clean = np.random.randn(1, 4000) est = np.random.randn(1, 4000) exp...
RuntimeError, match=expected_msg)
pytest.raises
complex_expr
tests/metrics_test.py
test_error_msg
44
null
asteroid-team/asteroid
import pytest import torch from torch import nn from asteroid.masknn import norms def test_register(): class Custom(nn.Module): def __init__(self): super().__init__() norms.register_norm(Custom) cls = norms.get("Custom") assert cls == Custom with pytest.raises(
ValueError)
pytest.raises
variable
tests/masknn/norms_test.py
test_register
46
null
sammchardy/python-binance
import asyncio import pytest import pytest_asyncio from binance import BinanceSocketManager async def socket_manager(clientAsync): """Create a BinanceSocketManager using the clientAsync fixture from conftest.""" return BinanceSocketManager(clientAsync) class TestUserSocketFunctionality: @pytest.mark.asy...
None
assert
none_literal
tests/test_user_socket_integration.py
test_user_socket_context_manager
TestUserSocketFunctionality
121
null
sammchardy/python-binance
import sys import asyncio import pytest from unittest.mock import AsyncMock, MagicMock from binance.async_client import AsyncClient from binance.ws.keepalive_websocket import KeepAliveWebsocket @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") @pytest.mark.asyncio async def test_kee...
calls_before_exit
assert
variable
tests/test_keepalive_reconnect.py
test_keepalive_stops_after_exit
148
null
sammchardy/python-binance
import sys import pytest from binance.client import Client from .conftest import proxies, api_key, api_secret, testnet from .test_get_order_book import assert_ob pytestmark = [pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+")] def test_ws_time_milliseconds(): milli_client = Clie...
13
assert
numeric_literal
tests/test_client_ws_api.py
test_ws_time_milliseconds
93
null
sammchardy/python-binance
import asyncio import pytest import pytest_asyncio from binance import BinanceSocketManager async def socket_manager(clientAsync): """Create a BinanceSocketManager using the clientAsync fixture from conftest.""" return BinanceSocketManager(clientAsync) class TestUserSocketArchitecture: @pytest.mark.asyn...
clientAsync.ws_api._queue
assert
complex_expr
tests/test_user_socket_integration.py
test_user_socket_has_separate_queue
TestUserSocketArchitecture
39
null
sammchardy/python-binance
import pytest import sys from binance.exceptions import BinanceAPIException from .test_get_order_book import assert_ob from .test_order import assert_contract_order @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") def test_ws_futures_create_cancel_algo_order(futuresClient): """...
ticker["symbol"]
assert
complex_expr
tests/test_client_ws_futures_requests.py
test_ws_futures_create_cancel_algo_order
107
null
sammchardy/python-binance
from binance.client import Client from binance.exceptions import BinanceAPIException, BinanceRequestException import pytest import requests_mock import os proxies = {} proxy = os.getenv("PROXY") client = Client("api_key", "api_secret", {"proxies": proxies}) def test_invalid_json(): """Test Invalid response Excep...
BinanceRequestException)
pytest.raises
variable
tests/test_api_request.py
test_invalid_json
20
null
sammchardy/python-binance
import sys import pytest import logging from binance import BinanceSocketManager pytestmark = [ pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+"), pytest.mark.asyncio ] logger = logging.getLogger(__name__) OPTION_SYMBOL = "BTC-251226-60000-P" UNDERLYING_SYMBOL = "BTC" EXPIR...
0
assert
numeric_literal
tests/test_streams_options.py
test_options_ticker_by_expiration
43
null
sammchardy/python-binance
from datetime import datetime import pytest from .test_order import assert_contract_order from .test_get_order_book import assert_ob pytestmark = [pytest.mark.futures, pytest.mark.asyncio] async def close_all_futures_positions(futuresClientAsync): # Get all open positions positions = await futuresClientAsync...
algo_id
assert
variable
tests/test_async_client_futures.py
test_futures_get_algo_order_async
603
null
sammchardy/python-binance
import sys import pytest from binance.client import Client from .conftest import proxies, api_key, api_secret, testnet from .test_get_order_book import assert_ob pytestmark = [pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+")] def test_ws_time_microseconds(): micro_client = Clie...
16
assert
numeric_literal
tests/test_client_ws_api.py
test_ws_time_microseconds
79
null
sammchardy/python-binance
import pytest import logging from binance.client import Client from binance.async_client import AsyncClient def test_client_verbose_initialization(): """Test that Client can be initialized with verbose mode""" client = Client(verbose=True, ping=False) assert client.verbose is True assert client.logger...
None
assert
none_literal
tests/test_verbose_mode.py
test_client_verbose_initialization
13
null
sammchardy/python-binance
import sys import pytest import logging from binance import BinanceSocketManager pytestmark = [ pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+"), pytest.mark.asyncio ] logger = logging.getLogger(__name__) OPTION_SYMBOL = "BTC-251226-60000-P" UNDERLYING_SYMBOL = "BTC" EXPIR...
'kline'
assert
string_literal
tests/test_streams_options.py
test_options_kline
69
null
sammchardy/python-binance
import pytest pytestmark = [pytest.mark.gift_card, pytest.mark.asyncio] async def test_gift_card_create_verify_and_redeem(liveClientAsync): # create a gift card response = await liveClientAsync.gift_card_create(token="USDT", amount=1.0) assert response["data"]["referenceNo"] is not None assert respons...
redeem_response["data"]["referenceNo"]
assert
complex_expr
tests/test_async_client_gift_card copy.py
test_gift_card_create_verify_and_redeem
28
null
sammchardy/python-binance
import asyncio import pytest import sys from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from .test_get_order_book import assert_ob from .test_order import assert_contract_order @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") @pytest.mark.asynci...
orderbook)
assert_*
variable
tests/test_async_client_ws_futures_requests.py
test_concurrent_ws_futures_get_order_book
38
null
sammchardy/python-binance
import sys import pytest import gzip import json from unittest.mock import patch, create_autospec, Mock from binance.ws.reconnecting_websocket import ReconnectingWebsocket from binance.ws.constants import WSListenerState from binance.exceptions import BinanceWebsocketUnableToConnect, ReadLoopClosed from websockets impo...
Exception)
pytest.raises
variable
tests/test_reconnecting_websocket.py
test_handle_message_invalid_json
72
null
sammchardy/python-binance
import pytest import asyncio import websockets from binance.ws.threaded_stream import ThreadedApiManager from unittest.mock import Mock @pytest.mark.asyncio async def test_initialization(): """Test that manager initializes with correct parameters""" manager = ThreadedApiManager( api_key="test_key", ...
True
assert
bool_literal
tests/test_threaded_stream.py
test_initialization
42
null
sammchardy/python-binance
import pytest import sys from binance.exceptions import BinanceAPIException from .test_get_order_book import assert_ob from .test_order import assert_contract_order @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") def test_ws_futures_get_order_book(futuresClient): orderbook = f...
orderbook)
assert_*
variable
tests/test_client_ws_futures_requests.py
test_ws_futures_get_order_book
11
null
sammchardy/python-binance
import pytest import sys from binance.async_client import AsyncClient from .conftest import proxy, api_key, api_secret, testnet from binance.exceptions import BinanceAPIException, BinanceRequestException from aiohttp import ClientResponse, hdrs from aiohttp.helpers import TimerNoop from yarl import URL pytestmark = [...
BinanceAPIException)
pytest.raises
variable
tests/test_async_client.py
test_handle_response
275
null
sammchardy/python-binance
import pytest import sys from binance.exceptions import BinanceAPIException def assert_ob(order_book): assert isinstance(order_book, dict) assert "lastUpdateId" in order_book assert "bids" in order_book assert "asks" in order_book assert isinstance(order_book["bids"], list) assert isinstance(o...
2
assert
numeric_literal
tests/test_get_order_book.py
assert_ob
17
null
sammchardy/python-binance
import sys import pytest import logging from binance import BinanceSocketManager pytestmark = [ pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+"), pytest.mark.asyncio ] logger = logging.getLogger(__name__) OPTION_SYMBOL = "BTC-251226-60000-P" UNDERLYING_SYMBOL = "BTC" EXPIR...
'index'
assert
string_literal
tests/test_streams_options.py
test_options_index_price
139
null
sammchardy/python-binance
import asyncio import pytest import pytest_asyncio from binance import BinanceSocketManager async def socket_manager(clientAsync): """Create a BinanceSocketManager using the clientAsync fixture from conftest.""" return BinanceSocketManager(clientAsync) class TestNonUserSockets: @pytest.mark.asyncio ...
"margin"
assert
string_literal
tests/test_user_socket_integration.py
test_margin_socket_not_using_ws_api_subscription
TestNonUserSockets
147
null
sammchardy/python-binance
import pytest from binance.client import Client from binance.async_client import AsyncClient from binance.exceptions import BinanceRegionException class TestBinanceRegionException: def test_exception_message_format(self): """Test that exception message is properly formatted.""" exc = BinanceRegion...
str(exc)
assert
func_call
tests/test_region_exception.py
test_exception_message_format
TestBinanceRegionException
22
null
sammchardy/python-binance
import json import sys import pytest import asyncio from binance import AsyncClient from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from binance.ws.constants import WSListenerState from .test_get_order_book import assert_ob from .conftest import proxy @pytest.mark.skipif(sys.versio...
trade
assert
variable
tests/test_ws_api.py
test_ws_api_with_stream
244
null
sammchardy/python-binance
import json import sys import pytest import asyncio from binance import AsyncClient from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from binance.ws.constants import WSListenerState from .test_get_order_book import assert_ob from .conftest import proxy @pytest.mark.asyncio async def...
BinanceAPIException)
pytest.raises
variable
tests/test_ws_api.py
test_message_handling_raise_exception
139
null
sammchardy/python-binance
import json import sys import pytest import asyncio from binance import AsyncClient from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from binance.ws.constants import WSListenerState from .test_get_order_book import assert_ob from .conftest import proxy @pytest.mark.asyncio async def...
valid_msg
assert
variable
tests/test_ws_api.py
test_message_handling
132
null
sammchardy/python-binance
import asyncio import pytest import pytest_asyncio from binance import BinanceSocketManager async def socket_manager(clientAsync): """Create a BinanceSocketManager using the clientAsync fixture from conftest.""" return BinanceSocketManager(clientAsync) class TestWsApiSubscriptionRouting: @pytest.mark.as...
test_queue
assert
variable
tests/test_user_socket_integration.py
test_ws_api_register_unregister_queue
TestWsApiSubscriptionRouting
175
null
sammchardy/python-binance
import requests_mock import pytest from aioresponses import aioresponses from binance import Client, AsyncClient client = Client(api_key="api_key", api_secret="api_secret", ping=False) def test_get_headers(): with requests_mock.mock() as m: m.get("https://api.binance.com/api/v3/account", json={}, status_...
"application/json"
assert
string_literal
tests/test_headers.py
test_get_headers
16
null
sammchardy/python-binance
import logging import pytest def test_websocket_logger_level_configuration(): """Test that WebSocket logger levels can be set""" ws_logger = logging.getLogger("binance.ws.test_config") # Set to DEBUG ws_logger.setLevel(logging.DEBUG) assert ws_logger.level == logging.DEBUG # Set to INFO w...
logging.WARNING
assert
complex_expr
tests/test_websocket_verbose.py
test_websocket_logger_level_configuration
40
null
sammchardy/python-binance
import pytest import requests_mock pytestmark = pytest.mark.gift_card def test_gift_card_create_verify_and_redeem(liveClient): # create a gift card response = liveClient.gift_card_create(token="USDT", amount=1.0) assert response["data"]["referenceNo"] is not None assert response["data"]["code"] is not...
"SUCCESS"
assert
string_literal
tests/test_client_gift_card.py
test_gift_card_create_verify_and_redeem
41
null
sammchardy/python-binance
import sys import pytest from binance.client import Client from binance.exceptions import BinanceAPIException, BinanceRequestException from .conftest import proxies, api_key, api_secret, testnet, call_method_and_assert_uri_contains def test_handle_response(client): # Test successful JSON response mock_response...
{}
assert
collection
tests/test_client.py
test_handle_response
252
null
sammchardy/python-binance
import pytest import asyncio import websockets from binance.ws.threaded_stream import ThreadedApiManager from unittest.mock import Mock @pytest.mark.asyncio async def test_start_and_stop_socket(manager): """Test starting and stopping a socket""" socket_name = "test_socket" # AsyncMock socket creation ...
manager._socket_running
assert
complex_expr
tests/test_threaded_stream.py
test_start_and_stop_socket
101
null
sammchardy/python-binance
import pytest import sys from binance.exceptions import BinanceAPIException from .test_get_order_book import assert_ob from .test_order import assert_contract_order def test_bad_request(futuresClient): with pytest.raises(
BinanceAPIException)
pytest.raises
variable
tests/test_client_ws_futures_requests.py
test_bad_request
15
null
sammchardy/python-binance
import logging import pytest def test_websocket_logger_level_configuration(): """Test that WebSocket logger levels can be set""" ws_logger = logging.getLogger("binance.ws.test_config") # Set to DEBUG ws_logger.setLevel(logging.DEBUG) assert ws_logger.level == logging.DEBUG # Set to INFO w...
logging.INFO
assert
complex_expr
tests/test_websocket_verbose.py
test_websocket_logger_level_configuration
36
null
sammchardy/python-binance
import pytest import sys from binance.exceptions import BinanceAPIException def assert_ob(order_book): assert isinstance(order_book, dict) assert "lastUpdateId" in order_book assert "bids" in order_book assert "asks" in order_book assert isinstance(order_book["bids"], list) assert isinstance(o...
order_book)
assert_*
variable
tests/test_get_order_book.py
test_get_order_book_with_limit
48
null
sammchardy/python-binance
import asyncio import pytest import sys from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from .test_get_order_book import assert_ob from .test_order import assert_contract_order @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") @pytest.mark.asynci...
ticker["symbol"]
assert
complex_expr
tests/test_async_client_ws_futures_requests.py
test_ws_futures_create_cancel_algo_order
196
null
sammchardy/python-binance
import asyncio import pytest import pytest_asyncio from binance import BinanceSocketManager async def socket_manager(clientAsync): """Create a BinanceSocketManager using the clientAsync fixture from conftest.""" return BinanceSocketManager(clientAsync) class TestUserSocketArchitecture: @pytest.mark.asyn...
clientAsync.ws_api._subscription_queues
assert
complex_expr
tests/test_user_socket_integration.py
test_user_socket_cleanup_on_exit
TestUserSocketArchitecture
98
null