Skip to content

Commit

Permalink
Add/Fix: Add basic meteor test to try to solve issue #9 and fix picka…
Browse files Browse the repository at this point in the history
…ble assert name.
  • Loading branch information
Labbeti committed Nov 8, 2023
1 parent 8300f62 commit c32c5b1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions tests/test_meteor_err.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import unittest

from unittest import TestCase

from aac_metrics.functional.meteor import meteor


class TestCompare(TestCase):
def test_example_1(self) -> None:
cands = ["many green trees are in two sides of a curved green river."]
mrefs = [
[
"many green trees are in two sides of a curved green river .",
"many green trees are in two sides of a curved green river .",
"many green trees are in two sides of a curved green river .",
"many green trees are in two sides of a curved green river .",
"many green trees are in two sides of a curved green river .",
]
]
meteor_outs_corpus, _ = meteor(cands, mrefs)
score = meteor_outs_corpus["meteor"].item() # type: ignore
self.assertEqual(score, 1.0)


if __name__ == "__main__":
unittest.main()
2 changes: 1 addition & 1 deletion tests/test_pickable.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_pickle_dump(self) -> None:
try:
pickle.dumps(metric)
except pickle.PicklingError:
self.assert_(False, f"Cannot pickle {metric.__class__.__name__}.")
self.assertTrue(False, f"Cannot pickle {metric.__class__.__name__}.")


if __name__ == "__main__":
Expand Down

0 comments on commit c32c5b1

Please sign in to comment.