We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 372de61 commit 24a5193Copy full SHA for 24a5193
1 file changed
tests/test_manual_validation.py
@@ -0,0 +1,23 @@
1
+import pydantic
2
+import pytest
3
+
4
5
+def test_manual_validation():
6
+ from tests.output_betterproto_pydantic.manual_validation import Msg
7
8
+ msg = Msg()
9
10
+ msg.x = 12
11
+ msg._validate()
12
13
+ msg.x = 2**50 # This is an invalid int32 value
14
+ with pytest.raises(pydantic.ValidationError):
15
16
17
18
+def test_manual_validation_non_pydantic():
19
+ from tests.output_betterproto.manual_validation import Msg
20
21
+ # Validation is not available for non-pydantic messages
22
+ with pytest.raises(TypeError):
23
+ Msg()._validate()
0 commit comments