From 56d219d83dfb861735504bbbf7081c8f17363723 Mon Sep 17 00:00:00 2001 From: jensens Date: Thu, 17 May 2018 15:35:29 +0200 Subject: [PATCH] [fc] Repository: plone.app.z3cform Branch: refs/heads/master Date: 2018-05-17T12:01:26+02:00 Author: Jens W. Klein (jensens) Commit: https://github.com/plone/plone.app.z3cform/commit/18c7f4bcdf650d445dfac128b7a9fc8cfc829aa6 isort Files changed: M plone/app/z3cform/tests/test_widgets.py M plone/app/z3cform/utils.py M plone/app/z3cform/widget.py Repository: plone.app.z3cform Branch: refs/heads/master Date: 2018-05-17T12:08:09+02:00 Author: Jens W. Klein (jensens) Commit: https://github.com/plone/plone.app.z3cform/commit/24aef53bca37ee344f441fd2c0db58629af2c499 pep8 Files changed: M plone/app/z3cform/tests/test_widgets.py Repository: plone.app.z3cform Branch: refs/heads/master Date: 2018-05-17T12:44:30+02:00 Author: Jens W. Klein (jensens) Commit: https://github.com/plone/plone.app.z3cform/commit/4e68ee72b03fa379613099608b1fde12bff6063e remove a bunch of C812 and related formatting Files changed: M plone/app/z3cform/converters.py M plone/app/z3cform/templates.py M plone/app/z3cform/tests/layer.py M plone/app/z3cform/tests/test_utils.py M plone/app/z3cform/tests/test_widgets.py M plone/app/z3cform/tests/tests.py M plone/app/z3cform/utils.py M plone/app/z3cform/widget.py M plone/app/z3cform/wysiwyg/widget.py Repository: plone.app.z3cform Branch: refs/heads/master Date: 2018-05-17T14:48:40+02:00 Author: Jens W. Klein (jensens) Commit: https://github.com/plone/plone.app.z3cform/commit/8ea041811768688270a9354c5bd8de353e3df947 add changelog Files changed: M CHANGES.rst M plone/app/z3cform/tests/tests.py M plone/app/z3cform/widget.py Repository: plone.app.z3cform Branch: refs/heads/master Date: 2018-05-17T15:35:29+02:00 Author: Jens W. Klein (jensens) Commit: https://github.com/plone/plone.app.z3cform/commit/a7121343b0eb8a75ac875856f8b56c433e93afc8 Merge pull request #91 from plone/jensens/cleanup Cleanup code analysis errors Files changed: M CHANGES.rst M plone/app/z3cform/converters.py M plone/app/z3cform/templates.py M plone/app/z3cform/tests/layer.py M plone/app/z3cform/tests/test_utils.py M plone/app/z3cform/tests/test_widgets.py M plone/app/z3cform/tests/tests.py M plone/app/z3cform/utils.py M plone/app/z3cform/widget.py M plone/app/z3cform/wysiwyg/widget.py --- last_commit.txt | 2519 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 2420 insertions(+), 99 deletions(-) diff --git a/last_commit.txt b/last_commit.txt index ddd58c891c..508c1fc81f 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,132 +1,2453 @@ -Repository: plone.app.viewletmanager +Repository: plone.app.z3cform Branch: refs/heads/master -Date: 2018-05-16T23:46:51+02:00 -Author: ale-rt (ale-rt) -Commit: https://github.com/plone/plone.app.viewletmanager/commit/23150b097b2725b5e555ce13a1adbfe44bc6a243 +Date: 2018-05-17T12:01:26+02:00 +Author: Jens W. Klein (jensens) +Commit: https://github.com/plone/plone.app.z3cform/commit/18c7f4bcdf650d445dfac128b7a9fc8cfc829aa6 -Fix imports +isort + +Files changed: +M plone/app/z3cform/tests/test_widgets.py +M plone/app/z3cform/utils.py +M plone/app/z3cform/widget.py + +diff --git a/plone/app/z3cform/tests/test_widgets.py b/plone/app/z3cform/tests/test_widgets.py +index 70c8295..6711883 100644 +--- a/plone/app/z3cform/tests/test_widgets.py ++++ b/plone/app/z3cform/tests/test_widgets.py +@@ -15,8 +15,8 @@ + from plone.testing.zca import UNIT_TESTING + from plone.uuid.interfaces import IUUID + from Products.CMFPlone.interfaces import IMarkupSchema +-from z3c.form.form import Form + from z3c.form.form import EditForm ++from z3c.form.form import Form + from z3c.form.interfaces import IFormLayer + from z3c.form.widget import FieldWidget + from zope.component import getUtility +@@ -1623,4 +1623,3 @@ class TestForm(AutoExtensibleForm, EditForm): + render = TestForm(self.layer['portal'], self.layer['request']) + self.assertIn( + 'empty foo" data-fieldname="form.widgets.my_date"', render()) +- +diff --git a/plone/app/z3cform/utils.py b/plone/app/z3cform/utils.py +index c698f36..715624c 100644 +--- a/plone/app/z3cform/utils.py ++++ b/plone/app/z3cform/utils.py +@@ -5,6 +5,7 @@ + from six.moves import urllib + from zope.component.hooks import getSite + ++ + try: + from zope.globalrequest import getRequest + getRequest # pyflakes +diff --git a/plone/app/z3cform/widget.py b/plone/app/z3cform/widget.py +index 1dc6174..ec09243 100644 +--- a/plone/app/z3cform/widget.py ++++ b/plone/app/z3cform/widget.py +@@ -64,6 +64,7 @@ + import json + import six + ++ + try: + from collections import UserDict + except ImportError: + + +Repository: plone.app.z3cform + + +Branch: refs/heads/master +Date: 2018-05-17T12:08:09+02:00 +Author: Jens W. Klein (jensens) +Commit: https://github.com/plone/plone.app.z3cform/commit/24aef53bca37ee344f441fd2c0db58629af2c499 + +pep8 + +Files changed: +M plone/app/z3cform/tests/test_widgets.py + +diff --git a/plone/app/z3cform/tests/test_widgets.py b/plone/app/z3cform/tests/test_widgets.py +index 6711883..89e861e 100644 +--- a/plone/app/z3cform/tests/test_widgets.py ++++ b/plone/app/z3cform/tests/test_widgets.py +@@ -399,7 +399,7 @@ def test_data_converter__timezone_callback(self): + dt = datetime(2013, 11, 13, 10, 20) + setattr(context, self.field.getName(), dt) + self.widget.context = context +- self.widget.default_timezone = lambda(context): 'Europe/Amsterdam' ++ self.widget.default_timezone = lambda context: 'Europe/Amsterdam' + tz = pytz.timezone('Europe/Amsterdam') + + converter = DatetimeWidgetConverter(self.field, self.widget) +@@ -1034,7 +1034,7 @@ def test_widget(self): + 'patternAjaxSelectOptions': None, + 'patternDateOptions': None, + 'patternRelateditemsOptions': None, +- }, ++ }, + }, + widget._base_args() + ) +@@ -1238,7 +1238,11 @@ def test_converter_List_of_Choice(self): + List(value_type=Choice(values=['one', 'two', 'three'])) + ) + for field in fields: +- expected_value_type = getattr(field.value_type, '_type', six.text_type) ++ expected_value_type = getattr( ++ field.value_type, ++ '_type', ++ six.text_type ++ ) + if expected_value_type is None: + expected_value_type = six.text_type + widget = Mock(separator=';') + + +Repository: plone.app.z3cform + + +Branch: refs/heads/master +Date: 2018-05-17T12:44:30+02:00 +Author: Jens W. Klein (jensens) +Commit: https://github.com/plone/plone.app.z3cform/commit/4e68ee72b03fa379613099608b1fde12bff6063e + +remove a bunch of C812 and related formatting + +Files changed: +M plone/app/z3cform/converters.py +M plone/app/z3cform/templates.py +M plone/app/z3cform/tests/layer.py +M plone/app/z3cform/tests/test_utils.py +M plone/app/z3cform/tests/test_widgets.py +M plone/app/z3cform/tests/tests.py +M plone/app/z3cform/utils.py +M plone/app/z3cform/widget.py +M plone/app/z3cform/wysiwyg/widget.py + +diff --git a/plone/app/z3cform/converters.py b/plone/app/z3cform/converters.py +index e43b94a..eba3966 100644 +--- a/plone/app/z3cform/converters.py ++++ b/plone/app/z3cform/converters.py +@@ -321,7 +321,7 @@ def toWidgetValue(self, value): + 'internal': u'', + 'external': u'', + 'email': u'', +- 'email_subject': u'' ++ 'email_subject': u'', + } + if not value: + return result +diff --git a/plone/app/z3cform/templates.py b/plone/app/z3cform/templates.py +index 5837b39..174273f 100644 +--- a/plone/app/z3cform/templates.py ++++ b/plone/app/z3cform/templates.py +@@ -16,7 +16,7 @@ def path(filepart): + return os.path.join( + os.path.dirname(plone.app.z3cform.__file__), + 'templates', +- filepart ++ filepart, + ) + + # Override the layout wrapper view default template with a more Plone-looking +diff --git a/plone/app/z3cform/tests/layer.py b/plone/app/z3cform/tests/layer.py +index 327c278..b1263f8 100644 +--- a/plone/app/z3cform/tests/layer.py ++++ b/plone/app/z3cform/tests/layer.py +@@ -31,5 +31,5 @@ def setUpPloneSite(self, portal): + PAZ3CForm_FIXTURE = PAZ3CFormLayer() + PAZ3CForm_INTEGRATION_TESTING = IntegrationTesting( + bases=(PAZ3CForm_FIXTURE,), +- name='plone.app.z3cform:Integration' ++ name='plone.app.z3cform:Integration', + ) +diff --git a/plone/app/z3cform/tests/test_utils.py b/plone/app/z3cform/tests/test_utils.py +index f3b703f..e6a068d 100644 +--- a/plone/app/z3cform/tests/test_utils.py ++++ b/plone/app/z3cform/tests/test_utils.py +@@ -11,18 +11,20 @@ def test_simple(self): + test_compare = 1 + test_out = call_callables( + test_in, +- 'funny return value' ++ 'funny return value', + ) + self.assertEqual(test_out, test_compare) + + def test_simple_function(self): + from plone.app.z3cform.utils import call_callables + +- def test_in(x): return x ++ def test_in(x): ++ return x ++ + test_compare = 'funny return value' + test_out = call_callables( + test_in, +- 'funny return value' ++ 'funny return value', + ) + self.assertEqual(test_out, test_compare) + +@@ -33,7 +35,7 @@ def test_list(self): + test_compare = [1, 2, 3, 'funny return value'] + test_out = call_callables( + test_in, +- 'funny return value' ++ 'funny return value', + ) + self.assertEqual(test_out, test_compare) + +@@ -44,7 +46,7 @@ def test_tuple(self): + test_compare = (1, 2, 3, 'funny return value') + test_out = call_callables( + test_in, +- 'funny return value' ++ 'funny return value', + ) + self.assertEqual(test_out, test_compare) + +@@ -63,8 +65,8 @@ def test_complex(self): + 'subsubnormal': 789, + 'subsublist': [7, 8, 9, lambda x: x], + 'subsubtuple': (7, 8, 9, lambda x: x), +- } +- } ++ }, ++ }, + } + + test_compare = { +@@ -79,13 +81,13 @@ def test_complex(self): + 'subsubnormal': 789, + 'subsublist': [7, 8, 9, 'funny return value'], + 'subsubtuple': (7, 8, 9, 'funny return value'), +- } +- } ++ }, ++ }, + } + + test_out = call_callables( + test_in, +- 'funny return value' ++ 'funny return value', + ) + + self.assertEqual(test_out, test_compare) +@@ -108,17 +110,17 @@ def test_is_same_domain(self): + # Those use the same protocol and are on the same domaain + self.assertTrue(is_same_domain( + 'https://plone.org/doc1', +- 'https://plone.org/doc2/doc3' ++ 'https://plone.org/doc2/doc3', + )) + + # These are two completly different URLs + self.assertTrue(not is_same_domain( + 'https://domain1.com', +- 'https://anotherdomain.com' ++ 'https://anotherdomain.com', + )) + + # Here, different transport protocols are used. Returning False. + self.assertTrue(not is_same_domain( + 'https://plone.org', +- 'http://plone.org' ++ 'http://plone.org', + )) +diff --git a/plone/app/z3cform/tests/test_widgets.py b/plone/app/z3cform/tests/test_widgets.py +index 89e861e..30607b7 100644 +--- a/plone/app/z3cform/tests/test_widgets.py ++++ b/plone/app/z3cform/tests/test_widgets.py +@@ -54,8 +54,7 @@ def __call__(self, context, query=None): + tmp = SimpleVocabulary([ + SimpleTerm(it.lower(), it.lower(), it) + for it in items +- if query is None or +- query.lower() in it.lower() ++ if query is None or query.lower() in it.lower() + ]) + tmp.test = 1 + return tmp +@@ -80,16 +79,18 @@ def test_widget_pattern_notimplemented(self): + + self.assertRaises( + NotImplemented, +- widget._base_args) ++ widget._base_args, ++ ) + + widget.pattern = 'example' + + self.assertEqual( + { + 'pattern': 'example', +- 'pattern_options': {} ++ 'pattern_options': {}, + }, +- widget._base_args()) ++ widget._base_args(), ++ ) + + def test_widget_base_notimplemented(self): + from plone.app.z3cform.widget import BaseWidget +@@ -102,13 +103,15 @@ def test_widget_base_notimplemented(self): + + self.assertRaises( + NotImplemented, +- widget.render) ++ widget.render, ++ ) + + widget._base = InputWidget + + self.assertEqual( + '', +- widget.render()) ++ widget.render(), ++ ) + + def test_widget_base_custom_css(self): + from plone.app.z3cform.widget import BaseWidget +@@ -138,7 +141,7 @@ def test_widget_base_pattern_options_with_functions(self): + 'subsubnormal': 789, + 'subsublist': [7, 8, 9, lambda x: x], + 'subsubtuple': (7, 8, 9, lambda x: x), +- } ++ }, + } + + self.assertEqual( +@@ -147,7 +150,8 @@ def test_widget_base_pattern_options_with_functions(self): + '{"subsubtuple": [7, 8, 9, "testcontext"], ' + '"subsublist": [7, 8, 9, "testcontext"], ' + '"subsubnormal": 789}}"/>', +- widget.render()) ++ widget.render(), ++ ) + + + class DateWidgetTests(unittest.TestCase): +@@ -188,12 +192,12 @@ def test_widget(self): + 'placeholder': u'Enter date...', + 'monthsShort': [u'Jan', u'Feb', u'Mar', u'Apr', u'May', + u'Jun', u'Jul', u'Aug', u'Sep', u'Oct', +- u'Nov', u'Dec'] ++ u'Nov', u'Dec'], + }, + 'time': False, + 'today': u'Today', + 'clear': u'Clear', +- } ++ }, + }, + self.widget._base_args(), + ) +@@ -262,7 +266,7 @@ def setUp(self): + self.widget.field = self.field + self.widget.pattern_options = { + 'date': {'firstDay': 0}, +- 'time': {'interval': 15} ++ 'time': {'interval': 15}, + } + + def test_widget(self): +@@ -291,16 +295,16 @@ def test_widget(self): + 'placeholder': u'Enter date...', + 'monthsShort': [u'Jan', u'Feb', u'Mar', u'Apr', u'May', + u'Jun', u'Jul', u'Aug', u'Sep', u'Oct', +- u'Nov', u'Dec'] ++ u'Nov', u'Dec'], + }, + 'time': { + 'placeholder': u'Enter time...', + 'format': 'h:i a', +- 'interval': 15 ++ 'interval': 15, + }, + 'today': u'Today', + 'clear': u'Clear', +- } ++ }, + }, + self.widget._base_args(), + ) +@@ -448,7 +452,7 @@ def test_widget(self): + widget.id = 'test-widget' + widget.field = Choice( + __name__='selectfield', +- values=['one', 'two', 'three'] ++ values=['one', 'two', 'three'], + ) + widget.terms = widget.field.vocabulary + widget.field.required = True +@@ -462,8 +466,8 @@ def test_widget(self): + 'items': [ + ('one', 'one'), + ('two', 'two'), +- ('three', 'three') +- ] ++ ('three', 'three'), ++ ], + }, + widget._base_args(), + ) +@@ -480,8 +484,8 @@ def test_widget(self): + (u'', u''), + ('one', 'one'), + ('two', 'two'), +- ('three', 'three') +- ] ++ ('three', 'three'), ++ ], + }, + widget._base_args(), + ) +@@ -498,8 +502,8 @@ def test_widget(self): + 'items': [ + ('one', 'one'), + ('two', 'two'), +- ('three', 'three') +- ] ++ ('three', 'three'), ++ ], + }, + widget._base_args(), + ) +@@ -518,8 +522,8 @@ def test_widget(self): + 'items': [ + ('one', 'one'), + ('two', 'two'), +- ('three', 'three') +- ] ++ ('three', 'three'), ++ ], + }, + widget._base_args(), + ) +@@ -537,8 +541,8 @@ def test_widget(self): + 'items': [ + ('one', 'one'), + ('two', 'two'), +- ('three', 'three') +- ] ++ ('three', 'three'), ++ ], + }, + widget._base_args(), + ) +@@ -550,7 +554,7 @@ def test_widget_list_orderable(self): + widget.separator = '.' + widget.field = List( + __name__='selectfield', +- value_type=Choice(values=['one', 'two', 'three']) ++ value_type=Choice(values=['one', 'two', 'three']), + ) + widget.terms = widget.field.value_type.vocabulary + self.assertEqual( +@@ -564,8 +568,8 @@ def test_widget_list_orderable(self): + 'items': [ + ('one', 'one'), + ('two', 'two'), +- ('three', 'three') +- ] ++ ('three', 'three'), ++ ], + }, + widget._base_args(), + ) +@@ -576,7 +580,7 @@ def test_widget_tuple_orderable(self): + widget.id = 'test-widget' + widget.field = Tuple( + __name__='selectfield', +- value_type=Choice(values=['one', 'two', 'three']) ++ value_type=Choice(values=['one', 'two', 'three']), + ) + widget.terms = widget.field.value_type.vocabulary + self.assertEqual( +@@ -590,8 +594,8 @@ def test_widget_tuple_orderable(self): + 'items': [ + ('one', 'one'), + ('two', 'two'), +- ('three', 'three') +- ] ++ ('three', 'three'), ++ ], + }, + widget._base_args(), + ) +@@ -603,7 +607,7 @@ def test_widget_set_not_orderable(self): + # A set is not orderable + widget.field = Set( + __name__='selectfield', +- value_type=Choice(values=['one', 'two', 'three']) ++ value_type=Choice(values=['one', 'two', 'three']), + ) + widget.terms = widget.field.value_type.vocabulary + self.assertEqual( +@@ -617,8 +621,8 @@ def test_widget_set_not_orderable(self): + 'items': [ + ('one', 'one'), + ('two', 'two'), +- ('three', 'three') +- ] ++ ('three', 'three'), ++ ], + }, + widget._base_args(), + ) +@@ -628,7 +632,7 @@ def test_widget_extract(self): + widget = SelectWidget(self.request) + widget.field = Choice( + __name__='selectfield', +- values=['one', 'two', 'three'] ++ values=['one', 'two', 'three'], + ) + widget.name = 'selectfield' + self.request.form['selectfield'] = 'one' +@@ -641,9 +645,13 @@ def test_data_converter_list(self): + from plone.app.z3cform.widget import SelectWidget + from plone.app.z3cform.converters import SelectWidgetConverter + +- field = List(__name__='listfield', +- value_type=Choice(__name__='selectfield', +- values=['one', 'two', 'three'])) ++ field = List( ++ __name__='listfield', ++ value_type=Choice( ++ __name__='selectfield', ++ values=['one', 'two', 'three'], ++ ), ++ ) + widget = SelectWidget(self.request) + widget.field = field + widget.multiple = True +@@ -671,21 +679,25 @@ def test_data_converter_list(self): + ) + self.assertRaises( + LookupError, +- converter.toFieldValue, 'one;two;three' ++ converter.toFieldValue, 'one;two;three', + ) + + self.assertEqual( + converter.toWidgetValue(['one', 'two', 'three']), +- ['one', 'two', 'three'] ++ ['one', 'two', 'three'], + ) + + def test_data_converter_tuple(self): + from plone.app.z3cform.widget import SelectWidget + from plone.app.z3cform.converters import SelectWidgetConverter + +- field = Tuple(__name__='tuplefield', +- value_type=Choice(__name__='selectfield', +- values=['one', 'two', 'three'])) ++ field = Tuple( ++ __name__='tuplefield', ++ value_type=Choice( ++ __name__='selectfield', ++ values=['one', 'two', 'three'], ++ ), ++ ) + widget = SelectWidget(self.request) + widget.field = field + widget.multiple = True +@@ -749,7 +761,7 @@ def test_widget(self): + 'pattern': 'select2', + 'pattern_options': {'separator': ';'}, + }, +- widget._base_args() ++ widget._base_args(), + ) + + widget.vocabulary = 'example' +@@ -761,9 +773,9 @@ def test_widget(self): + 'pattern': 'select2', + 'pattern_options': { + 'vocabularyUrl': '/@@getVocabulary?name=example', +- 'separator': ';' ++ 'separator': ';', + }, +- } ++ }, + ) + + widget.value = 'three;two' +@@ -776,9 +788,9 @@ def test_widget(self): + 'pattern_options': { + 'vocabularyUrl': '/@@getVocabulary?name=example', + 'initialValues': {'three': u'Three', 'two': u'Two'}, +- 'separator': ';' ++ 'separator': ';', + }, +- } ++ }, + ) + + def test_widget_list_orderable(self): +@@ -842,7 +854,7 @@ def test_widget_choice(self): + 'maximumSelectionSize': 1, + 'allowNewItems': 'false', + 'vocabularyUrl': +- 'http://127.0.0.1/++widget++choicefield/@@getSource', ++ 'http://127.0.0.1/++widget++choicefield/@@getSource', + }, + }, + widget._base_args(), +@@ -875,8 +887,8 @@ def test_widget_addform_url_on_addform(self): + 'pattern_options': { + 'separator': ';', + 'vocabularyUrl': +- 'http://addform_url/@@getVocabulary?name=vocabulary1'} +- ++ 'http://addform_url/@@getVocabulary?name=vocabulary1', ++ }, + }, + widget._base_args(), + ) +@@ -976,8 +988,10 @@ def test_keywords_can_add(self): + widget = AjaxSelectWidget(self.request) + widget.context = portal + widget.vocabulary = 'plone.app.vocabularies.Keywords' +- self.assertEqual(widget._base_args()['pattern_options'][ +- 'allowNewItems'], 'true') ++ self.assertEqual( ++ widget._base_args()['pattern_options']['allowNewItems'], ++ 'true', ++ ) + + def test_keywords_cannot_add(self): + from plone.app.z3cform.widget import AjaxSelectWidget +@@ -986,8 +1000,10 @@ def test_keywords_cannot_add(self): + widget = AjaxSelectWidget(self.request) + widget.context = portal + widget.vocabulary = 'plone.app.vocabularies.Keywords' +- self.assertEqual(widget._base_args()['pattern_options'][ +- 'allowNewItems'], 'false') ++ self.assertEqual( ++ widget._base_args()['pattern_options']['allowNewItems'], ++ 'false', ++ ) + + + class QueryStringWidgetTests(unittest.TestCase): +@@ -1009,15 +1025,15 @@ def test_converter_empty_value(self): + + @mock.patch( + 'plone.app.widgets.utils.get_ajaxselect_options', +- new=lambda *args, **kwargs: None ++ new=lambda *args, **kwargs: None, + ) + @mock.patch( + 'plone.app.widgets.utils.get_date_options', +- new=lambda *args, **kwargs: None ++ new=lambda *args, **kwargs: None, + ) + @mock.patch( + 'plone.app.widgets.utils.get_relateditems_options', +- new=lambda *args, **kwargs: None ++ new=lambda *args, **kwargs: None, + ) + def test_widget(self): + from plone.app.z3cform.widget import QueryStringWidget +@@ -1036,7 +1052,7 @@ def test_widget(self): + 'patternRelateditemsOptions': None, + }, + }, +- widget._base_args() ++ widget._base_args(), + ) + + +@@ -1073,19 +1089,19 @@ def test_related_items_widget(self): + + self.assertEqual( + EXPECTED_ROOT_PATH, +- result['pattern_options']['rootPath'] ++ result['pattern_options']['rootPath'], + ) + self.assertEqual( + EXPECTED_ROOT_URL, +- result['pattern_options']['rootUrl'] ++ result['pattern_options']['rootUrl'], + ) + self.assertEqual( + EXPECTED_BASE_PATH, +- result['pattern_options']['basePath'] ++ result['pattern_options']['basePath'], + ) + self.assertEqual( + EXPECTED_VOCAB_URL, +- result['pattern_options']['vocabularyUrl'] ++ result['pattern_options']['vocabularyUrl'], + ) + + def test_related_items_widget_nav_root(self): +@@ -1107,19 +1123,19 @@ def test_related_items_widget_nav_root(self): + + self.assertEqual( + EXPECTED_ROOT_PATH, +- result['pattern_options']['rootPath'] ++ result['pattern_options']['rootPath'], + ) + self.assertEqual( + EXPECTED_ROOT_URL, +- result['pattern_options']['rootUrl'] ++ result['pattern_options']['rootUrl'], + ) + self.assertEqual( + EXPECTED_BASE_PATH, +- result['pattern_options']['basePath'] ++ result['pattern_options']['basePath'], + ) + self.assertEqual( + EXPECTED_VOCAB_URL, +- result['pattern_options']['vocabularyUrl'] ++ result['pattern_options']['vocabularyUrl'], + ) + + +@@ -1130,7 +1146,7 @@ def setUp(self): + + @mock.patch( + 'plone.app.widgets.utils.getToolByName', +- new=Mock(return_value=Mock(return_value='testuser')) ++ new=Mock(return_value=Mock(return_value='testuser')), + ) + def test_single_selection(self): + """The pattern_options value for maximumSelectionSize should +@@ -1151,7 +1167,7 @@ def test_single_selection(self): + + @mock.patch( + 'plone.app.widgets.utils.getToolByName', +- new=Mock(return_value=Mock(return_value='testuser')) ++ new=Mock(return_value=Mock(return_value='testuser')), + ) + def test_multiple_selection(self): + """The pattern_options key maximumSelectionSize shouldn't be +@@ -1164,7 +1180,7 @@ def test_multiple_selection(self): + getPhysicalPath=lambda: ['', 'site']) + field = List( + __name__='selectfield', +- value_type=Choice(vocabulary='foobar') ++ value_type=Choice(vocabulary='foobar'), + ) + widget = RelatedItemsFieldWidget(field, self.request) + widget.context = context +@@ -1188,18 +1204,21 @@ def test_converter_RelationChoice(self): + portal_catalog = Mock(return_value=[brain]) + widget = Mock() + converter = RelationChoiceRelatedItemsWidgetConverter( +- TextLine(), widget) ++ TextLine(), ++ widget, ++ ) + + with mock.patch( + 'plone.app.z3cform.converters.IUUID', +- return_value='id' ++ return_value='id', + ): + self.assertEqual(converter.toWidgetValue('obj'), 'id') + self.assertEqual(converter.toWidgetValue(None), None) + + with mock.patch( +- 'plone.app.z3cform.converters.getToolByName', +- return_value=portal_catalog): ++ 'plone.app.z3cform.converters.getToolByName', ++ return_value=portal_catalog, ++ ): + self.assertEqual(converter.toFieldValue('id'), 'obj') + self.assertEqual(converter.toFieldValue(None), None) + +@@ -1217,17 +1236,22 @@ def test_converter_RelationList(self): + self.assertEqual(converter.toWidgetValue(None), None) + with mock.patch( + 'plone.app.z3cform.converters.IUUID', +- side_effect=['id1', 'id2'] ++ side_effect=['id1', 'id2'], + ): + self.assertEqual( +- converter.toWidgetValue(['obj1', 'obj2']), 'id1;id2') ++ converter.toWidgetValue(['obj1', 'obj2']), ++ 'id1;id2', ++ ) + + self.assertEqual(converter.toFieldValue(None), None) + with mock.patch( +- 'plone.app.z3cform.converters.getToolByName', +- return_value=portal_catalog): ++ 'plone.app.z3cform.converters.getToolByName', ++ return_value=portal_catalog, ++ ): + self.assertEqual( +- converter.toFieldValue('id1;id2'), ['obj1', 'obj2']) ++ converter.toFieldValue('id1;id2'), ++ ['obj1', 'obj2'], ++ ) + + def test_converter_List_of_Choice(self): + from plone.app.z3cform.converters import RelatedItemsDataConverter +@@ -1235,13 +1259,13 @@ def test_converter_List_of_Choice(self): + List(), + List(value_type=TextLine()), + List(value_type=BytesLine()), +- List(value_type=Choice(values=['one', 'two', 'three'])) ++ List(value_type=Choice(values=['one', 'two', 'three'])), + ) + for field in fields: + expected_value_type = getattr( + field.value_type, + '_type', +- six.text_type ++ six.text_type, + ) + if expected_value_type is None: + expected_value_type = six.text_type +@@ -1250,16 +1274,20 @@ def test_converter_List_of_Choice(self): + + self.assertEqual(converter.toWidgetValue(None), None) + self.assertEqual( +- converter.toWidgetValue(['id1', 'id2']), 'id1;id2') ++ converter.toWidgetValue(['id1', 'id2']), ++ 'id1;id2', ++ ) + + self.assertEqual(converter.toFieldValue(None), None) + self.assertEqual( +- converter.toFieldValue('id1;id2'), ['id1', 'id2']) ++ converter.toFieldValue('id1;id2'), ++ ['id1', 'id2'], ++ ) + + self.assertEqual(converter.toFieldValue(None), None) + self.assertEqual( + type(converter.toFieldValue('id1;id2')[0]), +- expected_value_type ++ expected_value_type, + ) + + def test_fieldwidget(self): +@@ -1325,11 +1353,12 @@ def test_widget_params(self): + prependToUrl = '/plone/resolveuid/' + self.assertEqual( + base_args['pattern_options']['prependToUrl'], +- prependToUrl ++ prependToUrl, + ) + self.assertEqual( + base_args['pattern_options']['upload']['relativePath'], +- '@@fileUpload') ++ '@@fileUpload', ++ ) + + def test_widget_params_different_contexts(self): + from plone.app.z3cform.widget import RichTextWidget +@@ -1348,7 +1377,7 @@ def test_widget_params_different_contexts(self): + + self.assertEqual( + base_args['pattern_options']['relatedItems']['basePath'], +- '/plone' ++ '/plone', + ) + + # sub context +@@ -1358,7 +1387,7 @@ def test_widget_params_different_contexts(self): + + self.assertEqual( + base_args['pattern_options']['relatedItems']['basePath'], +- '/plone/sub' ++ '/plone/sub', + ) + + # form context +@@ -1368,7 +1397,7 @@ def test_widget_params_different_contexts(self): + + self.assertEqual( + base_args['pattern_options']['relatedItems']['basePath'], +- '/plone/sub' ++ '/plone/sub', + ) + + # non-contentish context +@@ -1378,7 +1407,7 @@ def test_widget_params_different_contexts(self): + + self.assertEqual( + base_args['pattern_options']['relatedItems']['basePath'], +- '/plone' ++ '/plone', + ) + + def test_widget_values(self): +@@ -1398,7 +1427,9 @@ def _set_mimetypes(self, default='text/html', allowed=('text/html')): + if IMarkupSchema: + registry = getUtility(IRegistry) + self.settings = registry.forInterface( +- IMarkupSchema, prefix='plone') ++ IMarkupSchema, ++ prefix='plone', ++ ) + self.settings.default_type = default + self.settings.allowed_types = allowed + +@@ -1460,7 +1491,8 @@ def test_dx_tinymcewidget_multiple_mimetypes_edit(self): + self.assertTrue('pat-textareamimetypeselector' in rendered) + self.assertTrue('data-pat-textareamimetypeselector' in rendered) + self.assertTrue( +- '