Package translate :: Package search :: Module test_terminology

[hide private]
[frames] | no frames]

# Source Code for Module translate.search.test_terminology

     1  from translate.search import terminology
     2
     3 -class TestTerminology:
     4      """Test terminology matching"""
     5 -    def test_basic(self):
     6          """Tests basic functionality"""
     7          termmatcher = terminology.TerminologyComparer()
     8          assert termmatcher.similarity("Open the file", "file") > 75
     9
    10 -    def test_brackets(self):
    11          """Tests that brackets at the end of a term are ignored"""
    12          termmatcher = terminology.TerminologyComparer()
    13          assert termmatcher.similarity("Open file", "file (noun)") > 75
    14          assert termmatcher.similarity("Contact your ISP", "ISP (Internet Service Provider)") > 75
    15
    16 -    def test_past_tences(self):
    17          """Tests matching of some past tenses"""
    18          termmatcher = terminology.TerminologyComparer()
    19          assert termmatcher.similarity("The bug was submitted", "submit") > 75
    20          assert termmatcher.similarity("The site is certified", "certify") > 75
    21
    22 -    def test_space_mismatch(self):
    23          """Tests that we can match with some spacing mismatch"""
    24          termmatcher = terminology.TerminologyComparer()
    25          assert termmatcher.similarity("%d minutes downtime", "down time") > 75
    26
    27 -    def test_hyphen_mismatch(self):
    28          """Tests that we can match with some spacing mismatch"""
    29          termmatcher = terminology.TerminologyComparer()
    30          assert termmatcher.similarity("You can preorder", "pre-order") > 75
    31          assert termmatcher.similarity("You can pre-order", "pre order") > 75
    32          assert termmatcher.similarity("You can preorder", "pre order") > 75
    33          assert termmatcher.similarity("You can pre order", "pre-order") > 75
    34