def test_token(self): line = "some words in a line" token = Token(5, 10, line) self.assertEqual(token.value(), "words") self.assertEqual(token.fromIndex(), 5) self.assertEqual(token.toIndex(), 10) self.assertEqual(token.count(), 5) self.assertTrue(5 in token) self.assertTrue(9 in token) self.assertTrue(not 10 in token)
def test_empty_token(self): token = Token(4, 4, "text") self.assertEqual(token.value(), "")