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 |
|---|---|---|---|---|---|---|---|---|---|
fabriziosalmi/certmate | import pytest
from unittest.mock import MagicMock, patch
from modules.core.auth import AuthManager, ROLE_HIERARCHY
def settings_store():
"""Shared mutable settings dict."""
return {
'local_auth_enabled': False,
'users': {},
'api_bearer_token': 'legacy_test_token_abc123',
'api_ke... | 43 | assert | numeric_literal | tests/test_apikeys.py | test_creates_key_with_cm_prefix | TestCreateApiKey | 36 | null |
fabriziosalmi/certmate | import pytest
pytestmark = [pytest.mark.e2e]
class TestUserManagement:
def test_create_and_delete_user(self, api):
# Create
r = api.post_json("/api/users", {
"username": "testuser",
"password": "TestPass123!",
"role": "user",
})
assert r.status... | (200, 201) | assert | collection | tests/test_auth.py | test_create_and_delete_user | TestUserManagement | 75 | null |
fabriziosalmi/certmate | import pytest
from unittest.mock import MagicMock, patch
from pathlib import Path
class TestRoute53PropagationFlag:
def setup_method(self):
from modules.core.dns_strategies import Route53Strategy, CloudflareStrategy, DNSStrategyFactory
self.route53 = Route53Strategy()
self.cloudflare = Clo... | cmd | assert | variable | tests/test_san_domains.py | test_propagation_flag_not_in_certbot_cmd_for_route53 | TestRoute53PropagationFlag | 180 | null |
fabriziosalmi/certmate | import pytest
pytestmark = [pytest.mark.e2e]
class TestPageLoading:
@pytest.mark.parametrize("path", [
"/",
"/settings",
"/help",
"/activity",
"/redoc",
"/health",
])
def test_page_returns_200(self, api, path):
r = api.get(path, allow_redirects=True... | 200 | assert | numeric_literal | tests/test_pages.py | test_page_returns_200 | TestPageLoading | 24 | null |
fabriziosalmi/certmate | import pytest
pytestmark = [pytest.mark.e2e]
class TestAuthConfig:
def test_auth_me_returns_401_without_session(self, api):
"""/api/auth/me should return 401 when no session exists."""
r = api.get("/api/auth/me")
assert r.status_code == | 401 | assert | numeric_literal | tests/test_auth.py | test_auth_me_returns_401_without_session | TestAuthConfig | 56 | null |
fabriziosalmi/certmate | import json
import pytest
from unittest.mock import MagicMock
from pathlib import Path
from modules.core.deployer import DeployManager
from modules.core.shell import MockShellExecutor
def shell_executor():
return MockShellExecutor()
def settings_manager():
mgr = MagicMock()
mgr.load_settings.return_value ... | 1 | assert | numeric_literal | tests/test_deployer.py | test_failure_nonzero_exit | TestHookExecution | 95 | null |
fabriziosalmi/certmate | import os
import uuid
import zipfile
import io
import pytest
pytestmark = [pytest.mark.e2e, pytest.mark.slow]
BASE_DOMAIN = os.environ.get("CERTMATE_TEST_DOMAIN", "gpfree.org")
TEST_EMAIL = os.environ.get("CERTMATE_TEST_EMAIL", "test@gpfree.org")
_run_id = uuid.uuid4().hex[:8]
TEST_DOMAIN = f"e2e-{_run_id}.{BASE_DOM... | 50 | assert | numeric_literal | tests/test_cert_lifecycle.py | test_05_download_tls_components | TestCertificateDownload | 105 | null |
fabriziosalmi/certmate | import pytest
pytestmark = [pytest.mark.e2e]
class TestDNSProviderAccounts:
def test_list_accounts_after_create(self, api):
r = api.get("/api/dns/cloudflare/accounts")
assert r.status_code == 200
data = r.json()
# Should contain our test account
accounts = data if isinstan... | ids | assert | variable | tests/test_settings.py | test_list_accounts_after_create | TestDNSProviderAccounts | 70 | null |
fabriziosalmi/certmate | import pytest
pytestmark = [pytest.mark.e2e]
class TestSetupModeBypass:
@pytest.mark.parametrize("path", [
"/api/certificates",
"/api/backups",
"/api/users",
"/api/auth/config",
"/api/web/settings",
"/api/web/cache/stats",
"/api/client-certs",
"/api... | 200 | assert | numeric_literal | tests/test_auth.py | test_api_accessible_without_auth | TestSetupModeBypass | 26 | null |
fabriziosalmi/certmate | import os
import uuid
import zipfile
import io
import pytest
pytestmark = [pytest.mark.e2e, pytest.mark.slow]
BASE_DOMAIN = os.environ.get("CERTMATE_TEST_DOMAIN", "gpfree.org")
TEST_EMAIL = os.environ.get("CERTMATE_TEST_EMAIL", "test@gpfree.org")
_run_id = uuid.uuid4().hex[:8]
TEST_DOMAIN = f"e2e-{_run_id}.{BASE_DOM... | 100 | assert | numeric_literal | tests/test_cert_lifecycle.py | test_04_download_zip | TestCertificateDownload | 93 | null |
fabriziosalmi/certmate | import os
import uuid
import zipfile
import io
import pytest
pytestmark = [pytest.mark.e2e, pytest.mark.slow]
BASE_DOMAIN = os.environ.get("CERTMATE_TEST_DOMAIN", "gpfree.org")
TEST_EMAIL = os.environ.get("CERTMATE_TEST_EMAIL", "test@gpfree.org")
_run_id = uuid.uuid4().hex[:8]
TEST_DOMAIN = f"e2e-{_run_id}.{BASE_DOM... | (200, 201) | assert | collection | tests/test_cert_lifecycle.py | test_01_create_certificate | TestCertificateCreation | 60 | null |
fabriziosalmi/certmate | import os
import uuid
import zipfile
import io
import pytest
pytestmark = [pytest.mark.e2e, pytest.mark.slow]
BASE_DOMAIN = os.environ.get("CERTMATE_TEST_DOMAIN", "gpfree.org")
TEST_EMAIL = os.environ.get("CERTMATE_TEST_EMAIL", "test@gpfree.org")
_run_id = uuid.uuid4().hex[:8]
TEST_DOMAIN = f"e2e-{_run_id}.{BASE_DOM... | domains | assert | variable | tests/test_cert_lifecycle.py | test_02_certificate_in_list | TestCertificateListing | 75 | null |
fabriziosalmi/certmate | import pytest
pytestmark = [pytest.mark.e2e]
class TestNoCDNReferences:
@pytest.mark.parametrize("path", ["/", "/settings", "/help"])
def test_html_no_cdn_scripts(self, api, path):
r = api.get(path, allow_redirects=True)
body = r.text
assert "cdn.tailwindcss.com" not in | body | assert | variable | tests/test_static_csp.py | test_html_no_cdn_scripts | TestNoCDNReferences | 75 | null |
fabriziosalmi/certmate | import pytest
from unittest.mock import MagicMock, patch
from pathlib import Path
from modules.core.digest import WeeklyDigest
def mock_managers():
"""Create mock managers for digest tests."""
settings_mgr = MagicMock()
settings_mgr.load_settings.return_value = {
'domains': [
{'domain':... | True | assert | bool_literal | tests/test_digest.py | test_send_success | TestSendDigest | 176 | null |
microsoft/mattergen | from abc import ABC, abstractmethod
from math import pi
from typing import Optional, Tuple
import pytest
import torch
from mattergen.common.data.chemgraph import ChemGraph
from mattergen.common.diffusion.corruption import (
LatticeVPSDE,
expand,
make_noise_symmetric_preserve_variance,
)
from mattergen.dif... | AssertionError) | pytest.raises | variable | mattergen/tests/test_sde_lib.py | test_make_noise_symmetric_preserve_variance | 179 | null | |
microsoft/mattergen | from typing import Any, Dict, Type
import pytest
import torch
from mattergen.diffusion.corruption.multi_corruption import MultiCorruption
from mattergen.diffusion.corruption.sde_lib import SDE
from mattergen.diffusion.tests.conftest import SDE_TYPES
def _check_keys_shapes(multi_corruption: MultiCorruption, batch, t:... | batch[k].shape[0] | assert | complex_expr | mattergen/diffusion/tests/test_multi_corruption.py | _check_keys_shapes | 31 | null | |
microsoft/mattergen | from typing import List, Tuple
import pytest
from pymatgen.core import Element, Structure
from mattergen.evaluation.utils.structure_matcher import (
DefaultDisorderedStructureMatcher,
DefaultOrderedStructureMatcher,
check_is_disordered,
)
def test_structure_matcher_ignores_formal_space_group():
struc... | structure_2.get_space_group_info( symprec=0.1 ) | assert | func_call | mattergen/tests/test_structure_matcher.py | test_structure_matcher_ignores_formal_space_group | 152 | null | |
microsoft/mattergen | from abc import ABC, abstractmethod
from math import pi
from typing import Optional, Tuple
import pytest
import torch
from mattergen.common.data.chemgraph import ChemGraph
from mattergen.common.diffusion.corruption import (
LatticeVPSDE,
expand,
make_noise_symmetric_preserve_variance,
)
from mattergen.dif... | len(output_shape) | assert | func_call | mattergen/tests/test_sde_lib.py | test_expand | 197 | null | |
microsoft/mattergen | import pytest
import torch
from torch_scatter import scatter_add
from mattergen.common.data.chemgraph import ChemGraph
from mattergen.common.data.collate import collate
from mattergen.common.data.transform import set_chemical_system_string
from mattergen.common.utils.globals import MAX_ATOMIC_NUM
from mattergen.denois... | expected_number_masked | assert | variable | mattergen/tests/test_mattergen_denoiser.py | test_pre_corruption_fn_multi | 107 | null | |
microsoft/mattergen | from functools import partial
from typing import Dict, List, Type
import pytest
import torch
from mattergen.diffusion.corruption.corruption import Corruption
from mattergen.diffusion.corruption.multi_corruption import MultiCorruption, apply
from mattergen.diffusion.corruption.sde_lib import SDE
from mattergen.diffusi... | unweighted_loss_per_field["foo"] * weights["foo"] + unweighted_loss_per_field["bar"] * weights["bar"]) | assert_* | complex_expr | mattergen/diffusion/tests/test_losses.py | test_weighted_summed_field_loss | 143 | null | |
microsoft/mattergen | from collections import Counter
from itertools import product
from typing import Dict, Optional, Tuple
import numpy as np
import pytest
import torch
from pymatgen.core.structure import Structure
from pymatgen.transformations.standard_transformations import RotationTransformation
from mattergen.common.tests.testutils ... | counter2 | assert | variable | mattergen/common/tests/data_utils_test.py | test_pbc_graph_translation_invariant | 200 | null | |
microsoft/mattergen | import functools
import numpy as np
import pytest
import torch
from mattergen.diffusion.d3pm import d3pm as diffusion
def test_compute_posterior():
"""Tests that the forward diffusion probabilities are correct for t=0."""
schedule = diffusion.create_discrete_diffusion_schedule(
kind="linear",
... | (2, 100) | assert | collection | mattergen/diffusion/tests/test_d3pm.py | test_compute_posterior | 165 | null | |
microsoft/mattergen | import torch
from mattergen.diffusion.data.batched_data import collate_fn
def test_collate_fn():
"""Collate two pieces of data"""
data1 = {"a": torch.tensor([1, 2, 3, 4]), "b": torch.tensor([[1, 2, 3]]), "name": "data1"}
data2 = {"a": torch.tensor([10, 11]), "b": torch.tensor([[10, 11, 12]]), "name": "dat... | [0, 0, 0, 0, 1, 1] | assert | collection | mattergen/diffusion/tests/data/test_batched_data.py | test_collate_fn | 17 | null | |
microsoft/mattergen | from argparse import Namespace
from contextlib import nullcontext
from functools import partial
from typing import List, Type
import pytest
import torch
from mattergen.diffusion.corruption.multi_corruption import MultiCorruption
from mattergen.diffusion.corruption.sde_lib import SDE
from mattergen.diffusion.data.batc... | wrapping_boundary | assert | variable | mattergen/diffusion/tests/test_reverse_sampling.py | test_wrapped_reverse_sampling | 158 | null | |
microsoft/mattergen | import pytest
import torch
from torch_scatter import scatter_add
from mattergen.common.data.chemgraph import ChemGraph
from mattergen.common.data.collate import collate
from mattergen.common.data.transform import set_chemical_system_string
from mattergen.common.utils.globals import MAX_ATOMIC_NUM
from mattergen.denois... | torch.zeros((10, 1), dtype=torch.bool)) | assert_* | func_call | mattergen/tests/test_mattergen_denoiser.py | test_keep_conditioning_fn | 169 | null | |
microsoft/mattergen | import torch
from mattergen.diffusion.data.batched_data import collate_fn
def test_to_data_list():
"""Collate and then unpack two pieces of data."""
data1 = {"a": torch.tensor([1, 2, 3, 4]), "b": torch.tensor([[1, 2, 3]]), "name": "data1"}
data2 = {"a": torch.tensor([10, 11]), "b": torch.tensor([[10, 11, ... | "data2" | assert | string_literal | mattergen/diffusion/tests/data/test_batched_data.py | test_to_data_list | 33 | null | |
microsoft/mattergen | from typing import Type
import pytest
import torch
from mattergen.diffusion.corruption.sde_lib import SDE
from mattergen.diffusion.tests.conftest import SDE_TYPES
def _check_batch_shape(x: torch.Tensor, batch_size: torch.LongTensor):
"""Checks sde outputs that should be (batch_size, )"""
assert len(x.shape) ... | x.shape | assert | complex_expr | mattergen/diffusion/tests/test_sde_lib.py | test_sde | 49 | null | |
microsoft/mattergen | import functools
import numpy as np
import pytest
import torch
from mattergen.diffusion.d3pm import d3pm as diffusion
def test_mask_diffusion_slow_and_fast():
"""Compares fast and slow inference for mask diffusion."""
schedule = diffusion.create_discrete_diffusion_schedule(
kind="standard",
b... | qt_fast) | assert_* | variable | mattergen/diffusion/tests/test_d3pm.py | test_mask_diffusion_slow_and_fast | 235 | null | |
microsoft/mattergen | import torch
from mattergen.diffusion.data.batched_data import collate_fn
def test_to_data_list():
"""Collate and then unpack two pieces of data."""
data1 = {"a": torch.tensor([1, 2, 3, 4]), "b": torch.tensor([[1, 2, 3]]), "name": "data1"}
data2 = {"a": torch.tensor([10, 11]), "b": torch.tensor([[10, 11, ... | [10, 11] | assert | collection | mattergen/diffusion/tests/data/test_batched_data.py | test_to_data_list | 31 | null | |
microsoft/mattergen | from typing import Type
import pytest
import torch
from mattergen.diffusion.corruption.sde_lib import SDE
from mattergen.diffusion.tests.conftest import SDE_TYPES
def _check_batch_shape(x: torch.Tensor, batch_size: torch.LongTensor):
"""Checks sde outputs that should be (batch_size, )"""
assert len(x.shape)... | 1 | assert | numeric_literal | mattergen/diffusion/tests/test_sde_lib.py | _check_batch_shape | 15 | null | |
microsoft/mattergen | import torch
from mattergen.diffusion.data.batched_data import collate_fn
def test_to_data_list():
"""Collate and then unpack two pieces of data."""
data1 = {"a": torch.tensor([1, 2, 3, 4]), "b": torch.tensor([[1, 2, 3]]), "name": "data1"}
data2 = {"a": torch.tensor([10, 11]), "b": torch.tensor([[10, 11, ... | [[1, 2, 3]] | assert | collection | mattergen/diffusion/tests/data/test_batched_data.py | test_to_data_list | 29 | null | |
microsoft/mattergen | from copy import deepcopy
from itertools import chain, permutations
from typing import List, Tuple
import torch
from pymatgen.core.structure import Structure
from scipy.spatial.transform import Rotation
from torch_geometric.data import Batch, Data
from mattergen.common.gemnet.gemnet import GemNetT
from mattergen.comm... | None | assert | none_literal | mattergen/common/tests/gemnet_test.py | test_lattice_score_scale_invariance | 161 | null | |
microsoft/mattergen | import torch
from mattergen.diffusion.data.batched_data import collate_fn
def test_to_data_list():
"""Collate and then unpack two pieces of data."""
data1 = {"a": torch.tensor([1, 2, 3, 4]), "b": torch.tensor([[1, 2, 3]]), "name": "data1"}
data2 = {"a": torch.tensor([10, 11]), "b": torch.tensor([[10, 11, ... | "data1" | assert | string_literal | mattergen/diffusion/tests/data/test_batched_data.py | test_to_data_list | 30 | null | |
microsoft/mattergen | import functools
import numpy as np
import pytest
import torch
from mattergen.diffusion.d3pm import d3pm as diffusion
def test_sample_and_posterior():
"""Tests whether the samples and posterior are as expected when providing timestep 0 for the sampling."""
schedule = diffusion.create_discrete_diffusion_sche... | (1, 100) | assert | collection | mattergen/diffusion/tests/test_d3pm.py | test_sample_and_posterior | 143 | null | |
microsoft/mattergen | from argparse import Namespace
from contextlib import nullcontext
from functools import partial
from typing import List, Type
import pytest
import torch
from mattergen.diffusion.corruption.multi_corruption import MultiCorruption
from mattergen.diffusion.corruption.sde_lib import SDE
from mattergen.diffusion.data.batc... | 0.0 | assert | numeric_literal | mattergen/diffusion/tests/test_reverse_sampling.py | test_wrapped_reverse_sampling | 159 | null | |
microsoft/mattergen | import pytest
import torch
from torch_scatter import scatter_add
from mattergen.common.data.chemgraph import ChemGraph
from mattergen.common.data.collate import collate
from mattergen.common.data.transform import set_chemical_system_string
from mattergen.common.utils.globals import MAX_ATOMIC_NUM
from mattergen.denois... | torch.ones((10, 1), dtype=torch.bool)) | assert_* | func_call | mattergen/tests/test_mattergen_denoiser.py | test_remove_conditioning_fn | 147 | null | |
microsoft/mattergen | from collections import defaultdict
from contextlib import nullcontext
from typing import Callable, Dict, List, Type, Union
import pytest
import torch
from mattergen.diffusion.corruption.sde_lib import SDE, VESDE, VPSDE
from mattergen.diffusion.d3pm.d3pm_predictors_correctors import D3PMAncestralSamplingPredictor
fro... | x_mean.shape | assert | complex_expr | mattergen/diffusion/tests/test_sampling.py | test_predictor | 84 | null | |
microsoft/mattergen | from functools import partial
from typing import Dict, List, Type
import pytest
import torch
from mattergen.diffusion.corruption.corruption import Corruption
from mattergen.diffusion.corruption.multi_corruption import MultiCorruption, apply
from mattergen.diffusion.corruption.sde_lib import SDE
from mattergen.diffusi... | target_loss) | assert_* | variable | mattergen/diffusion/tests/test_losses.py | test_calc_loss | 71 | null | |
microsoft/mattergen | from copy import deepcopy
from itertools import chain, permutations
from typing import List, Tuple
import torch
from pymatgen.core.structure import Structure
from scipy.spatial.transform import Rotation
from torch_geometric.data import Batch, Data
from mattergen.common.gemnet.gemnet import GemNetT
from mattergen.comm... | out_translated.stress) | assert_* | complex_expr | mattergen/common/tests/gemnet_test.py | test_nonconservative_lattice_score_translation_invariance | 217 | null | |
microsoft/mattergen | from functools import partial
from typing import Dict, List, Type
import pytest
import torch
from mattergen.diffusion.corruption.corruption import Corruption
from mattergen.diffusion.corruption.multi_corruption import MultiCorruption, apply
from mattergen.diffusion.corruption.sde_lib import SDE
from mattergen.diffusi... | torch.stack([non_wrapped_loss_per_field[k] for k in non_wrapped_loss_per_field.keys()])) | assert_* | func_call | mattergen/diffusion/tests/test_losses.py | test_wrapped_normal_loss | 202 | null | |
microsoft/mattergen | from collections import Counter
from itertools import product
from typing import Dict, Optional, Tuple
import numpy as np
import pytest
import torch
from pymatgen.core.structure import Structure
from pymatgen.transformations.standard_transformations import RotationTransformation
from mattergen.common.tests.testutils ... | 1 | assert | numeric_literal | mattergen/common/tests/data_utils_test.py | check_invariance | 357 | null | |
microsoft/mattergen | from typing import List
import pytest
from mattergen.common.utils.globals import MAX_ATOMIC_NUM
from mattergen.property_embeddings import ChemicalSystemMultiHotEmbedding
@pytest.mark.parametrize("chemical_system", [["Li", "O"], ["Li", "O", "F"], ["C", "O", "H"]])
def test_chemical_system_to_multi_hot(chemical_system... | ( 1, MAX_ATOMIC_NUM + 1, ) | assert | collection | mattergen/tests/test_generator.py | test_chemical_system_to_multi_hot | 20 | null | |
microsoft/mattergen | import pytest
import torch
from torch_scatter import scatter_add
from mattergen.common.data.chemgraph import ChemGraph
from mattergen.common.data.collate import collate
from mattergen.common.data.transform import set_chemical_system_string
from mattergen.common.utils.globals import MAX_ATOMIC_NUM
from mattergen.denois... | set() | assert | func_call | mattergen/tests/test_mattergen_denoiser.py | test_mask_disallowed_elements | 251 | null | |
microsoft/mattergen | from typing import List
import pytest
from mattergen.common.utils.globals import MAX_ATOMIC_NUM
from mattergen.property_embeddings import ChemicalSystemMultiHotEmbedding
@pytest.mark.parametrize("chemical_system", [["Li", "O"], ["Li", "O", "F"], ["C", "O", "H"]])
def test_chemical_system_to_multi_hot(chemical_system... | len(chemical_system) | assert | func_call | mattergen/tests/test_generator.py | test_chemical_system_to_multi_hot | 24 | null | |
microsoft/mattergen | from typing import List, Tuple
import pytest
from pymatgen.core import Element, Structure
from mattergen.evaluation.utils.structure_matcher import (
DefaultDisorderedStructureMatcher,
DefaultOrderedStructureMatcher,
check_is_disordered,
)
@pytest.mark.parametrize(
"index, expected_is_disordered, expe... | expected_is_disordered | assert | variable | mattergen/tests/test_structure_matcher.py | test_disordered_checker | 107 | null | |
microsoft/mattergen | from typing import Type
import pytest
import torch
from mattergen.diffusion.corruption.sde_lib import SDE
from mattergen.diffusion.tests.conftest import SDE_TYPES
def _check_batch_shape(x: torch.Tensor, batch_size: torch.LongTensor):
"""Checks sde outputs that should be (batch_size, )"""
assert len(x.shape) ... | batch_size | assert | variable | mattergen/diffusion/tests/test_sde_lib.py | _check_batch_shape | 16 | null | |
microsoft/mattergen | from collections import Counter
from itertools import product
from typing import Dict, Optional, Tuple
import numpy as np
import pytest
import torch
from pymatgen.core.structure import Structure
from pymatgen.transformations.standard_transformations import RotationTransformation
from mattergen.common.tests.testutils ... | dtype | assert | variable | mattergen/common/tests/data_utils_test.py | get_distances_numpy | 475 | null | |
microsoft/mattergen | from typing import List, Tuple
import pytest
from pymatgen.core import Element, Structure
from mattergen.evaluation.utils.structure_matcher import (
DefaultDisorderedStructureMatcher,
DefaultOrderedStructureMatcher,
check_is_disordered,
)
@pytest.mark.parametrize(
"indices, expected_match",
[
... | expected_match | assert | variable | mattergen/tests/test_structure_matcher.py | test_structure_comparison | 136 | null | |
microsoft/mattergen | import torch
from mattergen.diffusion.data.batched_data import collate_fn
def test_to_data_list():
"""Collate and then unpack two pieces of data."""
data1 = {"a": torch.tensor([1, 2, 3, 4]), "b": torch.tensor([[1, 2, 3]]), "name": "data1"}
data2 = {"a": torch.tensor([10, 11]), "b": torch.tensor([[10, 11, ... | [1, 2, 3, 4] | assert | collection | mattergen/diffusion/tests/data/test_batched_data.py | test_to_data_list | 28 | null | |
microsoft/mattergen | from abc import ABC, abstractmethod
from math import pi
from typing import Optional, Tuple
import pytest
import torch
from mattergen.common.data.chemgraph import ChemGraph
from mattergen.common.diffusion.corruption import (
LatticeVPSDE,
expand,
make_noise_symmetric_preserve_variance,
)
from mattergen.dif... | output_shape | assert | variable | mattergen/tests/test_sde_lib.py | test_expand | 200 | null | |
microsoft/mattergen | import functools
import numpy as np
import pytest
import torch
from mattergen.diffusion.d3pm import d3pm as diffusion
def test_model():
"""Test the Diffusion noise diffusion."""
schedule = diffusion.create_discrete_diffusion_schedule(
kind="standard",
beta_min=1e-3,
beta_max=1e-3,
... | 1.0) | assert_* | numeric_literal | mattergen/diffusion/tests/test_d3pm.py | test_model | 195 | null | |
microsoft/mattergen | from typing import Type
import pytest
import torch
from mattergen.diffusion.corruption.sde_lib import SDE
from mattergen.diffusion.tests.conftest import SDE_TYPES
def _check_batch_shape(x: torch.Tensor, batch_size: torch.LongTensor):
"""Checks sde outputs that should be (batch_size, )"""
assert len(x.shape) ... | x.shape[0] | assert | complex_expr | mattergen/diffusion/tests/test_sde_lib.py | _check_shapes | 37 | null | |
microsoft/mattergen | from functools import partial
from typing import Dict, List, Type
import pytest
import torch
from mattergen.diffusion.corruption.corruption import Corruption
from mattergen.diffusion.corruption.multi_corruption import MultiCorruption, apply
from mattergen.diffusion.corruption.sde_lib import SDE
from mattergen.diffusi... | unweighted_loss) | assert_* | variable | mattergen/diffusion/tests/test_losses.py | test_weighted_summed_field_loss | 152 | null | |
microsoft/mattergen | import functools
import numpy as np
import pytest
import torch
from mattergen.diffusion.d3pm import d3pm as diffusion
def test_product_constant():
"""Tests, when we have a constant beta schedule (transition probabilities don't change over time),
whether the transition matrices computed via q(x_t | x_0) and q... | expected) | assert_* | variable | mattergen/diffusion/tests/test_d3pm.py | test_product_constant | 122 | null | |
microsoft/mattergen | from abc import ABC, abstractmethod
from math import pi
from typing import Optional, Tuple
import pytest
import torch
from mattergen.common.data.chemgraph import ChemGraph
from mattergen.common.diffusion.corruption import (
LatticeVPSDE,
expand,
make_noise_symmetric_preserve_variance,
)
from mattergen.dif... | (Nbatch, 3, 3) | assert | collection | mattergen/tests/test_sde_lib.py | test_LatticeVPSDE_prior_sampling | 104 | null | |
microsoft/mattergen | import functools
import numpy as np
import pytest
import torch
from mattergen.diffusion.d3pm import d3pm as diffusion
def test_sample_and_posterior():
"""Tests whether the samples and posterior are as expected when providing timestep 0 for the sampling."""
schedule = diffusion.create_discrete_diffusion_sche... | (1,) | assert | collection | mattergen/diffusion/tests/test_d3pm.py | test_sample_and_posterior | 146 | null | |
microsoft/mattergen | import functools
import numpy as np
import pytest
import torch
from mattergen.diffusion.d3pm import d3pm as diffusion
def test_sample_and_posterior():
"""Tests whether the samples and posterior are as expected when providing timestep 0 for the sampling."""
schedule = diffusion.create_discrete_diffusion_sche... | np.array([1])) | assert_* | func_call | mattergen/diffusion/tests/test_d3pm.py | test_sample_and_posterior | 147 | null | |
microsoft/mattergen | import torch
from mattergen.diffusion.data.batched_data import SimpleBatchedData, _batch_edge_index, collate_fn
def test_batch_edge_index():
edge_index = torch.tensor(
[[0, 1], [0, 2], [1, 2], [0, 1], [0, 3], [1, 2], [2, 3], [0, 1], [1, 3]]
)
atom_batch_idx = torch.tensor([0, 0, 1, 1, 1, 1, 1, 2, ... | torch.tensor([[0, 1], [0, 2], [1, 2], [2, 3], [2, 5], [3, 4], [4, 5], [7, 8], [8, 10]])) | assert_* | func_call | mattergen/diffusion/tests/test_data_utils.py | test_batch_edge_index | 50 | null | |
microsoft/mattergen | import torch
from mattergen.diffusion.data.batched_data import SimpleBatchedData, _batch_edge_index, collate_fn
def test_collate_fn():
state1 = dict(foo=torch.ones(2, 3), bar=torch.ones(5, 2))
state2 = dict(foo=torch.zeros(3, 3), bar=torch.zeros(2, 2))
batch = collate_fn([state1, state2])
field_names... | 2 | assert | numeric_literal | mattergen/diffusion/tests/test_data_utils.py | test_collate_fn | 41 | null | |
microsoft/mattergen | import torch
from mattergen.diffusion.data.batched_data import collate_fn
def test_collate_fn():
"""Collate two pieces of data"""
data1 = {"a": torch.tensor([1, 2, 3, 4]), "b": torch.tensor([[1, 2, 3]]), "name": "data1"}
data2 = {"a": torch.tensor([10, 11]), "b": torch.tensor([[10, 11, 12]]), "name": "dat... | ["data1", "data2"] | assert | collection | mattergen/diffusion/tests/data/test_batched_data.py | test_collate_fn | 16 | null | |
microsoft/mattergen | from typing import List, Tuple
import pytest
from pymatgen.core import Element, Structure
from mattergen.evaluation.utils.structure_matcher import (
DefaultDisorderedStructureMatcher,
DefaultOrderedStructureMatcher,
check_is_disordered,
)
@pytest.mark.parametrize(
"index, expected_is_disordered, expe... | expected_substitutional_groups | assert | variable | mattergen/tests/test_structure_matcher.py | test_disordered_checker | 108 | null | |
microsoft/mattergen | from collections import defaultdict
from contextlib import nullcontext
from typing import Callable, Dict, List, Type, Union
import pytest
import torch
from mattergen.diffusion.corruption.sde_lib import SDE, VESDE, VPSDE
from mattergen.diffusion.d3pm.d3pm_predictors_correctors import D3PMAncestralSamplingPredictor
fro... | IncompatibleSampler) | pytest.raises | variable | mattergen/diffusion/tests/test_sampling.py | test_predictor | 65 | null | |
pytest-dev/pytest-xdist | from __future__ import annotations
from pathlib import Path
import shutil
import textwrap
import warnings
import execnet
import pytest
from util import generate_warning
from xdist import workermanage
from xdist._path import visit_path
from xdist.remote import serialize_warning_message
from xdist.workermanage import ... | "abc" | assert | string_literal | testing/test_workermanage.py | test_default_chdir | TestNodeManagerPopen | 72 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
import marshal
import pprint
from queue import Queue
import sys
from typing import Any
from typing import Callable
from typing import cast
from typing import Union
import uuid
import execnet
import pytest
from xdist.workermanage import NodeManager
from xdist.workermanage import Wor... | 4 | assert | numeric_literal | testing/test_remote.py | test_steal_work | TestWorkerInteractor | 258 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
import marshal
import pprint
from queue import Queue
import sys
from typing import Any
from typing import Callable
from typing import cast
from typing import Union
import uuid
import execnet
import pytest
from xdist.workermanage import NodeManager
from xdist.workermanage import Wor... | out | assert | variable | testing/test_remote.py | test_process_from_remote_error_handling | TestWorkerInteractor | 239 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
from collections.abc import Sequence
from itertools import cycle
import pytest
from xdist.remote import Producer
from xdist.report import report_collection_diff
from xdist.workermanage import parse_tx_spec_config
from xdist.workermanage import WorkerController
class LoadScheduling... | None | assert | none_literal | src/xdist/scheduler/load.py | mark_test_pending | LoadScheduling | 164 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
from pathlib import Path
import shutil
import textwrap
import warnings
import execnet
import pytest
from util import generate_warning
from xdist import workermanage
from xdist._path import visit_path
from xdist.remote import serialize_warning_message
from xdist.workermanage import ... | "gw1" | assert | string_literal | testing/test_workermanage.py | test_popen_makegateway_events | TestNodeManagerPopen | 89 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
import marshal
import pprint
from queue import Queue
import sys
from typing import Any
from typing import Callable
from typing import cast
from typing import Union
import uuid
import execnet
import pytest
from xdist.workermanage import NodeManager
from xdist.workermanage import Wor... | [] | assert | collection | testing/test_remote.py | test_steal_work | TestWorkerInteractor | 270 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
import marshal
import pprint
from queue import Queue
import sys
from typing import Any
from typing import Callable
from typing import cast
from typing import Union
import uuid
import execnet
import pytest
from xdist.workermanage import NodeManager
from xdist.workermanage import Wor... | 2 | assert | numeric_literal | testing/test_remote.py | test_runtests_all | TestWorkerInteractor | 192 | null |
pytest-dev/pytest-xdist | from contextlib import suppress
import os
from pathlib import Path
import sys
import execnet
import pytest
from xdist.workermanage import NodeManager
def monkeypatch_3_cpus(monkeypatch: pytest.MonkeyPatch) -> None:
"""Make pytest-xdist believe the system has 3 CPUs."""
# block overrides from Python 3.13 and ... | 5 | assert | numeric_literal | testing/test_plugin.py | test_hook_auto_num_workers_none | 227 | null | |
pytest-dev/pytest-xdist | from __future__ import annotations
import os
import re
import shutil
from typing import cast
import pytest
import xdist
def test_config_initialization(
pytester: pytest.Pytester, monkeypatch: pytest.MonkeyPatch
) -> None:
"""Ensure workers and controller are initialized consistently. Integration test for #4... | 0 | assert | numeric_literal | testing/acceptance_test.py | test_config_initialization | 635 | null | |
pytest-dev/pytest-xdist | from __future__ import annotations
import marshal
import pprint
from queue import Queue
import sys
from typing import Any
from typing import Callable
from typing import cast
from typing import Union
import uuid
import execnet
import pytest
from xdist.workermanage import NodeManager
from xdist.workermanage import Wor... | "call" | assert | string_literal | testing/test_remote.py | test_basic_collect_and_runtests | TestWorkerInteractor | 136 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
import marshal
import pprint
from queue import Queue
import sys
from typing import Any
from typing import Callable
from typing import cast
from typing import Union
import uuid
import execnet
import pytest
from xdist.workermanage import NodeManager
from xdist.workermanage import Wor... | when | assert | variable | testing/test_remote.py | test_steal_work | TestWorkerInteractor | 289 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
from pathlib import Path
import shutil
import textwrap
import warnings
import execnet
import pytest
from util import generate_warning
from xdist import workermanage
from xdist._path import visit_path
from xdist.remote import serialize_warning_message
from xdist.workermanage import ... | v2 | assert | variable | testing/test_workermanage.py | test_unserialize_warning_msg | 448 | null | |
pytest-dev/pytest-xdist | from contextlib import suppress
import os
from pathlib import Path
import sys
import execnet
import pytest
from xdist.workermanage import NodeManager
def monkeypatch_3_cpus(monkeypatch: pytest.MonkeyPatch) -> None:
"""Make pytest-xdist believe the system has 3 CPUs."""
# block overrides from Python 3.13 and ... | 0 | assert | numeric_literal | testing/test_plugin.py | test_dist_incompatibility_messages | 27 | null | |
pytest-dev/pytest-xdist | from __future__ import annotations
import collections
from collections.abc import Generator
from collections.abc import Iterable
from collections.abc import Sequence
import contextlib
import enum
import os
import sys
import time
from typing import Any
from typing import Literal
from typing import TypedDict
from typing... | report.nodeid | assert | complex_expr | src/xdist/remote.py | pytest_runtest_logreport | WorkerInteractor | 288 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
import pathlib
from pathlib import Path
import shutil
import tempfile
import textwrap
import unittest.mock
import pytest
from xdist.looponfail import RemoteControl
from xdist.looponfail import StatRecorder
class TestLooponFailing:
def test_looponfail_from_one_to_two_tests(sel... | remotecontrol.failures[0] | assert | complex_expr | testing/test_looponfail.py | test_looponfail_from_one_to_two_tests | TestLooponFailing | 268 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
from collections.abc import Sequence
from typing import NamedTuple
import pytest
from xdist.remote import Producer
from xdist.report import report_collection_diff
from xdist.workermanage import parse_tx_spec_config
from xdist.workermanage import WorkerController
class WorkStealing... | self.steal_requested_from_node | assert | complex_expr | src/xdist/scheduler/worksteal.py | remove_pending_tests_from_node | WorkStealingScheduling | 186 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
from pathlib import Path
import shutil
import textwrap
import warnings
import execnet
import pytest
from util import generate_warning
from xdist import workermanage
from xdist._path import visit_path
from xdist.remote import serialize_warning_message
from xdist.workermanage import ... | 2 | assert | numeric_literal | testing/test_workermanage.py | test_popen_makegateway_events | TestNodeManagerPopen | 83 | null |
pytest-dev/pytest-xdist | from contextlib import suppress
import os
from pathlib import Path
import sys
import execnet
import pytest
from xdist.workermanage import NodeManager
def monkeypatch_3_cpus(monkeypatch: pytest.MonkeyPatch) -> None:
"""Make pytest-xdist believe the system has 3 CPUs."""
# block overrides from Python 3.13 and ... | 8 | assert | numeric_literal | testing/test_plugin.py | test_hook_auto_num_workers_arg | 201 | null | |
pytest-dev/pytest-xdist | from contextlib import suppress
import os
from pathlib import Path
import sys
import execnet
import pytest
from xdist.workermanage import NodeManager
def monkeypatch_3_cpus(monkeypatch: pytest.MonkeyPatch) -> None:
"""Make pytest-xdist believe the system has 3 CPUs."""
# block overrides from Python 3.13 and ... | 7 | assert | numeric_literal | testing/test_plugin.py | test_envvar_auto_num_workers | 239 | null | |
pytest-dev/pytest-xdist | from __future__ import annotations
from collections.abc import Sequence
from itertools import cycle
import pytest
from xdist.remote import Producer
from xdist.report import report_collection_diff
from xdist.workermanage import parse_tx_spec_config
from xdist.workermanage import WorkerController
class LoadScheduling... | self.node2pending | assert | complex_expr | src/xdist/scheduler/load.py | add_node | LoadScheduling | 124 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
from pathlib import Path
import shutil
import textwrap
import warnings
import execnet
import pytest
from util import generate_warning
from xdist import workermanage
from xdist._path import visit_path
from xdist.remote import serialize_warning_message
from xdist.workermanage import ... | "gw0" | assert | string_literal | testing/test_workermanage.py | test_popen_makegateway_events | TestNodeManagerPopen | 87 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
import collections
from collections.abc import Generator
from collections.abc import Iterable
from collections.abc import Sequence
import contextlib
import enum
import os
import sys
import time
from typing import Any
from typing import Literal
from typing import TypedDict
from typing... | None | assert | none_literal | src/xdist/remote.py | run_one_test | WorkerInteractor | 221 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
from pathlib import Path
import shutil
import textwrap
import warnings
import execnet
import pytest
from util import generate_warning
from xdist import workermanage
from xdist._path import visit_path
from xdist.remote import serialize_warning_message
from xdist.workermanage import ... | out | assert | variable | testing/test_workermanage.py | test_rsync_report | TestNodeManager | 268 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
from pathlib import Path
import shutil
import textwrap
import warnings
import execnet
import pytest
from util import generate_warning
from xdist import workermanage
from xdist._path import visit_path
from xdist.remote import serialize_warning_message
from xdist.workermanage import ... | source | assert | variable | testing/test_workermanage.py | test_rsync_same_popen_twice | TestNodeManagerPopen | 158 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
from pathlib import Path
import shutil
import textwrap
import warnings
import execnet
import pytest
from util import generate_warning
from xdist import workermanage
from xdist._path import visit_path
from xdist.remote import serialize_warning_message
from xdist.workermanage import ... | 1 | assert | numeric_literal | testing/test_workermanage.py | test_unserialize_warning_msg | 432 | null | |
pytest-dev/pytest-xdist | from __future__ import annotations
from collections.abc import Sequence
from enum import auto
from enum import Enum
from queue import Empty
from queue import Queue
import sys
from typing import Any
import warnings
import execnet
import pytest
from xdist.remote import Producer
from xdist.remote import WorkerInfo
from... | None | assert | none_literal | src/xdist/dsession.py | pytest_runtestloop | DSession | 133 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
import os
import re
import shutil
from typing import cast
import pytest
import xdist
@pytest.mark.xfail(reason="works if run outside test suite", run=False)
def test_session_hooks(pytester: pytest.Pytester) -> None:
pytester.makeconftest(
"""
import sys
... | 1 | assert | numeric_literal | testing/acceptance_test.py | test_session_hooks | 562 | null | |
pytest-dev/pytest-xdist | from __future__ import annotations
import marshal
import pprint
from queue import Queue
import sys
from typing import Any
from typing import Callable
from typing import cast
from typing import Union
import uuid
import execnet
import pytest
from xdist.workermanage import NodeManager
from xdist.workermanage import Wor... | 1 | assert | numeric_literal | testing/test_remote.py | test_remote_usage_prog | 411 | null | |
pytest-dev/pytest-xdist | from __future__ import annotations
import marshal
import pprint
from queue import Queue
import sys
from typing import Any
from typing import Callable
from typing import cast
from typing import Union
import uuid
import execnet
import pytest
from xdist.workermanage import NodeManager
from xdist.workermanage import Wor... | ev.kwargs | assert | complex_expr | testing/test_remote.py | test_basic_collect_and_runtests | TestWorkerInteractor | 138 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
from collections.abc import Sequence
from typing import Any
from typing import cast
from typing import TYPE_CHECKING
import execnet
import pytest
from xdist.dsession import DSession
from xdist.dsession import get_default_max_worker_restart
from xdist.dsession import get_workers_sta... | [0] | assert | collection | testing/test_dsession.py | test_schedule_load_simple | TestLoadScheduling | 123 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
from pathlib import Path
import shutil
import textwrap
import warnings
import execnet
import pytest
from util import generate_warning
from xdist import workermanage
from xdist._path import visit_path
from xdist.remote import serialize_warning_message
from xdist.workermanage import ... | type(v2) | assert | func_call | testing/test_workermanage.py | test_unserialize_warning_msg | 445 | null | |
pytest-dev/pytest-xdist | from __future__ import annotations
from collections.abc import Sequence
from typing import NamedTuple
import pytest
from xdist.remote import Producer
from xdist.report import report_collection_diff
from xdist.workermanage import parse_tx_spec_config
from xdist.workermanage import WorkerController
class WorkStealing... | None | assert | none_literal | src/xdist/scheduler/worksteal.py | mark_test_pending | WorkStealingScheduling | 170 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
import pathlib
from pathlib import Path
import shutil
import tempfile
import textwrap
import unittest.mock
import pytest
from xdist.looponfail import RemoteControl
from xdist.looponfail import StatRecorder
class TestLooponFailing:
def test_looponfail_from_one_to_two_tests(sel... | 0 | assert | numeric_literal | testing/test_looponfail.py | test_looponfail_from_one_to_two_tests | TestLooponFailing | 282 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
import os
import re
import shutil
from typing import cast
import pytest
import xdist
class TestDistribution:
def test_exitfirst_waits_for_workers_to_finish(
self, pytester: pytest.Pytester
) -> None:
"""The DSession waits for workers before exiting early o... | 2 | assert | numeric_literal | testing/acceptance_test.py | test_exitfirst_waits_for_workers_to_finish | TestDistribution | 144 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
from pathlib import Path
import shutil
import textwrap
import warnings
import execnet
import pytest
from util import generate_warning
from xdist import workermanage
from xdist._path import visit_path
from xdist.remote import serialize_warning_message
from xdist.workermanage import ... | None | assert | none_literal | testing/test_workermanage.py | test_popen_no_default_chdir | TestNodeManagerPopen | 65 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
from collections import OrderedDict
from collections.abc import Sequence
from typing import NoReturn
import pytest
from xdist.remote import Producer
from xdist.report import report_collection_diff
from xdist.workermanage import parse_tx_spec_config
from xdist.workermanage import Wo... | self.assigned_work | assert | complex_expr | src/xdist/scheduler/loadscope.py | add_node | LoadScopeScheduling | 163 | null |
pytest-dev/pytest-xdist | from __future__ import annotations
from collections.abc import Sequence
from typing import Any
from typing import cast
from typing import TYPE_CHECKING
import execnet
import pytest
from xdist.dsession import DSession
from xdist.dsession import get_default_max_worker_restart
from xdist.dsession import get_workers_sta... | 1 | assert | numeric_literal | testing/test_dsession.py | test_default_max_worker_restart | 522 | null | |
pytest-dev/pytest-xdist | from __future__ import annotations
from collections.abc import Sequence
from typing import Any
from typing import cast
from typing import TYPE_CHECKING
import execnet
import pytest
from xdist.dsession import DSession
from xdist.dsession import get_default_max_worker_restart
from xdist.dsession import get_workers_sta... | [] | assert | collection | testing/test_dsession.py | test_schedule_fewer_tests_than_nodes | TestLoadScheduling | 225 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.