-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from nstelter-slac/simple_test_and_actions
TST: Add simple test of some fit-functions and file to run in github actions
- Loading branch information
Showing
3 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Run Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install pytest | ||
pip install numpy | ||
pip install scipy | ||
pip install statsmodels | ||
- name: Run tests | ||
run: | | ||
pytest testFitFunctions.py # Replace with your actual test file name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
# beamtime-calibration-suite | ||
# beamtime-calibration-suite | ||
[![Build Status](https://github.com/slaclab/beamtime-calibration-suite/actions/workflows/run-tests.yml/badge.svg?branch=master)](https://github.com/slaclab/beamtime-calibration-suite/actions/workflows/run-tests.yml) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import numpy as np | ||
import pytest | ||
from fitFunctions import linear, saturatedLinear | ||
|
||
@pytest.mark.parametrize("a, b, expected", [(2, 3, np.array([5, 7, 9, 11, 13]))]) | ||
def test_linear(a, b, expected): | ||
x = np.array([1, 2, 3, 4, 5]) | ||
result = linear(x, a, b) | ||
np.testing.assert_array_equal(result, expected) | ||
|
||
@pytest.mark.parametrize("a, b, c, d, expected", [(2, 3, 4, 10, np.array([5, 7, 9, 10, 10]))]) | ||
def test_saturatedLinear(a, b, c, d, expected): | ||
x = np.array([1, 2, 3, 4, 5]) | ||
result = saturatedLinear(x, a, b, c, d) | ||
np.testing.assert_array_equal(result, expected) |