Skip to content

Version 0.11.13 #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ jobs:
pytest:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
python-version: [ '3.9', '3.10', '3.11', '3.12' ] # , '3.13'
dep-versions: [ '' ] # 'numpy1'
Expand Down
26 changes: 24 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import pytest
import pytest_benchmark
import pytest_benchmark.plugin
from pytest_benchmark.utils import NameWrapper
from pytest_benchmark.fixture import BenchmarkFixture
import numpy as np
from numpy.testing import assert_equal
import xplt.util
Expand All @@ -8,8 +11,27 @@
@pytest.fixture(scope="function")
def benchmark_ref(request):
# See https://github.com/ionelmc/pytest-benchmark/issues/166
bm = pytest_benchmark.plugin.benchmark.__pytest_wrapped__.obj(request)
return next(bm) if hasattr(bm, "__next__") else bm
# code below is a copy of `pytest_benchmark.plugin.benchmark` fixture
bs = request.config._benchmarksession

if bs.skip:
pytest.skip("Benchmarks are skipped (--benchmark-skip was used).")
else:
node = request.node
marker = node.get_closest_marker("benchmark")
options = dict(marker.kwargs) if marker else {}
if "timer" in options:
options["timer"] = NameWrapper(options["timer"])
fixture = BenchmarkFixture(
node,
add_stats=bs.benchmarks.append,
logger=bs.logger,
warner=request.node.warn,
disabled=bs.disabled,
**dict(bs.options, **options),
)
request.addfinalizer(fixture._cleanup)
return fixture


@pytest.mark.parametrize(
Expand Down
2 changes: 1 addition & 1 deletion xplt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
__contact__ = "eltos@outlook.de"


__version__ = "0.11.12"
__version__ = "0.11.13"


# expose the following in global namespace
Expand Down
6 changes: 3 additions & 3 deletions xplt/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,9 @@ def ang(a):
RT - ARC / 2 + HELICITY * np.pi / 2
) # angle between plot x-axis and radial vector of bending

LENGTH = get(survey, "length", np.zeros_like(NAME))
IS_THICK = get(survey, "isthick", np.zeros_like(NAME))
ORDER = get(survey, "order", -np.ones_like(NAME))
LENGTH = get(survey, "length", np.zeros(len(NAME)))
IS_THICK = get(survey, "isthick", np.zeros(len(NAME), "bool"))
ORDER = get(survey, "order", -np.ones(len(NAME), "int"))
if (TYPE := get(survey, "element_type", None)) is not None:
# map element type to order when order is not in survey
for type, o in {
Expand Down