Skip to content

Commit

Permalink
test: fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-eschle committed Nov 9, 2024
1 parent 5ef1bc4 commit 0971dd4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
python-version: "3.9"
- os: macos-13
python-version: "3.9"
- os: macos-14
- os: macos-latest
python-version: "3.12" # old versions not supported
name: Check Python ${{ matrix.python-version }} ${{ matrix.os }}
steps:
Expand Down
10 changes: 6 additions & 4 deletions tests/modeling/test_bayesianblocks.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import os
from pathlib import Path

import numpy as np

import hepstats
from hepstats.modeling import bayesian_blocks

answer_dir = os.path.dirname(hepstats.__file__) + "/../../tests/modeling/data"
answer_dir = Path(hepstats.__file__) / "data"


def test_bayesian_blocks(cmdopt, data_gen):
Expand All @@ -12,10 +14,10 @@ def test_bayesian_blocks(cmdopt, data_gen):
be3 = bayesian_blocks(data_gen[0], weights=data_gen[2])

if cmdopt == "generate":
with open(answer_dir + "/answers_bayesian_blocks.npz", "wb") as f:
with open(answer_dir / "answers_bayesian_blocks.npz", "wb") as f:
np.savez(f, be1=be1, be2=be2, be3=be3)
elif cmdopt == "test":
answers = np.load(answer_dir + "/answers_bayesian_blocks.npz")
answers = np.load(answer_dir / "answers_bayesian_blocks.npz")
assert np.all(be1 == answers["be1"])
assert np.all(be2 == answers["be2"])
assert np.all(be3 == answers["be3"])
Expand Down

0 comments on commit 0971dd4

Please sign in to comment.