def setUp(self):
     sentence = Sample("sample")
     self.first = Token("one", "Une")
     sentence.append(self.first)
     self.second = Token("two", "phrase")
     sentence.append(self.second)
     self.third = Token("three", "simple")
     sentence.append(self.third)
Example #2
0
 def setUp(self):
     sentence = Sample("sample")
     self.first = Token("one", "Une")
     sentence.append(self.first)
     self.second = Token("two", "phrase")
     sentence.append(self.second)
     self.third = Token("three", "simple")
     sentence.append(self.third)
Example #3
0
 def test_should_append_token_and_update_its_position(self):
     sample = Sample("xxx")
     token = Token("yyy", original="bla")
     sample.append(token)
     self.assertIn(token, sample)
     self.assertEqual(token.parent, sample)
     other_token = Token("zzz", original="bleh")
     sample.append(other_token)
     self.assertIn(other_token, sample)
     self.assertEqual(other_token.parent, sample)
     self.assertEqual(other_token.position, 1)
Example #4
0
 def test_should_raise_if_item_not_a_token(self):
     sample = Sample("xxx")
     self.assertRaises(ValueError, sample.append, "bla")
Example #5
0
 def test_should_create_a_sample(self):
     sample = Sample("xxx")
     self.assertTrue(isinstance(sample, Sample))