Example #1
0
 def testQueryListReturnsNoneForNoMatches(self):
     repository = Repository("fakedir")
     theList = ["foo", "bar", "biz", "bat"]
     self.assertEquals(None, repository._queryList("bilbo", theList))
Example #2
0
 def testScoreNameIncreasesByOneForPartialMatches(self):
     repository = Repository("fakedir")
     masterList = [[0, "bil"], [1, "billbo"], [2, "BILbiz"], [3, "BILBO"]]
     repository._scoreName("bi", masterList)
     self.assertEquals([4, "BILBO"], masterList[3])
Example #3
0
 def testScoreNameNotIncreaseOnBlankMatch(self):
     repository = Repository("fakedir")
     masterList = [[0, "bil"], [1, "billbo"], [2, "BILbiz"], [3, "BILBO"]]
     repository._scoreName("", masterList)
     self.assertEquals([3, "BILBO"], masterList[3])
Example #4
0
 def testQueryListReturnsBestMatch(self):
     repository = Repository("fakedir")
     theList = ["bil", "billbo", "BILbiz", "BILBO"]
     self.assertEquals("BILBO", repository._queryList("bilbo", theList))