======================================
Password Confirmation Label (Py2/Py3)
======================================

Regression test for the ``labelPasswordConfirmation`` property of
``PasswordConfirmationWidget``. ``cgi.escape`` was removed in Python 3.8,
so the property must use a Py2/Py3-compatible escape helper.

  >>> import zope.component
  >>> from zope.i18n.negotiator import Negotiator
  >>> from zope.i18n.interfaces import INegotiator
  >>> from z3c.form.testing import TestRequest
  >>> from j01.form.widget.password import PasswordConfirmationWidget

  >>> zope.component.provideUtility(Negotiator(), INegotiator, '')

  >>> widget = PasswordConfirmationWidget(TestRequest())
  >>> widget.id = 'foo'

Direct property access must not raise on any supported Python:

  >>> html = widget.labelPasswordConfirmation
  >>> 'foo-confirm' in html
  True
  >>> 'Password confirmation' in html
  True

HTML-special chars in the translated label must be escaped:

  >>> import zope.i18n
  >>> _orig = zope.i18n.translate
  >>> zope.i18n.translate = lambda msg, context=None: u'A & B <x>'
  >>> try:
  ...     out = widget.labelPasswordConfirmation
  ... finally:
  ...     zope.i18n.translate = _orig
  >>> 'A &amp; B &lt;x&gt;' in out
  True
