Esempio n. 1
0
 def test_contains_overlap_same_before(self):
     word1 = "xxxxxxx"
     start1 = 2
     word2 = "xxxxxxx"
     start2 = 0
     w1 = robustness.WordFound(word1, start1)
     w2 = robustness.WordFound(word2, start2)
     result = w1.contains(w2)
     self.assertTrue(result)
Esempio n. 2
0
 def test_contains_overlap_longer_after(self):
     word1 = "xxxxxxx"
     start1 = 0
     word2 = "xxxxxxxxxx"
     start2 = 2
     w1 = robustness.WordFound(word1, start1)
     w2 = robustness.WordFound(word2, start2)
     result = w1.contains(w2)
     self.assertFalse(result)
Esempio n. 3
0
 def test_contains_contain(self):
     word1 = "xxxxxxx"
     start1 = 2
     word2 = "xxx"
     start2 = 5
     w1 = robustness.WordFound(word1, start1)
     w2 = robustness.WordFound(word2, start2)
     result = w1.contains(w2)
     self.assertTrue(
         result, "Word 2 is contained in word 1 but this was not detected")
Esempio n. 4
0
 def test_repr(self):
     word = "quenTin"
     start = 2
     w = robustness.WordFound(word, start)
     result = str(w)
     self.assertEqual(
         result, "'quenTin' (Start:2, End:9)",
         "Representation does not match what was there before")
Esempio n. 5
0
 def test_init_mixedcase(self):
     word = "QuENTIN"
     start = 2
     w = robustness.WordFound(word, start)
     self.assertEqual(w.word, "QuENTIN", "Word stored incorrectly")
     self.assertTrue(w.hasLowercase, "Lowercase detection is wrong")
     self.assertTrue(w.hasUppercase, "Uppercase detection is wrong")
     self.assertEqual(w.start, 2, "Start index is wrong")
     self.assertEqual(w.end, 9, "End index is wrong")
Esempio n. 6
0
 def test_init_startnegative(self):
     word = "quentin"
     start = -2
     with self.assertRaises(Exception):
         robustness.WordFound(word, start)
Esempio n. 7
0
 def test_init_wordempty(self):
     word = ""
     start = 2
     with self.assertRaises(Exception):
         robustness.WordFound(word, start)