コード例 #1
0
    def test_write_nested(self):
        test_values = [
            ('person_1', 'infos', 12),
            ('person_1', 'infos.family', ['ambre', 'justin', 'sophia']),
            ('person_2', 'hobbies', {
                'soccer': True
            }),
            ('person_3', 'infos', {
                'age': '100'
            }),
            ('person_3', 'infos.hobbies', {
                'soccer': True
            }),
            ('person_3', 'infos.hobbies.soccer', [{
                'status': 'young'
            }, 'strong', 'fast']),
        ]

        for id_, path, new_value in test_values:
            self.setUp()
            target = MongoCellTarget(self.mongo_client, INDEX, COLLECTION, id_,
                                     path)
            target.write(new_value)
            self.assertEqual(target.read(), new_value)
            self.tearDown()
コード例 #2
0
    def test_write(self):
        ids = ['person_1', 'person_2', 'person_3', 'person_4', 'unknow_person']

        for id_ in ids:
            self.setUp()
            target = MongoCellTarget(self.mongo_client, INDEX, COLLECTION, id_, 'age')
            target.write('100')
            self.assertEqual(target.read(), '100')
コード例 #3
0
ファイル: mongo_test.py プロジェクト: PeteW/luigi
    def test_write_nested(self):
        test_values = [
            ('person_1', 'infos', 12),
            ('person_1', 'infos.family', ['ambre', 'justin', 'sophia']),
            ('person_2', 'hobbies', {'soccer': True}),
            ('person_3', 'infos', {'age': '100'}),
            ('person_3', 'infos.hobbies', {'soccer': True}),
            ('person_3', 'infos.hobbies.soccer', [{'status': 'young'}, 'strong', 'fast']),
        ]

        for id_, path, new_value in test_values:
            self.setUp()
            target = MongoCellTarget(self.mongo_client, INDEX, COLLECTION, id_, path)
            target.write(new_value)
            self.assertEqual(target.read(), new_value)
            self.tearDown()