Spaces:
Running
Running
Upload 2 files
Browse files- tests/__init__.py +1 -0
- tests/test_metrics.py +21 -0
tests/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"""GTROX tests."""
|
tests/test_metrics.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import unittest
|
| 2 |
+
|
| 3 |
+
from gtrox.metrics import calculate_metrics, count_fillers, count_repetitions
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class MetricsTests(unittest.TestCase):
|
| 7 |
+
def test_counts_multiword_fillers_and_repetitions(self):
|
| 8 |
+
transcript = "Um, I I actually like this, you know."
|
| 9 |
+
|
| 10 |
+
self.assertEqual(count_fillers(transcript), 4)
|
| 11 |
+
self.assertEqual(count_repetitions(transcript), 1)
|
| 12 |
+
|
| 13 |
+
def test_calculates_duration_based_metrics(self):
|
| 14 |
+
metrics = calculate_metrics("One two three four", duration_seconds=2)
|
| 15 |
+
|
| 16 |
+
self.assertEqual(metrics["total_words"], 4)
|
| 17 |
+
self.assertEqual(metrics["wpm"], 120.0)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
if __name__ == "__main__":
|
| 21 |
+
unittest.main()
|