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 |
|---|---|---|---|---|---|---|---|---|---|
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from uuid import uuid4
from homeassistant import config_entries
from homeassistant.components import dhcp
from homeassistant.config_entries import ConfigEntry, ConfigEntryState, ConfigFlowResult
from homeassistant.data_entry_flow import FlowResultType
from pytest_homeas... | "device" | assert | string_literal | tests/test_config_flow.py | test_dhcp_discovery_config_flow | 328 | null | |
krahabb/meross_lan | from homeassistant.components import number as haec
from custom_components.meross_lan.cover import MLRollerShutterConfigNumber
from custom_components.meross_lan.devices.garagedoor import (
MLGarageConfigNumber,
MLGarageMultipleConfigNumber,
)
from custom_components.meross_lan.devices.hub import (
HubSensor... | entity.available | assert | complex_expr | tests/entities/number.py | async_test_each_callback | EntityTest | 108 | null |
krahabb/meross_lan | import datetime as dt
import typing
from zoneinfo import ZoneInfo
from homeassistant.const import STATE_UNAVAILABLE
import homeassistant.util.dt as dt_util
import pytest
from pytest_homeassistant_custom_component.components.recorder.common import (
async_wait_recording_done,
)
from custom_components.meross_lan im... | None | assert | none_literal | tests/test_consumption.py | _configure_dates | 61 | null | |
krahabb/meross_lan | from homeassistant.components import cover as haec
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.cover import MLCover, MLRollerShutter
from custom_components.meross_lan.devices.garagedoor import MLGarage
from custom_components.meross_lan.merossclient.protocol import (
cons... | haec.CoverState.OPENING | assert | complex_expr | tests/entities/cover.py | async_test_enabled_callback | EntityTest | 94 | null |
krahabb/meross_lan | import asyncio
import base64
from collections import namedtuple
import contextlib
from copy import deepcopy
from datetime import UTC, datetime, timedelta
import hashlib
import logging
import re
import time
from typing import TYPE_CHECKING
from unittest.mock import ANY, MagicMock, patch
import aiohttp
from freezegun.ap... | 0 | assert | numeric_literal | tests/helpers.py | _v1_device_devlist | CloudApiMocker | 1,015 | null |
krahabb/meross_lan | import datetime as dt
import typing
from zoneinfo import ZoneInfo
from homeassistant.const import STATE_UNAVAILABLE
import homeassistant.util.dt as dt_util
import pytest
from pytest_homeassistant_custom_component.components.recorder.common import (
async_wait_recording_done,
)
from custom_components.meross_lan im... | 60 | assert | numeric_literal | tests/test_consumption.py | _async_configure_context | 83 | null | |
krahabb/meross_lan | from typing import TYPE_CHECKING
from homeassistant.core import HomeAssistant, StateMachine
from homeassistant.helpers import entity
from custom_components.meross_lan.merossclient.protocol import const as mc
from custom_components.meross_lan.switch import MLToggleX
from tests.helpers import DeviceContext
class Enti... | expected_state | assert | variable | tests/entities/__init__.py | async_service_call_check | EntityComponentTest | 83 | null |
krahabb/meross_lan | from typing import TYPE_CHECKING
from unittest import mock
from homeassistant.helpers import device_registry as dr
from pytest_homeassistant_custom_component.common import flush_store
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.helpers.meross_profile import MerossProfile
fr... | safe_start_calls) | assert_* | variable | tests/test_meross_profile.py | test_meross_profile_cloudapi_offline | 143 | null | |
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from homeassistant.data_entry_flow import FlowResultType
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.diagnostics import async_get_device_diagnostics
from custom_components.meross_lan.merossclient.protocol import const as mc
f... | FlowResultType.CREATE_ENTRY | assert | complex_expr | tests/test_diagnostics.py | _async_configure_options_tracing | 38 | null | |
krahabb/meross_lan | from homeassistant.components.calendar import CalendarEntity
from custom_components.meross_lan.calendar import MtsSchedule
from custom_components.meross_lan.devices.hub.mts100 import Mts100Climate
from custom_components.meross_lan.devices.thermostat.mts200 import Mts200Climate
from custom_components.meross_lan.devices... | 6 | assert | numeric_literal | tests/entities/calendar.py | async_test_each_callback | EntityTest | 39 | null |
krahabb/meross_lan | from homeassistant.components import cover as haec
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.cover import MLCover, MLRollerShutter
from custom_components.meross_lan.devices.garagedoor import MLGarage
from custom_components.meross_lan.merossclient.protocol import (
cons... | _transition_end_unsub.when() | assert | func_call | tests/entities/cover.py | _async_test_set_position | EntityTest | 192 | null |
krahabb/meross_lan | import asyncio
import base64
from collections import namedtuple
import contextlib
from copy import deepcopy
from datetime import UTC, datetime, timedelta
import hashlib
import logging
import re
import time
from typing import TYPE_CHECKING
from unittest.mock import ANY, MagicMock, patch
import aiohttp
from freezegun.ap... | self.config_entry.data.keys() | assert | func_call | tests/helpers.py | async_test_config_entry_diagnostics | ConfigEntryMocker | 552 | null |
krahabb/meross_lan | from homeassistant import const as hac
from homeassistant.components import light as haec
from homeassistant.components.light import ColorMode, LightEntity, LightEntityFeature
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.devices.diffuser import MLDiffuserLight
from custom_com... | supported_features | assert | variable | tests/entities/light.py | async_test_each_callback | EntityTest | 57 | null |
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from uuid import uuid4
from homeassistant import config_entries
from homeassistant.components import dhcp
from homeassistant.config_entries import ConfigEntry, ConfigEntryState, ConfigFlowResult
from homeassistant.data_entry_flow import FlowResultType
from pytest_homeas... | None | assert | none_literal | tests/test_config_flow.py | test_mqtt_discovery_config_flow | 279 | null | |
krahabb/meross_lan | from homeassistant.components import climate as haec
from homeassistant.components.climate import ClimateEntity, HVACMode
from custom_components.meross_lan.climate import MtsClimate
from custom_components.meross_lan.devices.hub.mts100 import Mts100Climate
from custom_components.meross_lan.devices.thermostat.mts200 imp... | entity_hvac_modes | assert | variable | tests/entities/climate.py | async_test_each_callback | EntityTest | 73 | null |
krahabb/meross_lan | from homeassistant import const as hac
from homeassistant.components import light as haec
from homeassistant.components.light import ColorMode, LightEntity, LightEntityFeature
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.devices.diffuser import MLDiffuserLight
from custom_com... | MLLightEffect | assert | variable | tests/entities/light.py | async_test_each_callback | EntityTest | 78 | null |
krahabb/meross_lan | from homeassistant.components import cover as haec
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.cover import MLCover, MLRollerShutter
from custom_components.meross_lan.devices.garagedoor import MLGarage
from custom_components.meross_lan.merossclient.protocol import (
cons... | expected_state | assert | variable | tests/entities/cover.py | _async_test_set_position | EntityTest | 154 | null |
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from homeassistant.data_entry_flow import FlowResultType
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.diagnostics import async_get_device_diagnostics
from custom_components.meross_lan.merossclient.protocol import const as mc
f... | mlc.CONF_TRACE_VERSION | assert | complex_expr | tests/test_diagnostics.py | test_device_diagnostics | 104 | null | |
krahabb/meross_lan | from homeassistant.components import climate as haec
from homeassistant.components.climate import ClimateEntity, HVACMode
from custom_components.meross_lan.climate import MtsClimate
from custom_components.meross_lan.devices.hub.mts100 import Mts100Climate
from custom_components.meross_lan.devices.thermostat.mts200 imp... | entity.max_temp | assert | complex_expr | tests/entities/climate.py | async_test_enabled_callback | EntityTest | 129 | null |
krahabb/meross_lan | from homeassistant.components import media_player as haec # HA EntityComponent
from custom_components.meross_lan.media_player import MLMp3Player
from custom_components.meross_lan.merossclient.protocol import (
const as mc,
namespaces as mn,
)
from tests.entities import EntityComponentTest
class EntityTest(E... | round(0.1 * 16) / 16 | assert | func_call | tests/entities/media_player.py | async_test_enabled_callback | EntityTest | 55 | null |
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from homeassistant import const as hac
from homeassistant.config_entries import ConfigEntryState
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.helpers.component_api import ComponentApi
from custom_components.meross_lan.light imp... | 1) | assert_* | numeric_literal | tests/test_config_entry.py | test_mqtthub_entry_notready | 53 | null | |
krahabb/meross_lan | from time import time
import typing
from pytest_homeassistant_custom_component.common import async_fire_mqtt_message
from custom_components.meross_lan.merossclient import json_dumps
from custom_components.meross_lan.merossclient.protocol import (
const as mc,
namespaces as mn,
)
from custom_components.meross_... | helpers.MessageMatcher( header=helpers.DictMatcher( { mc.KEY_MESSAGEID: message_bind_set[mc.KEY_HEADER][ mc.KEY_MESSAGEID ], mc.KEY_NAMESPACE: mn.Appliance_Control_Bind.name, mc.KEY_METHOD: mc.METHOD_SETACK, mc.KEY_TRIGGERSRC: mc.HEADER_TRIGGERSRC_CLOUDCONTROL, mc.KEY_FROM: topic_publish, } ) )) | assert_* | func_call | tests/test_merossapi.py | test_hamqtt_device_session | 56 | null | |
krahabb/meross_lan | import asyncio
import base64
from collections import namedtuple
import contextlib
from copy import deepcopy
from datetime import UTC, datetime, timedelta
import hashlib
import logging
import re
import time
from typing import TYPE_CHECKING
from unittest.mock import ANY, MagicMock, patch
import aiohttp
from freezegun.ap... | None | assert | none_literal | tests/helpers.py | warp | TimeMocker | 324 | null |
krahabb/meross_lan | import asyncio
import base64
from collections import namedtuple
import contextlib
from copy import deepcopy
from datetime import UTC, datetime, timedelta
import hashlib
import logging
import re
import time
from typing import TYPE_CHECKING
from unittest.mock import ANY, MagicMock, patch
import aiohttp
from freezegun.ap... | data | assert | variable | tests/helpers.py | _validate_request_payload | CloudApiMocker | 945 | null |
krahabb/meross_lan | from homeassistant.components import climate as haec
from homeassistant.components.climate import ClimateEntity, HVACMode
from custom_components.meross_lan.climate import MtsClimate
from custom_components.meross_lan.devices.hub.mts100 import Mts100Climate
from custom_components.meross_lan.devices.thermostat.mts200 imp... | entity_preset_modes | assert | variable | tests/entities/climate.py | async_test_each_callback | EntityTest | 82 | null |
krahabb/meross_lan | from homeassistant.components import number as haec
from custom_components.meross_lan.cover import MLRollerShutterConfigNumber
from custom_components.meross_lan.devices.garagedoor import (
MLGarageConfigNumber,
MLGarageMultipleConfigNumber,
)
from custom_components.meross_lan.devices.hub import (
HubSensor... | MLEmulatedSwitch | assert | variable | tests/entities/number.py | async_test_each_callback | EntityTest | 117 | null |
krahabb/meross_lan | from homeassistant import const as hac
from homeassistant.components import light as haec
from homeassistant.components.light import ColorMode, LightEntity, LightEntityFeature
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.devices.diffuser import MLDiffuserLight
from custom_com... | MLLightMp3 | assert | variable | tests/entities/light.py | async_test_each_callback | EntityTest | 82 | null |
krahabb/meross_lan | import datetime as dt
import typing
from zoneinfo import ZoneInfo
from homeassistant.const import STATE_UNAVAILABLE
import homeassistant.util.dt as dt_util
import pytest
from pytest_homeassistant_custom_component.components.recorder.common import (
async_wait_recording_done,
)
from custom_components.meross_lan im... | sensor_electricity.native_value | assert | complex_expr | tests/test_consumption.py | _check_energy_states | 149 | null | |
krahabb/meross_lan | from homeassistant.components import cover as haec
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.cover import MLCover, MLRollerShutter
from custom_components.meross_lan.devices.garagedoor import MLGarage
from custom_components.meross_lan.merossclient.protocol import (
cons... | target_position | assert | variable | tests/entities/cover.py | _async_test_set_position | EntityTest | 211 | null |
krahabb/meross_lan | import asyncio
import base64
from collections import namedtuple
import contextlib
from copy import deepcopy
from datetime import UTC, datetime, timedelta
import hashlib
import logging
import re
import time
from typing import TYPE_CHECKING
from unittest.mock import ANY, MagicMock, patch
import aiohttp
from freezegun.ap... | menu_step_id | assert | variable | tests/helpers.py | async_assert_flow_menu_to_step | 111 | null | |
krahabb/meross_lan | from homeassistant.components import number as haec
from custom_components.meross_lan.cover import MLRollerShutterConfigNumber
from custom_components.meross_lan.devices.garagedoor import (
MLGarageConfigNumber,
MLGarageMultipleConfigNumber,
)
from custom_components.meross_lan.devices.hub import (
HubSensor... | entity.min_value | assert | complex_expr | tests/entities/number.py | async_test_enabled_callback | EntityTest | 141 | null |
krahabb/meross_lan | from homeassistant.components import cover as haec
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.cover import MLCover, MLRollerShutter
from custom_components.meross_lan.devices.garagedoor import MLGarage
from custom_components.meross_lan.merossclient.protocol import (
cons... | RollerShutterMixin.SIGNALOPEN | assert | complex_expr | tests/entities/cover.py | async_test_each_callback | EntityTest | 60 | null |
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from uuid import uuid4
from homeassistant import config_entries
from homeassistant.components import dhcp
from homeassistant.config_entries import ConfigEntry, ConfigEntryState, ConfigFlowResult
from homeassistant.data_entry_flow import FlowResultType
from pytest_homeas... | 2 | assert | numeric_literal | tests/test_config_flow.py | test_profile_config_flow | 143 | null | |
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from uuid import uuid4
from homeassistant import config_entries
from homeassistant.components import dhcp
from homeassistant.config_entries import ConfigEntry, ConfigEntryState, ConfigFlowResult
from homeassistant.data_entry_flow import FlowResultType
from pytest_homeas... | 1 | assert | numeric_literal | tests/test_config_flow.py | test_profile_config_flow | 134 | null | |
krahabb/meross_lan | from typing import TYPE_CHECKING
from unittest import mock
from homeassistant.helpers import device_registry as dr
from pytest_homeassistant_custom_component.common import flush_store
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.helpers.meross_profile import MerossProfile
fr... | 2 | assert | numeric_literal | tests/test_meross_profile.py | test_meross_profile | 48 | null | |
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from uuid import uuid4
from homeassistant import config_entries
from homeassistant.components import dhcp
from homeassistant.config_entries import ConfigEntry, ConfigEntryState, ConfigFlowResult
from homeassistant.data_entry_flow import FlowResultType
from pytest_homeas... | emulator.key | assert | complex_expr | tests/test_config_flow.py | test_device_config_flow | 86 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
@pytest.mark.skip("Fails point data consistency check.")
@pytest.mark.parametrize(
"filename, ref_sum, ref_num_cells", [("elephav.obj", 3.678372172450000e05, 1148)]
)
def test_reference_file(filename, ref_sum, ref_num_cells):
... | "triangle" | assert | string_literal | tests/test_obj.py | test_reference_file | 40 | null | |
nschloe/meshio | ],
[("quad", [[0, 1, 4, 5], [1, 2, 3, 4]])],
)
d = 0.1
quad8_mesh = meshio.Mesh(
[
[0.0, 0.0, 0.0],
[1.0, 0.0, 0.0],
[1.0, 1.0, 0.0],
[0.0, 1.0, 0.0],
[0.5, d, 0.0],
[1 - d, 0.5, 0.0],
[0.5, 1 - d, 0.0],
[d, 0.5, 0.0],
[2.0, 0.0, 0.0],... | c1.data.shape | assert | complex_expr | tests/helpers.py | write_read | 681 | null | |
nschloe/meshio | import logging
import numpy as np
vtk_to_meshio_type = {
0: "empty",
1: "vertex",
# 2: 'poly_vertex',
3: "line",
# 4: 'poly_line',
5: "triangle",
# 6: 'triangle_strip',
7: "polygon",
# 8: 'pixel',
9: "quad",
10: "tetra",
# 11: 'voxel',
12: "hexahedron",
13: "wed... | len(mesh.cells[key]) | assert | func_call | tests/legacy_writer.py | write | 97 | null | |
nschloe/meshio | import pathlib
from functools import partial
import numpy as np
import pytest
import meshio
from . import helpers
test_set = {
# helpers.empty_mesh,
helpers.line_mesh,
helpers.tri_mesh_2d,
helpers.tri_mesh,
helpers.tri_mesh_one_cell,
helpers.triangle6_mesh,
helpers.quad_mesh,
helpers... | 1 | assert | numeric_literal | tests/test_vtk.py | test_structured | 101 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
test_set = [
# helpers.empty_mesh,
helpers.line_mesh,
helpers.tri_mesh,
helpers.tri_mesh_one_cell,
helpers.triangle6_mesh,
helpers.quad_mesh,
helpers.quad8_mesh,
helpers.tri_quad_mesh,
helpers.pol... | ref_num_cells | assert | variable | tests/test_vtu.py | test_read_from_file | 79 | null | |
nschloe/meshio | import numpy as np
from meshio import Mesh
from meshio.vtk_io import vtk_to_meshio_type
def read(filetype, filename):
import vtk
from vtk.util import numpy as numpy_support
def _read_data(data):
"""Extract numpy arrays from a VTK data set."""
# Go through all arrays, fetch data.
o... | 1 | assert | numeric_literal | tests/legacy_reader.py | _read_exodusii_mesh | 171 | null | |
nschloe/meshio | import pathlib
from functools import partial
import numpy as np
import pytest
import meshio
from . import helpers
test_set = {
# helpers.empty_mesh,
helpers.line_mesh,
helpers.tri_mesh_2d,
helpers.tri_mesh,
helpers.tri_mesh_one_cell,
helpers.triangle6_mesh,
helpers.quad_mesh,
helpers... | tol * ref_sum | assert | complex_expr | tests/test_vtk.py | test_reference_file | 76 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
@pytest.mark.parametrize(
"filename, ref_sum, ref_num_cells",
[("simple.wkt", 4, 2), ("whitespaced.wkt", 3.2, 2)],
)
def test_reference_file(filename, ref_sum, ref_num_cells):
this_dir = pathlib.Path(__file__).resolve().... | ref_num_cells | assert | variable | tests/test_wkt.py | test_reference_file | 37 | null | |
nschloe/meshio | import pathlib
from functools import partial
import numpy as np
import pytest
import meshio
from . import helpers
test_set = {
# helpers.empty_mesh,
helpers.line_mesh,
helpers.tri_mesh_2d,
helpers.tri_mesh,
helpers.tri_mesh_one_cell,
helpers.triangle6_mesh,
helpers.quad_mesh,
helpers... | ref_num_points | assert | variable | tests/test_vtk.py | test_color_scalars | 120 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
test_set = [
# helpers.empty_mesh,
helpers.line_mesh,
helpers.tri_mesh,
helpers.tri_mesh_one_cell,
helpers.triangle6_mesh,
helpers.quad_mesh,
helpers.quad8_mesh,
helpers.tri_quad_mesh,
helpers.pol... | mesh.cells[0].type | assert | complex_expr | tests/test_vtu.py | test_read_from_file | 78 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
h5py = pytest.importorskip("h5py")
def test_reference_file_with_mixed_cells(tmp_path):
this_dir = pathlib.Path(__file__).resolve().parent
filename = this_dir / "meshes" / "med" / "cylinder.med"
mesh = meshio.read(filena... | ref_cell_tags_info | assert | variable | tests/test_med.py | test_reference_file_with_mixed_cells | 86 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
this_dir = pathlib.Path(__file__).resolve().parent
def _tet_volume(cell):
"""
Evaluate the volume of a tetrahedron using the value
of the deteminant
| a_x a_y a_z 1 |
| b_x b_y b_z 1 |
| c_x c_y c_z 1 |
... | (6, 5) | assert | collection | tests/test_ugrid.py | test_volume | 187 | null | |
nschloe/meshio | import copy
import numpy as np
import pytest
from numpy.testing import assert_equal
import meshio
from . import helpers
def test_sets_to_int_data():
mesh = helpers.tri_mesh_5
mesh = helpers.add_point_sets(mesh)
mesh = helpers.add_cell_sets(mesh)
mesh.point_sets_to_data()
mesh.cell_sets_to_data(... | {} | assert | collection | tests/test_mesh.py | test_sets_to_int_data | 36 | null | |
nschloe/meshio | import copy
import pathlib
from functools import partial
import numpy as np
import pytest
import meshio
from . import helpers
def gmsh_periodic():
mesh = copy.deepcopy(helpers.quad_mesh)
trns = [0] * 16 # just for io testing
mesh.gmsh_periodic = [
[0, (3, 1), None, [[2, 0]]],
[0, (4, 6)... | tol * ref_sum | assert | complex_expr | tests/test_gmsh.py | test_reference_file | 133 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
@pytest.mark.parametrize(
"filename, ref_sum, ref_num_cells",
[("simple.wkt", 4, 2), ("whitespaced.wkt", 3.2, 2)],
)
def test_reference_file(filename, ref_sum, ref_num_cells):
this_dir = pathlib.Path(__file__).resolve().... | "triangle" | assert | string_literal | tests/test_wkt.py | test_reference_file | 36 | null | |
nschloe/meshio | import copy
import numpy as np
import pytest
from numpy.testing import assert_equal
import meshio
from . import helpers
def test_int_data_to_sets():
mesh = helpers.tri_mesh
mesh.cell_data = {"grain0-grain1": [np.array([0, 1])]}
mesh.cell_data_to_sets("grain0-grain1")
assert_equal(mesh.cell_sets, | {"grain0": [[0]], "grain1": [[1]]}) | assert_* | collection | tests/test_mesh.py | test_int_data_to_sets | 81 | null | |
nschloe/meshio | import copy
import pathlib
from functools import partial
import numpy as np
import pytest
import meshio
from . import helpers
def gmsh_periodic():
mesh = copy.deepcopy(helpers.quad_mesh)
trns = [0] * 16 # just for io testing
mesh.gmsh_periodic = [
[0, (3, 1), None, [[2, 0]]],
[0, (4, 6)... | ref_num_cells_in_cell_sets | assert | variable | tests/test_gmsh.py | test_reference_file_with_entities | 179 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
test_set = [
# helpers.empty_mesh,
helpers.line_mesh,
helpers.tri_mesh,
helpers.tri_mesh_one_cell,
helpers.triangle6_mesh,
helpers.quad_mesh,
helpers.quad8_mesh,
helpers.tri_quad_mesh,
helpers.pol... | ref_num_pnt | assert | variable | tests/test_vtu.py | test_read_from_file | 80 | null | |
nschloe/meshio | [("quad", [[0, 1, 4, 5], [1, 2, 3, 4]])],
)
d = 0.1
quad8_mesh = meshio.Mesh(
[
[0.0, 0.0, 0.0],
[1.0, 0.0, 0.0],
[1.0, 1.0, 0.0],
[0.0, 1.0, 0.0],
[0.5, d, 0.0],
[1 - d, 0.5, 0.0],
[0.5, 1 - d, 0.0],
[d, 0.5, 0.0],
[2.0, 0.0, 0.0],
... | c1.data.dtype | assert | complex_expr | tests/helpers.py | write_read | 682 | null | |
nschloe/meshio | import logging
import numpy as np
vtk_to_meshio_type = {
0: "empty",
1: "vertex",
# 2: 'poly_vertex',
3: "line",
# 4: 'poly_line',
5: "triangle",
# 6: 'triangle_strip',
7: "polygon",
# 8: 'pixel',
9: "quad",
10: "tetra",
# 11: 'voxel',
12: "hexahedron",
13: "wed... | mesh.cells | assert | complex_expr | tests/legacy_writer.py | write | 95 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
test_set = [
# helpers.empty_mesh,
helpers.line_mesh,
helpers.tri_mesh,
helpers.tri_mesh_one_cell,
helpers.triangle6_mesh,
helpers.quad_mesh,
helpers.quad8_mesh,
helpers.tri_quad_mesh,
helpers.pol... | 1 | assert | numeric_literal | tests/test_vtu.py | test_read_from_file | 77 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
h5py = pytest.importorskip("h5py")
def test_reference_file_with_mixed_cells(tmp_path):
this_dir = pathlib.Path(__file__).resolve().parent
filename = this_dir / "meshes" / "med" / "cylinder.med"
mesh = meshio.read(filena... | 52 | assert | numeric_literal | tests/test_med.py | test_reference_file_with_mixed_cells | 62 | null | |
nschloe/meshio | import pathlib
from functools import partial
import numpy as np
import pytest
import meshio
from . import helpers
test_set = {
# helpers.empty_mesh,
helpers.line_mesh,
helpers.tri_mesh_2d,
helpers.tri_mesh,
helpers.tri_mesh_one_cell,
helpers.triangle6_mesh,
helpers.quad_mesh,
helpers... | ref_num_pnt | assert | variable | tests/test_vtk.py | test_structured | 104 | null | |
nschloe/meshio | [1.0, 0.0, 0.0],
[2.0, 0.0, 0.0],
[3.0, 1.0, 0.0],
[2.0, 1.0, 0.0],
[1.0, 1.0, 0.0],
[0.0, 1.0, 0.0],
],
[
("triangle", [[0, 1, 5], [0, 5, 6]]),
("quad", [[1, 2, 4, 5]]),
("triangle", [[2, 3, 4]]),
],
)
quad_tri_mesh = meshio.Mesh(
... | cells1.type | assert | complex_expr | tests/helpers.py | write_read | 708 | null | |
nschloe/meshio | import copy
import numpy as np
import pytest
from numpy.testing import assert_equal
import meshio
from . import helpers
def test_gh_1165():
mesh = meshio.Mesh(
[[0.0, 0.0], [1.0, 0.0], [0.0, 1.0], [1.0, 1.0]],
{
"triangle": [[0, 1, 2], [1, 2, 3]],
"line": [[0, 1], [0, 2],... | {"test": [[], [1]], "sets": [[0, 1], [0, 2, 3]]}) | assert_* | collection | tests/test_mesh.py | test_gh_1165 | 100 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
@pytest.mark.skip("Fails point data consistency check.")
@pytest.mark.parametrize(
"filename, ref_sum, ref_num_cells", [("elephav.obj", 3.678372172450000e05, 1148)]
)
def test_reference_file(filename, ref_sum, ref_num_cells):
... | ref_num_cells | assert | variable | tests/test_obj.py | test_reference_file | 41 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
@pytest.mark.parametrize("filename, ref_sum, ref_num_cells", [("simple1", 20, 4)])
def test_reference_file(filename, ref_sum, ref_num_cells):
this_dir = pathlib.Path(__file__).resolve().parent
filename = this_dir / "meshes" ... | ref_num_cells | assert | variable | tests/test_neuroglancer.py | test_reference_file | 35 | null | |
nschloe/meshio | import io
import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
def test(mesh, tmp_path):
helpers.write_read(
tmp_path, meshio.nastran.write, meshio.nastran.read, mesh, 1.0e-13
)
def test_long_format():
filename = io.StringIO(
"BEGIN BULK\n"
"GRID* ... | 1 | assert | numeric_literal | tests/test_nastran.py | test_long_format | 68 | null | |
nschloe/meshio | import copy
import pathlib
from functools import partial
import numpy as np
import pytest
import meshio
from . import helpers
def gmsh_periodic():
mesh = copy.deepcopy(helpers.quad_mesh)
trns = [0] * 16 # just for io testing
mesh.gmsh_periodic = [
[0, (3, 1), None, [[2, 0]]],
[0, (4, 6)... | ref_num_cells | assert | variable | tests/test_gmsh.py | test_reference_file | 135 | null | |
nschloe/meshio | import pathlib
import pytest
import meshio
from . import helpers
test_set = [
# helpers.empty_mesh,
helpers.tet_mesh
]
def test(mesh, tmp_path):
helpers.write_read(
tmp_path,
meshio.tetgen.write,
meshio.tetgen.read,
mesh,
1.0e-15,
extension=".node",
)... | point_ref_sum | assert | variable | tests/test_tetgen.py | test_point_cell_refs | 35 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
this_dir = pathlib.Path(__file__).resolve().parent
@pytest.mark.parametrize(
"filename, ref_num_points, ref_num_triangle, ref_num_quad, ref_num_wedge, ref_num_tet, ref_num_hex, ref_tag_counts",
[
(
"sphe... | None | assert | none_literal | tests/test_ugrid.py | test_reference_file | 103 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
h5py = pytest.importorskip("h5py")
def test_reference_file_with_mixed_cells(tmp_path):
this_dir = pathlib.Path(__file__).resolve().parent
filename = this_dir / "meshes" / "med" / "cylinder.med"
mesh = meshio.read(filena... | ref_num_cells | assert | variable | tests/test_med.py | test_reference_file_with_mixed_cells | 57 | null | |
nschloe/meshio | import copy
import pathlib
from functools import partial
import numpy as np
import pytest
import meshio
from . import helpers
def gmsh_periodic():
mesh = copy.deepcopy(helpers.quad_mesh)
trns = [0] * 16 # just for io testing
mesh.gmsh_periodic = [
[0, (3, 1), None, [[2, 0]]],
[0, (4, 6)... | ["line", "triangle"] | assert | collection | tests/test_gmsh.py | test_reference_file | 134 | null | |
nschloe/meshio | [0.0, 1.0],
],
[("triangle", [[0, 1, 5], [0, 5, 6], [1, 2, 5], [2, 4, 5], [2, 3, 4]])],
)
tri_mesh = meshio.Mesh(
[[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [1.0, 1.0, 0.0], [0.0, 1.0, 0.0]],
[("triangle", [[0, 1, 2], [0, 2, 3]])],
)
line_tri_mesh = meshio.Mesh(line_mesh.points, line_mesh.cells + tri_... | 1 | assert | numeric_literal | tests/helpers.py | add_cell_sets | 645 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
h5py = pytest.importorskip("h5py")
def test_reference_file_with_point_cell_data(tmp_path):
this_dir = pathlib.Path(__file__).resolve().parent
filename = this_dir / "meshes" / "med" / "box.med"
mesh = meshio.read(filena... | (1, 8, 1) | assert | collection | tests/test_med.py | test_reference_file_with_point_cell_data | 127 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
@pytest.mark.parametrize(
"filename, ref_sum, ref_num_cells",
[("simple.wkt", 4, 2), ("whitespaced.wkt", 3.2, 2)],
)
def test_reference_file(filename, ref_sum, ref_num_cells):
this_dir = pathlib.Path(__file__).resolve().... | tol * abs(ref_sum) | assert | func_call | tests/test_wkt.py | test_reference_file | 35 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
this_dir = pathlib.Path(__file__).resolve().parent
def _tet_volume(cell):
"""
Evaluate the volume of a tetrahedron using the value
of the deteminant
| a_x a_y a_z 1 |
| b_x b_y b_z 1 |
| c_x c_y c_z 1 |
... | "pyramid" | assert | string_literal | tests/test_ugrid.py | test_volume | 186 | null | |
nschloe/meshio | import logging
import numpy as np
vtk_to_meshio_type = {
0: "empty",
1: "vertex",
# 2: 'poly_vertex',
3: "line",
# 4: 'poly_line',
5: "triangle",
# 6: 'triangle_strip',
7: "polygon",
# 8: 'pixel',
9: "quad",
10: "tetra",
# 11: 'voxel',
12: "hexahedron",
13: "wed... | "exodus" | assert | string_literal | tests/legacy_writer.py | _get_writer | 73 | null | |
nschloe/meshio | import pathlib
from functools import partial
import numpy as np
import pytest
import meshio
from . import helpers
test_set = {
# helpers.empty_mesh,
helpers.line_mesh,
helpers.tri_mesh_2d,
helpers.tri_mesh,
helpers.tri_mesh_one_cell,
helpers.triangle6_mesh,
helpers.quad_mesh,
helpers... | ref_num_cells | assert | variable | tests/test_vtk.py | test_reference_file | 78 | null | |
nschloe/meshio | import numpy as np
import meshio
from . import helpers
def is_same_mesh(mesh0, mesh1, atol):
if not np.allclose(mesh0.points, mesh1.points, atol=atol, rtol=0.0):
return False
for cells0, cells1 in zip(mesh0.cells, mesh1.cells):
if cells0.type != cells1.type or not np.allclose(cells0.data, cel... | cells1.type | assert | complex_expr | tests/test_cli.py | test_convert | 49 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
test_set = [
# helpers.empty_mesh,
helpers.tri_mesh_2d,
helpers.tet_mesh,
helpers.hex_mesh,
]
this_dir = pathlib.Path(__file__).resolve().parent
def test(mesh, tmp_path):
helpers.write_read(tmp_path, meshio.su2.... | ref_num_unique_tags + 1 | assert | complex_expr | tests/test_su2.py | test_structured | 44 | null | |
nschloe/meshio | import pathlib
from functools import partial
import numpy as np
import pytest
import meshio
from . import helpers
test_set = {
# helpers.empty_mesh,
helpers.line_mesh,
helpers.tri_mesh_2d,
helpers.tri_mesh,
helpers.tri_mesh_one_cell,
helpers.triangle6_mesh,
helpers.quad_mesh,
helpers... | mesh.cells[0].type | assert | complex_expr | tests/test_vtk.py | test_structured | 102 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
def test(mesh, tmp_path):
helpers.write_read(tmp_path, meshio.abaqus.write, meshio.abaqus.read, mesh, 1.0e-15)
@pytest.mark.parametrize(
"filename, ref_sum, ref_num_cells, ref_num_cell_sets",
[
("UUea.inp", 4950... | ref_num_cell_sets | assert | variable | tests/test_abaqus.py | test_reference_file | 47 | null | |
nschloe/meshio | import pathlib
import pytest
import meshio
from . import helpers
test_set = [
# helpers.empty_mesh,
helpers.tet_mesh
]
def test(mesh, tmp_path):
helpers.write_read(
tmp_path,
meshio.tetgen.write,
meshio.tetgen.read,
mesh,
1.0e-15,
extension=".node",
)... | cell_ref_sum | assert | variable | tests/test_tetgen.py | test_point_cell_refs | 36 | null | |
nschloe/meshio | import logging
import numpy as np
vtk_to_meshio_type = {
0: "empty",
1: "vertex",
# 2: 'poly_vertex',
3: "line",
# 4: 'poly_line',
5: "triangle",
# 6: 'triangle_strip',
7: "polygon",
# 8: 'pixel',
9: "quad",
10: "tetra",
# 11: 'voxel',
12: "hexahedron",
13: "wed... | len(mesh.points) | assert | func_call | tests/legacy_writer.py | write | 92 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
@pytest.mark.skip("Fails point data consistency check.")
@pytest.mark.parametrize(
"filename, ref_sum, ref_num_cells", [("elephav.obj", 3.678372172450000e05, 1148)]
)
def test_reference_file(filename, ref_sum, ref_num_cells):
... | tol * abs(ref_sum) | assert | func_call | tests/test_obj.py | test_reference_file | 39 | null | |
nschloe/meshio | [0.0, 1.0, 0.0],
],
[("quad", [[0, 1, 4, 5], [1, 2, 3, 4]])],
)
d = 0.1
quad8_mesh = meshio.Mesh(
[
[0.0, 0.0, 0.0],
[1.0, 0.0, 0.0],
[1.0, 1.0, 0.0],
[0.0, 1.0, 0.0],
[0.5, d, 0.0],
[1 - d, 0.5, 0.0],
[0.5, 1 - d, 0.0],
[d, 0.5, 0.0],... | c1.type | assert | complex_expr | tests/helpers.py | write_read | 680 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
@pytest.mark.parametrize(
"filename, ref_num_points, ref_num_triangle, ref_num_quad, ref_num_wedge, ref_num_tet, ref_num_hex, ref_tag_counts",
[
(
"sphere_mixed.1.meshb",
3270,
864... | 3 | assert | numeric_literal | tests/test_medit.py | test_reference_file | 75 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
def test(mesh, tmp_path):
helpers.write_read(tmp_path, meshio.abaqus.write, meshio.abaqus.read, mesh, 1.0e-15)
def test_elset(tmp_path):
points = np.array(
[[1.0, 0.0, 0.0], [1.0, 1.0, 0.0], [2.0, 0.5, 0.0], [0.0, 0... | sorted(mesh.cell_sets.keys()) | assert | func_call | tests/test_abaqus.py | test_elset | 75 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
test_set = [
# helpers.empty_mesh,
helpers.tri_mesh_2d,
helpers.tet_mesh,
helpers.hex_mesh,
]
this_dir = pathlib.Path(__file__).resolve().parent
def test(mesh, tmp_path):
helpers.write_read(tmp_path, meshio.su2.... | ref_num_cells | assert | variable | tests/test_su2.py | test_structured | 35 | null | |
nschloe/meshio | [1.0, 0.0, 0.0],
[1.0, 1.0, 0.0],
[0.0, 1.0, 0.0],
[0.5, d, 0.0],
[1 - d, 0.5, 0.0],
[0.5, 1 - d, 0.0],
[d, 0.5, 0.0],
[2.0, 0.0, 0.0],
[2.0, 1.0, 0.0],
[1.5, -d, 0.0],
[2 + d, 0.5, 0.0],
[1.5, 1 + d, 0.0],
],
[("qua... | 0 | assert | numeric_literal | tests/helpers.py | write_read | 689 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
def test(mesh, binary, tmp_path):
# mesh.write("out.f3grid")
helpers.write_read(
tmp_path,
lambda f, m: meshio.flac3d.write(f, m, binary=binary),
meshio.flac3d.read,
mesh,
1.0e-15,
... | [12, 12, 12, 12, 12] | assert | collection | tests/test_flac3d.py | test_reference_file | 67 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
def test(mesh, tmp_path):
helpers.write_read(tmp_path, meshio.abaqus.write, meshio.abaqus.read, mesh, 1.0e-15)
def test_elset(tmp_path):
points = np.array(
[[1.0, 0.0, 0.0], [1.0, 1.0, 0.0], [2.0, 0.5, 0.0], [0.0, 0... | len(mesh.cells) | assert | func_call | tests/test_abaqus.py | test_elset | 70 | null | |
nschloe/meshio | import copy
import numpy as np
import pytest
from numpy.testing import assert_equal
import meshio
from . import helpers
def test_cells_dict():
mesh = copy.deepcopy(helpers.tri_mesh)
assert len(mesh.cells_dict) == 1
assert np.array_equal(mesh.cells_dict["triangle"], [[0, 1, 2], [0, 2, 3]])
# two cel... | {"triangle": [[0, 1, 2], [0, 2, 3]]}) | assert_* | collection | tests/test_mesh.py | test_cells_dict | 24 | null | |
nschloe/meshio | import copy
import numpy as np
import pytest
from numpy.testing import assert_equal
import meshio
from . import helpers
def test_cells_dict():
mesh = copy.deepcopy(helpers.tri_mesh)
assert len(mesh.cells_dict) == | 1 | assert | numeric_literal | tests/test_mesh.py | test_cells_dict | 14 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
test_set = [
# helpers.empty_mesh,
helpers.tri_mesh_2d,
helpers.tet_mesh,
helpers.hex_mesh,
]
this_dir = pathlib.Path(__file__).resolve().parent
def test(mesh, tmp_path):
helpers.write_read(tmp_path, meshio.su2.... | ref_num_points | assert | variable | tests/test_su2.py | test_structured | 36 | null | |
nschloe/meshio | import numpy as np
import pytest
import meshio
from . import helpers
test_set_full = [
helpers.empty_mesh,
helpers.line_mesh,
helpers.tri_mesh,
helpers.line_tri_mesh,
helpers.tri_mesh_2d,
helpers.triangle6_mesh,
helpers.quad_mesh,
helpers.quad8_mesh,
helpers.tri_quad_mesh,
hel... | 1.0e-12 | assert | numeric_literal | tests/test_xdmf.py | test_time_series | 89 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
@pytest.mark.parametrize("filename, ref_sum, ref_num_cells", [("simple1", 20, 4)])
def test_reference_file(filename, ref_sum, ref_num_cells):
this_dir = pathlib.Path(__file__).resolve().parent
filename = this_dir / "meshes" ... | tol * abs(ref_sum) | assert | func_call | tests/test_neuroglancer.py | test_reference_file | 34 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
@pytest.mark.parametrize(
"filename, ref_num_points, ref_num_triangle, ref_num_quad, ref_num_wedge, ref_num_tet, ref_num_hex, ref_tag_counts",
[
(
"sphere_mixed.1.meshb",
3270,
864... | None | assert | none_literal | tests/test_medit.py | test_reference_file | 95 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
def test(mesh, binary, tmp_path):
# mesh.write("out.f3grid")
helpers.write_read(
tmp_path,
lambda f, m: meshio.flac3d.write(f, m, binary=binary),
meshio.flac3d.read,
mesh,
1.0e-15,
... | ref_num_cells | assert | variable | tests/test_flac3d.py | test_reference_file | 61 | null | |
nschloe/meshio | import logging
import numpy as np
vtk_to_meshio_type = {
0: "empty",
1: "vertex",
# 2: 'poly_vertex',
3: "line",
# 4: 'poly_line',
5: "triangle",
# 6: 'triangle_strip',
7: "polygon",
# 8: 'pixel',
9: "quad",
10: "tetra",
# 11: 'voxel',
12: "hexahedron",
13: "wed... | mesh.cell_data[cell_type] | assert | complex_expr | tests/legacy_writer.py | write | 134 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
test_set = [
# helpers.empty_mesh,
helpers.tri_mesh_2d,
helpers.tet_mesh,
helpers.hex_mesh,
]
this_dir = pathlib.Path(__file__).resolve().parent
def test(mesh, tmp_path):
helpers.write_read(tmp_path, meshio.su2.... | sum_tags | assert | variable | tests/test_su2.py | test_structured | 40 | null | |
nschloe/meshio | import pathlib
import numpy as np
import pytest
import meshio
from . import helpers
def test(mesh, binary, tmp_path):
# mesh.write("out.f3grid")
helpers.write_read(
tmp_path,
lambda f, m: meshio.flac3d.write(f, m, binary=binary),
meshio.flac3d.read,
mesh,
1.0e-15,
... | 12 | assert | numeric_literal | tests/test_flac3d.py | test_reference_file | 66 | null | |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from importlib import reload
from django.contrib.auth import get_user_model
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from rest_framework_simplejwt import authentication
from rest_framework_simplejwt.exceptions import AuthenticationFailed, Invali... | TokenUser) | self.assertIsInstance | variable | tests/test_authentication.py | test_get_user | TestJWTStatelessUserAuthentication | 256 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.