Example #1
0
    def test_assign_objects_one_object_particle(self):
        verb_dict = {
            'verb': Verb('pick'),
            'preposition': None,
            'objects': 1,
            'particle': BasicWord.particle('up')
        }
        self.assertEqual(
            assign_objects(verb_dict, [IT]),
            [Verb('pick'), IT, BasicWord.particle('up')])

        self.assertEqual(
            assign_objects(verb_dict, [Noun('dog')]),
            [Verb('pick'), BasicWord.particle('up'),
             Noun('dog')])
Example #2
0
 def test_assign_objects_no_objects_no_particle_no_preposition(self):
     verb_dict = {
         'verb': Verb('chill'),
         'preposition': None,
         'objects': 0,
         'particle': None
     }
     self.assertEqual(assign_objects(verb_dict, []), [Verb('chill')])
Example #3
0
    def test_assign_objects_two_objects_preposition(self):
        verb_dict = {
            'verb': Verb('bring'),
            'preposition': BasicWord.preposition('to'),
            'objects': 2,
            'particle': None
        }
        self.assertEqual(assign_objects(verb_dict, [HIM, IT]),
                         [Verb('bring'), HIM,
                          BasicWord.preposition('to'), IT])

        self.assertEqual(assign_objects(verb_dict,
                                        [Noun('cat'), Noun('dog')]), [
                                            Verb('bring'),
                                            Noun('cat'),
                                            BasicWord.preposition('to'),
                                            Noun('dog')
                                        ])
Example #4
0
 def test_assign_objects_one_object_no_particle_no_preposition(self):
     verb_dict = {
         'verb': Verb('like'),
         'preposition': None,
         'objects': 1,
         'particle': None
     }
     self.assertEqual(assign_objects(verb_dict, [Noun('dog')]),
                      [Verb('like'), Noun('dog')])
Example #5
0
 def test_assign_objects_two_objects_no_particle_no_preposition(self):
     verb_dict = {
         'verb': Verb('show'),
         'preposition': None,
         'objects': 2,
         'particle': None
     }
     self.assertEqual(
         assign_objects(verb_dict, [Noun('dog'), Noun('cat')]),
         [Verb('show'), Noun('dog'), Noun('cat')])
Example #6
0
    def test_assign_objects_no_objects_particle_or_preposition(self):
        verb_dict = {
            'verb': Verb('chill'),
            'preposition': BasicWord.preposition('out'),
            'objects': 0,
            'particle': None
        }
        self.assertEqual(
            assign_objects(verb_dict, []),
            [Verb('chill'), BasicWord.preposition('out')])

        verb_dict = {
            'verb': Verb('run'),
            'preposition': None,
            'objects': 0,
            'particle': BasicWord.particle('away')
        }
        self.assertEqual(assign_objects(verb_dict, []),
                         [Verb('run'), BasicWord.particle('away')])
Example #7
0
 def test_assign_objects_two_objects_particle_and_preposition(self):
     verb_dict = {
         'verb': Verb('throw'),
         'preposition': BasicWord.preposition('for'),
         'objects': 2,
         'particle': BasicWord.particle('away')
     }
     self.assertEqual(assign_objects(verb_dict, [HIM, IT]), [
         Verb('throw'), HIM,
         BasicWord.particle('away'),
         BasicWord.preposition('for'), IT
     ])
     self.assertEqual(assign_objects(verb_dict,
                                     [Noun('cat'), Noun('dog')]), [
                                         Verb('throw'),
                                         BasicWord.particle('away'),
                                         Noun('cat'),
                                         BasicWord.preposition('for'),
                                         Noun('dog')
                                     ])