Codegen: add set to schema definitions

This commit is contained in:
Paolo Tranquilli
2023-03-29 14:03:07 +02:00
parent 6dd45b31e1
commit bba5d9dbd6
4 changed files with 23 additions and 152 deletions

View File

@@ -167,6 +167,7 @@ def test_properties():
three: defs.list[defs.boolean]
four: defs.list[defs.optional[defs.string]]
five: defs.predicate
six: defs.set[defs.string]
assert data.classes == {
'A': schema.Class('A', properties=[
@@ -175,6 +176,7 @@ def test_properties():
schema.RepeatedProperty('three', 'boolean'),
schema.RepeatedOptionalProperty('four', 'string'),
schema.PredicateProperty('five'),
schema.RepeatedUnorderedProperty('six', 'string'),
]),
}
@@ -193,6 +195,7 @@ def test_class_properties():
two: defs.optional[A]
three: defs.list[A]
four: defs.list[defs.optional[A]]
five: defs.set[A]
assert data.classes == {
'A': schema.Class('A', derived={'B'}),
@@ -201,6 +204,7 @@ def test_class_properties():
schema.OptionalProperty('two', 'A'),
schema.RepeatedProperty('three', 'A'),
schema.RepeatedOptionalProperty('four', 'A'),
schema.RepeatedUnorderedProperty('five', 'A'),
]),
}
@@ -213,6 +217,7 @@ def test_string_reference_class_properties():
two: defs.optional["A"]
three: defs.list["A"]
four: defs.list[defs.optional["A"]]
five: defs.set["A"]
assert data.classes == {
'A': schema.Class('A', properties=[
@@ -220,6 +225,7 @@ def test_string_reference_class_properties():
schema.OptionalProperty('two', 'A'),
schema.RepeatedProperty('three', 'A'),
schema.RepeatedOptionalProperty('four', 'A'),
schema.RepeatedUnorderedProperty('five', 'A'),
]),
}