During the development of tests in T59602 , it was found that Site.page_restrictions() caches the pageinfo on the first call, however Site.protect() does not update or clear it, resulting in wrong data if you call page_restrictions() after Site.protect().
Example:
site = self.get_site() p1 = pywikibot.Page(site, u'User:Unicodesnowman/ProtectTest') site.protect(protections=dict(edit='sysop', move='autoconfirmed'), page=p1, reason='Pywikibot unit test') self.assertEqual(site.page_restrictions(page=p1), dict([(u'edit', (u'sysop', u'infinity')), (u'move', (u'autoconfirmed', u'infinity'))])) site.protect(protections=dict(edit='', move=''), page=p1, reason='Pywikibot unit test') self.assertEqual(site.page_restrictions(page=p1), dict())
(Fails on the last line)