Skip to content

Commit

Permalink
test: adapt and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dcfidalgo committed May 26, 2022
1 parent 3700326 commit 483e3b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 6 additions & 1 deletion tests/client/sdk/token_classification/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ def test_query_schema(helpers):


@pytest.mark.parametrize(
"prediction,expected", [([("label", 0, 4)], 1.0), ([("label", 0, 4, 0.5)], 0.5)]
"prediction,expected",
[
([("label", 0, 4)], 0.0),
([("label", 0, 4, None)], 0.0),
([("label", 0, 4, 0.5)], 0.5),
],
)
def test_from_client_prediction(prediction, expected):
record = TokenClassificationRecord(
Expand Down
7 changes: 4 additions & 3 deletions tests/client/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,12 @@ def test_token_classification_with_mutation():
"prediction,expected",
[
(None, None),
([("mock", 0, 4)], [("mock", 0, 4, 1.0)]),
([("mock", 0, 4)], [("mock", 0, 4, 0.0)]),
([("mock", 0, 4, 0.5)], [("mock", 0, 4, 0.5)]),
([("mock", 0, 4, None)], [("mock", 0, 4, 0.0)]),
(
[("mock", 0, 4), ("mock", 0, 4, 0.5)],
[("mock", 0, 4, 1.0), ("mock", 0, 4, 0.5)],
[("mock", 0, 4), ("mock", 0, 4, None), ("mock", 0, 4, 0.5)],
[("mock", 0, 4, 0.0), ("mock", 0, 4, 0.0), ("mock", 0, 4, 0.5)],
),
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def test_log_record_that_makes_me_cry(mocked_client):
"chars_length": 6,
"density": 0.03225806451612903,
"label": "ENG",
"score": 1.0,
"score": 0.0,
"tokens_length": 1,
"value": "access",
}
Expand Down

0 comments on commit 483e3b8

Please sign in to comment.