diff options
author | Maxwell G <maxwell@gtmx.me> | 2023-09-25 10:19:08 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-25 15:19:08 +0000 |
commit | 12611bfcddfe87e3bad90ef96a648acc2f1cebf3 (patch) | |
tree | 9d67371d56f1904f3098e9bf7668db71a8b631cc /tests/rest/client/test_models.py | |
parent | Bump cryptography from 41.0.3 to 41.0.4 (#16362) (diff) | |
download | synapse-12611bfcddfe87e3bad90ef96a648acc2f1cebf3.tar.xz |
Add support for pydantic v2 via pydantic.v1 compat module (#16332)
While maintaining support with pydantic v1.
Diffstat (limited to 'tests/rest/client/test_models.py')
-rw-r--r-- | tests/rest/client/test_models.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/rest/client/test_models.py b/tests/rest/client/test_models.py index 0b8fcb0c47..524ea6047e 100644 --- a/tests/rest/client/test_models.py +++ b/tests/rest/client/test_models.py @@ -12,12 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. import unittest as stdlib_unittest +from typing import TYPE_CHECKING -from pydantic import BaseModel, ValidationError from typing_extensions import Literal +from synapse._pydantic_compat import HAS_PYDANTIC_V2 from synapse.rest.client.models import EmailRequestTokenBody +if TYPE_CHECKING or HAS_PYDANTIC_V2: + from pydantic.v1 import BaseModel, ValidationError +else: + from pydantic import BaseModel, ValidationError + class ThreepidMediumEnumTestCase(stdlib_unittest.TestCase): class Model(BaseModel): |