Skip to content

Commit 4789316

Browse files
authored
added test workflow and fixed failing test (#237)
* added test workflow and fixed failing test * 4 decimal places
1 parent 102cabe commit 4789316

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

.github/workflows/test.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches: [ $default-branch ]
6+
pull_request:
7+
branches: [ $default-branch ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: ["3.8", "3.9", "3.10"]
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v3
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
cache: 'pip' # caching pip dependencies
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
python -m pip install flake8 pytest
29+
python -m pip install -e .
30+
- name: Lint with flake8
31+
run: |
32+
# stop the build if there are Python syntax errors or undefined names
33+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
34+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
35+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
36+
- name: Test with pytest
37+
run: |
38+
pytest

tests/test_scheduler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,8 @@ def test_full_loop_no_noise(self):
567567
result_sum = torch.sum(torch.abs(sample))
568568
result_mean = torch.mean(torch.abs(sample))
569569

570-
assert abs(result_sum.item() - 199.1169) < 1e-2
571-
assert abs(result_mean.item() - 0.2593) < 1e-3
570+
assert abs(result_sum.item() - 428.8788) < 1e-2
571+
assert abs(result_mean.item() - 0.5584) < 1e-3
572572

573573

574574
class ScoreSdeVeSchedulerTest(unittest.TestCase):

0 commit comments

Comments
 (0)