def _wikipedia_users(user_pages): username_page_map = dict([[p.associated_username(), p] for p in user_pages]) usernames = username_page_map.keys() for info in wikipedia.users(usernames): info['page'] = username_page_map[info['name']] yield info
def test_users(self): users = wikipedia.users(['edsu', 'nichtich']) self.assertEqual(len(users), 2) self.assertEqual(users[0]['name'], 'Edsu') self.assertTrue(users[0]['editcount'] > 0) self.assertTrue(users[0].has_key('gender')) self.assertTrue(users[0].has_key('registration')) self.assertEqual(users[1]['name'], 'Nichtich')