예제 #1
0
    def test_assign_objects_one_object_particle(self):
        verb_group = VerbGroup(verb=Verb('pick'),
                               preposition=None,
                               objects=1,
                               particle=BasicWord.particle('up'))
        self.assertEqual(
            assign_objects(verb_group, [IT]),
            [Verb('pick'), IT, BasicWord.particle('up')])

        self.assertEqual(
            assign_objects(verb_group, [Noun('dog')]),
            [Verb('pick'), BasicWord.particle('up'),
             Noun('dog')])
예제 #2
0
    def test_assign_objects_one_object_preposition(self):
        verb_group = VerbGroup(verb=Verb('play'),
                               preposition=BasicWord.preposition('with'),
                               objects=1,
                               particle=None)
        self.assertEqual(
            assign_objects(verb_group, [IT]),
            [Verb('play'), BasicWord.preposition('with'), IT])

        self.assertEqual(
            assign_objects(verb_group, [Noun('dog')]),
            [Verb('play'),
             BasicWord.preposition('with'),
             Noun('dog')])
예제 #3
0
    def test_assign_objects_no_objects_particle_or_preposition(self):
        verb_group = VerbGroup(verb=Verb('chill'),
                               preposition=BasicWord.preposition('out'),
                               objects=0,
                               particle=None)
        self.assertEqual(
            assign_objects(verb_group, []),
            [Verb('chill'), BasicWord.preposition('out')])

        verb_group = VerbGroup(verb=Verb('run'),
                               preposition=None,
                               objects=0,
                               particle=BasicWord.particle('away'))
        self.assertEqual(assign_objects(verb_group, []),
                         [Verb('run'), BasicWord.particle('away')])
예제 #4
0
    def test_assign_objects_two_objects_preposition(self):
        verb_group = VerbGroup(verb=Verb('bring'),
                               preposition=BasicWord.preposition('to'),
                               objects=2,
                               particle=None)
        self.assertEqual(assign_objects(verb_group, [HIM, IT]),
                         [Verb('bring'), HIM,
                          BasicWord.preposition('to'), IT])

        self.assertEqual(
            assign_objects(verb_group, [Noun('cat'), Noun('dog')]), [
                Verb('bring'),
                Noun('cat'),
                BasicWord.preposition('to'),
                Noun('dog')
            ])
예제 #5
0
 def test_assign_objects_one_object_no_particle_no_preposition(self):
     verb_group = VerbGroup(verb=Verb('like'),
                            preposition=None,
                            objects=1,
                            particle=None)
     self.assertEqual(assign_objects(verb_group, [Noun('dog')]),
                      [Verb('like'), Noun('dog')])
예제 #6
0
 def test_assign_objects_two_objects_no_particle_no_preposition(self):
     verb_group = VerbGroup(verb=Verb('show'),
                            preposition=None,
                            objects=2,
                            particle=None)
     self.assertEqual(
         assign_objects(verb_group, [Noun('dog'), Noun('cat')]),
         [Verb('show'), Noun('dog'), Noun('cat')])
예제 #7
0
 def test_assign_objects_two_objects_particle_and_preposition(self):
     verb_group = VerbGroup(verb=Verb('throw'),
                            preposition=BasicWord.preposition('for'),
                            objects=2,
                            particle=BasicWord.particle('away'))
     self.assertEqual(assign_objects(verb_group, [HIM, IT]), [
         Verb('throw'), HIM,
         BasicWord.particle('away'),
         BasicWord.preposition('for'), IT
     ])
     self.assertEqual(
         assign_objects(verb_group, [Noun('cat'), Noun('dog')]), [
             Verb('throw'),
             BasicWord.particle('away'),
             Noun('cat'),
             BasicWord.preposition('for'),
             Noun('dog')
         ])
예제 #8
0
 def test_assign_objects_no_objects_no_particle_no_preposition(self):
     verb_group = VerbGroup(verb=Verb('chill'),
                            preposition=None,
                            objects=0,
                            particle=None)
     self.assertEqual(assign_objects(verb_group, []), [Verb('chill')])