dataimport/test/unittest_importer.py
changeset 10809 359cbdf3a515
parent 10807 bb0c7dbd1fe7
child 11110 68477666401f
equal deleted inserted replaced
10808:b6b2e1bcd1b2 10809:359cbdf3a515
   150 
   150 
   151 
   151 
   152 class UseExtidAsCwuriTC(TestCase):
   152 class UseExtidAsCwuriTC(TestCase):
   153 
   153 
   154     def test(self):
   154     def test(self):
   155         personne = ExtEntity('Personne', 1, {'nom': set([u'de la lune']),
   155         personne = ExtEntity('Personne', b'1', {'nom': set([u'de la lune']),
   156                                              'prenom': set([u'Jean'])})
   156                                                 'prenom': set([u'Jean'])})
   157         mapping = {}
   157         mapping = {}
   158         set_cwuri = use_extid_as_cwuri(mapping)
   158         set_cwuri = use_extid_as_cwuri(mapping)
   159         list(set_cwuri((personne,)))
   159         list(set_cwuri((personne,)))
   160         self.assertIn('cwuri', personne.values)
   160         self.assertIn('cwuri', personne.values)
   161         self.assertEqual(personne.values['cwuri'], set(['1']))
   161         self.assertEqual(personne.values['cwuri'], set([u'1']))
   162         mapping[1] = 'whatever'
   162         mapping[b'1'] = 'whatever'
   163         personne.values.pop('cwuri')
   163         personne.values.pop('cwuri')
   164         list(set_cwuri((personne,)))
   164         list(set_cwuri((personne,)))
   165         self.assertNotIn('cwuri', personne.values)
   165         self.assertNotIn('cwuri', personne.values)
   166 
   166 
   167 
   167