Skip to content

Commit

Permalink
Merge pull request #104 from zopefoundation/adamg-fix-tests
Browse files Browse the repository at this point in the history
Fix recent test breakages coming from zope.schema and zope.interface
  • Loading branch information
agroszer committed Jul 29, 2021
2 parents 440eb18 + 263930e commit 9880499
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -20,3 +20,4 @@ include/
lib*
pip-selfcheck.json
pyvenv.cfg
venv/
4 changes: 4 additions & 0 deletions CHANGES.rst
Expand Up @@ -5,6 +5,10 @@ Changelog
4.2 (unreleased)
----------------

- Fixed tests for the `zope.schema.Bool` required default change.

- Fixed tests for the `zope.interface` `repr()` change.

- Fixed compatibility with changed repeat syntax.
Fixes `issue 94 <https://github.com/zopefoundation/z3c.form/issues/94>`_.

Expand Down
2 changes: 1 addition & 1 deletion src/z3c/form/browser/README.rst
Expand Up @@ -148,7 +148,7 @@ Calling the widget will return the widget including the layout
Bool
----

>>> field = zope.schema.Bool(default=True, title=u"Check me")
>>> field = zope.schema.Bool(default=True, title=u"Check me", required=True)
>>> widget = setupWidget(field)
>>> widget.update()

Expand Down
12 changes: 6 additions & 6 deletions src/z3c/form/browser/object.rst
Expand Up @@ -558,7 +558,7 @@ Let's see our event log:
>>> printEvents()
<zope...ObjectCreatedEvent object at ...>
<zope...ObjectModifiedEvent object at ...>
<InterfaceClass z3c.form.testing.IMySubObject>
z3c.form.testing.IMySubObject
['barfield', 'foofield']
<zope...ObjectCreatedEvent object at ...>
<zope...contained.ContainerModifiedEvent object at ...>
Expand Down Expand Up @@ -657,10 +657,10 @@ Let's see our event log:

>>> printEvents()
<zope...ObjectModifiedEvent object at ...>
<InterfaceClass z3c.form.testing.IMySubObject>
z3c.form.testing.IMySubObject
['barfield', 'foofield']
<zope...ObjectModifiedEvent object at ...>
<InterfaceClass z3c.form.testing.IMyObject>
z3c.form.testing.IMyObject
['subobject']


Expand Down Expand Up @@ -1113,10 +1113,10 @@ Until updating the form:
2
>>> printEvents()
<zope...ObjectModifiedEvent object at ...>
<InterfaceClass z3c.form.testing.IMySubObject>
z3c.form.testing.IMySubObject
['barfield', 'foofield']
<zope...ObjectModifiedEvent object at ...>
<InterfaceClass z3c.form.testing.IMyObject>
z3c.form.testing.IMyObject
['name', 'subobject']


Expand Down Expand Up @@ -1304,7 +1304,7 @@ it just burps:
Traceback (most recent call last):
...
TypeError: ('Could not adapt', u'brutal',
<InterfaceClass z3c.form.testing.IMySubObject>)
z3c.form.testing.IMySubObject

>>> context['subobject'] = None

Expand Down
10 changes: 5 additions & 5 deletions src/z3c/form/browser/objectmulti.rst
Expand Up @@ -1281,11 +1281,11 @@ Let's see our event log:
>>> printEvents()
<zope...ObjectCreatedEvent object at ...>
<zope...ObjectModifiedEvent object at ...>
<InterfaceClass z3c.form.testing.IMySubObjectMulti>
z3c.form.testing.IMySubObjectMulti
['barfield', 'foofield']
<zope...ObjectCreatedEvent object at ...>
<zope...ObjectModifiedEvent object at ...>
<InterfaceClass z3c.form.testing.IMySubObjectMulti>
z3c.form.testing.IMySubObjectMulti
['barfield', 'foofield']
<zope...ObjectCreatedEvent object at ...>
<zope...contained.ContainerModifiedEvent object at ...>
Expand Down Expand Up @@ -1420,14 +1420,14 @@ Let's see our event log:
>>> printEvents()
<zope...ObjectCreatedEvent object at ...>
<zope...ObjectModifiedEvent object at ...>
<InterfaceClass z3c.form.testing.IMySubObjectMulti>
z3c.form.testing.IMySubObjectMulti
['barfield', 'foofield']
<zope...ObjectCreatedEvent object at ...>
<zope...ObjectModifiedEvent object at ...>
<InterfaceClass z3c.form.testing.IMySubObjectMulti>
z3c.form.testing.IMySubObjectMulti
['barfield', 'foofield']
<zope...ObjectModifiedEvent object at ...>
<InterfaceClass z3c.form.testing.IMyMultiObject>
z3c.form.testing.IMyMultiObject
['listOfObject']

>>> eventlog=[]
Expand Down
2 changes: 2 additions & 0 deletions src/z3c/form/hint.rst
Expand Up @@ -126,11 +126,13 @@ Let's setup a simple vocabulary:
... boolField = zope.schema.Bool(
... title=u'Boolean',
... description=u'This is a Bool field.',
... required=True,
... default=True)
...
... checkboxBoolField = zope.schema.Bool(
... title=u'Boolean (Checkbox)',
... description=u'This is a Bool field displayed suing a checkbox.',
... required=True,
... default=True)
...
... bytesLineField = zope.schema.BytesLine(
Expand Down
15 changes: 10 additions & 5 deletions src/z3c/form/testing.py
Expand Up @@ -639,7 +639,8 @@ class IObjectWidgetSingleSubIntegration(zope.interface.Interface):
singleInt = zope.schema.Int(
title=u'Int label')
singleBool = zope.schema.Bool(
title=u'Bool label')
title=u'Bool label',
required=True)
singleChoice = zope.schema.Choice(
title=u'Choice label',
values=('one', 'two', 'three'))
Expand Down Expand Up @@ -688,7 +689,8 @@ class IObjectWidgetMultiSubIntegration(zope.interface.Interface):
multiInt = zope.schema.Int(
title=u'Int label')
multiBool = zope.schema.Bool(
title=u'Bool label')
title=u'Bool label',
required=True)
multiChoice = zope.schema.Choice(
title=u'Choice label',
values=('one', 'two', 'three'))
Expand Down Expand Up @@ -737,7 +739,8 @@ class IMultiWidgetListIntegration(zope.interface.Interface):
listOfBool = zope.schema.List(
title=u"ListOfBool label",
value_type=zope.schema.Bool(
title=u'Bool label'),
title=u'Bool label',
required=True),
)
listOfChoice = zope.schema.List(
title=u"ListOfChoice label",
Expand Down Expand Up @@ -786,9 +789,11 @@ class IMultiWidgetDictIntegration(zope.interface.Interface):
dictOfBool = zope.schema.Dict(
title=u"DictOfBool label",
key_type=zope.schema.Bool(
title=u'Bool key'),
title=u'Bool key',
required=True),
value_type=zope.schema.Bool(
title=u'Bool label'),
title=u'Bool label',
required=True),
)
dictOfChoice = zope.schema.Dict(
title=u"DictOfChoice label",
Expand Down

0 comments on commit 9880499

Please sign in to comment.