CanLex / tests /test_synonyms.py
Beemer
Add IRPA delegation instruments, R. v. Carignan, and retrieval polish
589d46e
raw
history blame contribute delete
907 Bytes
"""Unit tests for legal-abbreviation query expansion (canlex/synonyms.py)."""
import unittest
from canlex.synonyms import expand_query
class ExpandQueryTests(unittest.TestCase):
def test_keeps_the_original_query(self):
self.assertTrue(
expand_query("PRRA eligibility").startswith("PRRA eligibility"))
def test_expands_a_known_abbreviation(self):
# 'PRRA' should pull in the statutory wording the Act actually uses.
self.assertIn("application for protection",
expand_query("PRRA eligibility"))
def test_case_insensitive(self):
self.assertIn("humanitarian and compassionate",
expand_query("an H&C application"))
def test_unknown_query_is_unchanged(self):
q = "what are the standard hours of work"
self.assertEqual(expand_query(q), q)
if __name__ == "__main__":
unittest.main()