Repository: plone/plone.restapi (language: python)

Issue:
`zope.schema >= 7.0.0` changed type of `schema.Int`
Just figured out, that `zope.schema.Int` Field changed it's validation basis `_type` from `(int, )` to `int` since version `7.0.0` (they dropped the `zope.schema._compat.py` module). Some tests here check the `WrongType` exception on validation and have to be updated accordingly.



Discussion / hints:

Fix patch:
diff --git a/news/1567.bugfix b/news/1567.bugfix
new file mode 100644
index 0000000000..704eaa4882
--- /dev/null
+++ b/news/1567.bugfix
@@ -0,0 +1,2 @@
+Fix tests for `zope.schema >= 7.0.0`
+[petschki]


Test patch:
diff --git a/src/plone/restapi/tests/test_dxfield_deserializer.py b/src/plone/restapi/tests/test_dxfield_deserializer.py
index 32b1ed3cf7..d40f88c00b 100644
--- a/src/plone/restapi/tests/test_dxfield_deserializer.py
+++ b/src/plone/restapi/tests/test_dxfield_deserializer.py
@@ -487,7 +487,12 @@ def test_collection_deserializer_validates_value(self):
         # DefaultFieldDeserializer that the CollectionFieldDeserializer will
         # delegate to for deserializing collection items.
         self.assertEqual("Object is of wrong type.", cm.exception.doc())
-        self.assertEqual((b"2", (int,), ""), cm.exception.args)
+        exception_args = list(cm.exception.args)
+        if isinstance(exception_args[1], tuple):
+            # BBB: since zope.schema >= 7.0.0 the Int field changed its validation `_type`
+            # from (int, ) to int ... we adjust that to work with both versions
+            exception_args[1] = exception_args[1][0]
+        self.assertEqual([b"2", int, ""], exception_args)
 
     def test_dict_deserializer_validates_value(self):
         with self.assertRaises(ValidationError) as cm: