vtjson 2.2.7__tar.gz → 2.2.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vtjson
3
- Version: 2.2.7
3
+ Version: 2.2.8
4
4
  Summary: An easy to use validation library compatible with Python type annotations
5
5
  Author-email: Michel Van den Bergh <michel.vandenbergh@uhasselt.be>
6
6
  Project-URL: Homepage, https://github.com/vdbergh/vtjson
@@ -206,7 +206,7 @@ class SchemaError(Exception):
206
206
  pass
207
207
 
208
208
 
209
- __version__ = "2.2.7"
209
+ __version__ = "2.2.8"
210
210
 
211
211
 
212
212
  @dataclass
@@ -543,6 +543,8 @@ class _union(compiled_schema):
543
543
  strict: bool = True,
544
544
  subs: Mapping[str, object] = {},
545
545
  ) -> str:
546
+ if len(self.schemas) == 0:
547
+ return _wrong_type_message(obj, name, "union()")
546
548
  messages = []
547
549
  for schema in self.schemas:
548
550
  message = schema.__validate__(obj, name=name, strict=strict, subs=subs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vtjson
3
- Version: 2.2.7
3
+ Version: 2.2.8
4
4
  Summary: An easy to use validation library compatible with Python type annotations
5
5
  Author-email: Michel Van den Bergh <michel.vandenbergh@uhasselt.be>
6
6
  Project-URL: Homepage, https://github.com/vdbergh/vtjson
@@ -712,6 +712,11 @@ class TestValidation(unittest.TestCase):
712
712
  validate(schema, object_)
713
713
  show(mc)
714
714
 
715
+ schema = union()
716
+ with self.assertRaises(ValidationError) as mc:
717
+ validate(schema, object_)
718
+ show(mc)
719
+
715
720
  def test_set_label(self) -> None:
716
721
  schema: object
717
722
  object_: object
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes