コード例 #1
0
 def test_to_obj_with_tagged_BasicWord_in_sentence(self):
     paragraph = Paragraph([
         Sentence([
             BasicWord('x', Tags([tag for tag in WordTag])),
             BasicWord('y')
         ])
     ])
     as_dict = Serializer.to_dict(paragraph)
     self.assertEqual(Serializer.to_obj(as_dict), paragraph)
コード例 #2
0
 def test_to_dict_and_back_with_all_word_types_in_multiple_sentences(self):
     paragraph = Paragraph([
         Sentence([
             Verb('go').past_tense().capitalize().bold(),
             Noun.uncountable_noun('water'), Punctuation.PERIOD
         ]),
         Sentence([
             BasicWord.preposition('a'), Pronoun.I, CapitalPronoun.ME,
             BeVerb.AM,
             Punctuation.COMMA.bold()
         ])
     ])
     as_dict = Serializer.to_dict(paragraph)
     as_obj = Serializer.to_obj(as_dict)
     self.assertEqual(as_obj, paragraph)
コード例 #3
0
 def test_to_obj_with_tags(self):
     tag_list = [tag for tag in StatusTag]
     paragraph = Paragraph([], Tags(tag_list))
     as_dict = Serializer.to_dict(paragraph)
     self.assertEqual(Serializer.to_obj(as_dict), paragraph)
コード例 #4
0
 def test_to_obj_with_empty_sentence(self):
     paragraph = Paragraph([Sentence()])
     as_dict = Serializer.to_dict(paragraph)
     self.assertEqual(Serializer.to_obj(as_dict), paragraph)
コード例 #5
0
 def test_to_obj_with_BeVerb_in_sentence(self):
     paragraph = Paragraph([Sentence([pronoun for pronoun in BeVerb])])
     as_dict = Serializer.to_dict(paragraph)
     self.assertEqual(Serializer.to_obj(as_dict), paragraph)
コード例 #6
0
 def test_to_obj_with_tagless_Verb_in_sentence(self):
     paragraph = Paragraph([Sentence([Verb('x'), Verb('y')])])
     as_dict = Serializer.to_dict(paragraph)
     self.assertEqual(Serializer.to_obj(as_dict), paragraph)