Skip to content

Commit 615c527

Browse files
committed
add unit tests
1 parent 5aada0f commit 615c527

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import pytest
2+
3+
from wpodnet import Prediction
4+
5+
6+
class TestPrediction:
7+
def test_validation(self):
8+
# Valid
9+
Prediction(bounds=[(1, 2), (3, 4), (5, 6), (7, 8)], confidence=0.95)
10+
11+
# Invalid bounds length
12+
with pytest.raises(ValueError):
13+
Prediction(bounds=[(1, 2), (3, 4), (5, 6)], confidence=0.95)
14+
15+
# Invalid confidence value
16+
with pytest.raises(ValueError):
17+
Prediction(bounds=[(1, 2), (3, 4), (5, 6), (7, 8)], confidence=1.01)

wpodnet/backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from .model import WPODNet
1010

1111

12-
@dataclass
12+
@dataclass(frozen=True)
1313
class Prediction:
1414
"""
1515
The prediction result from WPODNet.

0 commit comments

Comments
 (0)