summaryrefslogtreecommitdiff
path: root/tests/files/success
diff options
context:
space:
mode:
Diffstat (limited to 'tests/files/success')
-rw-r--r--tests/files/success/test_anchor.yaml92
-rw-r--r--tests/files/success/test_assert.yaml28
-rw-r--r--tests/files/success/test_default.yaml0
-rw-r--r--tests/files/success/test_desc.yaml7
-rw-r--r--tests/files/success/test_enum.yaml12
-rw-r--r--tests/files/success/test_example.yaml5
-rw-r--r--tests/files/success/test_extensions.yaml0
-rw-r--r--tests/files/success/test_func.yaml0
-rw-r--r--tests/files/success/test_ident.yaml22
-rw-r--r--tests/files/success/test_include.yaml0
-rw-r--r--tests/files/success/test_length.yaml98
-rw-r--r--tests/files/success/test_mapping.yaml308
-rw-r--r--tests/files/success/test_matching.yaml0
-rw-r--r--tests/files/success/test_merge.yaml36
-rw-r--r--tests/files/success/test_name.yaml0
-rw-r--r--tests/files/success/test_nullable.yaml11
-rw-r--r--tests/files/success/test_pattern.yaml18
-rw-r--r--tests/files/success/test_range.yaml166
-rw-r--r--tests/files/success/test_required.yaml15
-rw-r--r--tests/files/success/test_schema.yaml0
-rw-r--r--tests/files/success/test_sequence.yaml44
-rw-r--r--tests/files/success/test_sequence_multi.yaml64
-rw-r--r--tests/files/success/test_type_any.yaml27
-rw-r--r--tests/files/success/test_type_bool.yaml39
-rw-r--r--tests/files/success/test_type_date.yaml40
-rw-r--r--tests/files/success/test_type_enum.yaml43
-rw-r--r--tests/files/success/test_type_float.yaml43
-rw-r--r--tests/files/success/test_type_int.yaml38
-rw-r--r--tests/files/success/test_type_map.yaml39
-rw-r--r--tests/files/success/test_type_none.yaml47
-rw-r--r--tests/files/success/test_type_number.yaml76
-rw-r--r--tests/files/success/test_type_scalar.yaml76
-rw-r--r--tests/files/success/test_type_seq.yaml36
-rw-r--r--tests/files/success/test_type_str.yaml56
-rw-r--r--tests/files/success/test_type_symbol.yaml0
-rw-r--r--tests/files/success/test_type_text.yaml75
-rw-r--r--tests/files/success/test_type_timestamp.yaml37
-rw-r--r--tests/files/success/test_unique.yaml138
-rw-r--r--tests/files/success/test_version.yaml5
39 files changed, 1741 insertions, 0 deletions
diff --git a/tests/files/success/test_anchor.yaml b/tests/files/success/test_anchor.yaml
new file mode 100644
index 0000000..fa53412
--- /dev/null
+++ b/tests/files/success/test_anchor.yaml
@@ -0,0 +1,92 @@
+##
+---
+name: anchor1
+desc: schema with anchor
+#
+schema:
+ type: seq
+ required: true
+ sequence:
+ - type: map
+ required: true
+ mapping:
+ first-name: &name
+ type: str
+ required: True
+ family-name: *name
+#
+data:
+ - first-name: foo
+ family-name: Foo
+ - first-name: bar
+ family-name: Bar
+##
+---
+name: anchor2
+desc: schema with anchor 2
+#
+schema:
+ type: map
+ required: true
+ mapping:
+ title: &name
+ type: str
+ required: true
+ address-book:
+ type: seq
+ required: true
+ sequence:
+ - type: map
+ mapping:
+ name: *name
+ email:
+ type: str
+ required: True
+#
+data:
+ title: my friends
+ address-book:
+ - name: foo
+ email: foo@mail.com
+ - name: bar
+ email: bar@mail.com
+#
+# TODO: THIS TEST IS BROKEN BECUASE IT CAUSE INFINITE RECURSION IN PYTHON
+#
+# ##
+# ---
+# name: anchor3
+# desc: document with anchor
+# #
+# schema:
+# type: seq
+# sequence:
+# - &employee
+# type: map
+# mapping:
+# name:
+# type: str
+# post:
+# type: str
+# enum:
+# - exective
+# - manager
+# - clerk
+# supervisor: *employee
+# #
+# data:
+# - &foo
+# name: foo
+# post: exective
+# - &bar
+# name: bar
+# post: manager
+# supervisor: *foo
+# - &baz
+# name: baz
+# post: clerk
+# supervisor: *bar
+# - &zak
+# name: zak
+# post: clerk
+# supervisor: *bar
diff --git a/tests/files/success/test_assert.yaml b/tests/files/success/test_assert.yaml
new file mode 100644
index 0000000..46b3ef3
--- /dev/null
+++ b/tests/files/success/test_assert.yaml
@@ -0,0 +1,28 @@
+##
+---
+name: assert1
+desc: assert test
+#
+schema:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ "less-than":
+ type: number
+ assert: val < 8
+ "more-than":
+ type: number
+ assert: 3 < val
+ "between":
+ type: number
+ assert: 3 < val and val < 8
+ "except":
+ type: number
+ assert: val < 3 or 8 < val
+#
+data:
+ - less-than: 5
+ - more-than: 5
+ - between: 5
+ - except: 0
diff --git a/tests/files/success/test_default.yaml b/tests/files/success/test_default.yaml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/files/success/test_default.yaml
diff --git a/tests/files/success/test_desc.yaml b/tests/files/success/test_desc.yaml
new file mode 100644
index 0000000..347a729
--- /dev/null
+++ b/tests/files/success/test_desc.yaml
@@ -0,0 +1,7 @@
+---
+name: desc-1
+desc: Test basic desc
+data: 'foobar'
+schema:
+ desc: This is a description...
+ type: str
diff --git a/tests/files/success/test_enum.yaml b/tests/files/success/test_enum.yaml
new file mode 100644
index 0000000..c583d42
--- /dev/null
+++ b/tests/files/success/test_enum.yaml
@@ -0,0 +1,12 @@
+---
+name: enum-1
+desc: Test simple enum
+data:
+ - A
+ - B
+ - O
+schema:
+ type: seq
+ sequence:
+ - type: str
+ enum: [A, B, O, AB]
diff --git a/tests/files/success/test_example.yaml b/tests/files/success/test_example.yaml
new file mode 100644
index 0000000..ee6965f
--- /dev/null
+++ b/tests/files/success/test_example.yaml
@@ -0,0 +1,5 @@
+---
+data: foo
+schema:
+ example: Foobar
+ type: str
diff --git a/tests/files/success/test_extensions.yaml b/tests/files/success/test_extensions.yaml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/files/success/test_extensions.yaml
diff --git a/tests/files/success/test_func.yaml b/tests/files/success/test_func.yaml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/files/success/test_func.yaml
diff --git a/tests/files/success/test_ident.yaml b/tests/files/success/test_ident.yaml
new file mode 100644
index 0000000..0f3c95c
--- /dev/null
+++ b/tests/files/success/test_ident.yaml
@@ -0,0 +1,22 @@
+##
+---
+name: ident1
+desc: ident constraint test
+#
+schema:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ "name":
+ ident: true
+ "age":
+ type: int
+#
+data:
+ - name: foo
+ age: 10
+ - name: bar
+ age: 10
+ - name: baz
+ age: 10
diff --git a/tests/files/success/test_include.yaml b/tests/files/success/test_include.yaml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/files/success/test_include.yaml
diff --git a/tests/files/success/test_length.yaml b/tests/files/success/test_length.yaml
new file mode 100644
index 0000000..1b8d7d8
--- /dev/null
+++ b/tests/files/success/test_length.yaml
@@ -0,0 +1,98 @@
+---
+name: length1
+desc: length test
+schema:
+ type: map
+ mapping:
+ "max-only":
+ type: seq
+ sequence:
+ - type: str
+ length:
+ max: 8
+ "min-only":
+ type: seq
+ sequence:
+ - type: str
+ length:
+ min: 4
+ "max-and-min":
+ type: seq
+ sequence:
+ - type: str
+ length:
+ max: 8
+ min: 4
+data:
+ max-only:
+ - hogehoge
+ - a
+ -
+ min-only:
+ - hoge
+ - hogehogehogehogehoge
+ max-and-min:
+ - hogehoge
+ - hoge
+---
+name: length2
+desc: length test (with max-ex and min-ex)
+schema:
+ type: map
+ mapping:
+ "max-ex-only":
+ type: seq
+ sequence:
+ - type: str
+ length:
+ max-ex: 8
+ "min-ex-only":
+ type: seq
+ sequence:
+ - type: str
+ length:
+ min-ex: 4
+ "max-ex-and-min-ex":
+ type: seq
+ sequence:
+ - type: str
+ length:
+ max-ex: 8
+ min-ex: 4
+data:
+ max-ex-only:
+ - hogehog
+ - a
+ -
+ min-ex-only:
+ - hoge!
+ max-ex-and-min-ex:
+ - hogehog
+ - hoge!
+---
+name: length3
+desc: length test (with min, max, max-ex and min-ex)
+schema:
+ type: map
+ mapping:
+ "A":
+ type: seq
+ sequence:
+ - type: str
+ length:
+ max: 8
+ min-ex: 4
+ "B":
+ type: seq
+ sequence:
+ - type: str
+ length:
+ max-ex: 8
+ min: 4
+data:
+ A:
+ - hogehoge
+ - hogeh
+ B:
+ - hogehog
+ - hoge
diff --git a/tests/files/success/test_mapping.yaml b/tests/files/success/test_mapping.yaml
new file mode 100644
index 0000000..fb82fd6
--- /dev/null
+++ b/tests/files/success/test_mapping.yaml
@@ -0,0 +1,308 @@
+---
+name: mapping1
+desc: Most basic mapping validation
+data:
+ foo: bar
+schema:
+ type: map
+ mapping:
+ foo:
+ type: str
+---
+name: mapping2
+desc: Complex mapping that test several subtypes for each key
+#
+schema:
+ type: map
+ required: true
+ mapping:
+ name:
+ type: str
+ required: true
+ email:
+ type: str
+ # This pattern value was modified from /@/ to .+@.+ to make it copmatible with python
+ pattern: .+@.+
+ required: True
+ age:
+ type: int
+ blood:
+ type: str
+ enum:
+ - A
+ - B
+ - O
+ - AB
+ birth:
+ type: date
+data:
+ name: foo
+ email: foo@mail.com
+ age: 20
+ blood: AB
+ birth: 1985-01-01
+---
+name: mapping3
+desc: Test that mapping works inside a sequence
+data:
+ - foo: True
+schema:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ foo:
+ type: bool
+---
+name: mapping4
+desc: Test that map inside seq inside map works
+data:
+ company: Kuwata lab.
+ email: webmaster@kuwata-lab.com
+ employees:
+ - code: 101
+ name: foo
+ email: foo@kuwata-lab.com
+ - code: 102
+ name: bar
+ email: bar@kuwata-lab.com
+schema:
+ type: map
+ mapping:
+ company:
+ type: str
+ required: True
+ email:
+ type: str
+ employees:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ code:
+ type: int
+ required: True
+ name:
+ type: str
+ required: True
+ email:
+ type: str
+---
+name: mapping5
+desc: test allowempty option to mapping
+data:
+ datasources:
+ test1: test1.py
+ test2: test2.py
+schema:
+ type: map
+ mapping:
+ datasources:
+ type: map
+ allowempty: True
+ mapping:
+ test1:
+ type: str
+---
+name: mapping6
+desc: Test that regex keys works
+data:
+ mic:
+ - input
+ - foo
+ mock:
+ - True
+ - False
+schema:
+ type: map
+ matching-rule: "any"
+ mapping:
+ re;(mi.+):
+ type: seq
+ sequence:
+ - type: str
+ regex;(mo.+):
+ type: seq
+ sequence:
+ - type: bool
+---
+name: mapping7
+desc: Test that mapping name works
+data:
+ datasources: test1.py
+schema:
+ type: map
+ mapping:
+ datasources:
+ type: str
+---
+name: mapping8
+desc: Test that map shortcut works
+data:
+ datasources: test1.py
+schema:
+ type: map
+ map:
+ datasources:
+ type: str
+---
+name: mapping9
+desc: Test that you do not have to specify type map
+data:
+ streams: foobar
+schema:
+ mapping:
+ streams:
+ type: str
+---
+name: mapping10
+desc: Test that you do not have to specify type map when map exists in schema
+data:
+ streams: foobar
+schema:
+ map:
+ streams:
+ type: str
+---
+name: mapping11
+desc: Test keyword regex default matching-rule any
+data:
+ foobar1: 1
+ foobar2: 2
+ bar2: 3
+schema:
+ type: map
+ mapping:
+ regex;([1-2]$):
+ type: int
+ regex;(^foobar):
+ type: int
+---
+name: mapping12
+desc: Test keyword regex declared matching-rule any
+data:
+ foobar1: 1
+ foobar2: 2
+ bar2: 3
+schema:
+ type: map
+ matching-rule: 'any'
+ mapping:
+ regex;([1-2]$):
+ type: int
+ regex;(^foobar):
+ type: int
+---
+name: mapping13
+desc: Test keyword regex declared matching-rule all
+data:
+ foobar1: 1
+ foobar2: 2
+ foobar3: 3
+schema:
+ type: map
+ matching-rule: 'all'
+ mapping:
+ regex;([1-3]$):
+ type: int
+ regex;(^foobar):
+ type: int
+---
+name: mapping14
+desc: Test mixed keyword regex and normal keyword
+data:
+ standard:
+ FRIST-800-53
+ AU-1:
+ family: AU
+ name: Audit and Accountability Policy and Procedures
+schema:
+ type: map
+ mapping:
+ regex;/[A-Z]-/:
+ type: map
+ mapping:
+ name:
+ type: str
+ family:
+ type: str
+ required: True
+ standard:
+ type: str
+---
+name: mapping-default-1
+desc: Test that default mapping keyword works out of the box in a good case
+data:
+ OWNERSHIP:
+ - code: 1
+ key: BLM-BURNS
+ alias: BLM-BURNS
+ WHT: foo
+schema:
+ type: map
+ mapping:
+ WHT:
+ type: str
+ =:
+ type: seq
+ required: true
+ sequence:
+ - type: map
+ mapping:
+ 'code':
+ type: int
+ required: true
+ unique: true
+ 'key':
+ type: str
+ required: true
+ 'alias':
+ type: str
+ required: true
+---
+name: mapping-default-2
+desc: default value of map with number type and no other key matching
+#
+schema:
+ type: map
+ mapping:
+ =:
+ type: number
+ range:
+ min: -10
+ max: 10
+#
+data:
+ value1: 0
+ value2: 10
+ value3: -10
+---
+name: mapping17
+desc: Test that allowempty works without specifying mapping keyword when used inside a sequence block
+data:
+ rally:
+ plugins:
+ - netcreate-boot: rally/rally-plugins/netcreate-boot
+schema:
+ type: map
+ mapping:
+ rally:
+ type: map
+ allowempty: True
+ mapping:
+ plugins:
+ type: seq
+ sequence:
+ - type: map
+ allowempty: True
+---
+name: mapping18
+desc: Test that regexes can be 'required'
+data:
+ person1: Jack
+ person2: Fred
+schema:
+ type: map
+ mapping:
+ regex;(person[1-9]):
+ required: True \ No newline at end of file
diff --git a/tests/files/success/test_matching.yaml b/tests/files/success/test_matching.yaml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/files/success/test_matching.yaml
diff --git a/tests/files/success/test_merge.yaml b/tests/files/success/test_merge.yaml
new file mode 100644
index 0000000..1e0a94d
--- /dev/null
+++ b/tests/files/success/test_merge.yaml
@@ -0,0 +1,36 @@
+##
+---
+name: merge1
+desc: merge maps
+#
+schema:
+ type: map
+ mapping:
+ "group":
+ type: map
+ mapping:
+ "name": &name
+ type: str
+ required: True
+ "email": &email
+ type: str
+ pattern: .+@.+
+ required: False
+ "user":
+ type: map
+ mapping:
+ "name":
+ <<: *name # merge
+ length:
+ max: 16 # add
+ "email":
+ <<: *email # merge
+ required: True # override
+#
+data:
+ group:
+ name: foo
+ email: foo@mail.com
+ user:
+ name: bar
+ email: bar@mail.com
diff --git a/tests/files/success/test_name.yaml b/tests/files/success/test_name.yaml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/files/success/test_name.yaml
diff --git a/tests/files/success/test_nullable.yaml b/tests/files/success/test_nullable.yaml
new file mode 100644
index 0000000..df8ddf8
--- /dev/null
+++ b/tests/files/success/test_nullable.yaml
@@ -0,0 +1,11 @@
+---
+name: nullable1
+desc: Test that nullable works
+data:
+ name:
+schema:
+ type: map
+ mapping:
+ name:
+ type: str
+ nullable: True
diff --git a/tests/files/success/test_pattern.yaml b/tests/files/success/test_pattern.yaml
new file mode 100644
index 0000000..41a751b
--- /dev/null
+++ b/tests/files/success/test_pattern.yaml
@@ -0,0 +1,18 @@
+---
+name: pattern1
+desc: Test simples pattern
+data: foo@gmail.com
+schema:
+ type: str
+ pattern: .+@.+
+---
+name: pattern2
+desc: Test simple pattern in list
+data:
+ - foo@mail.com
+ - bar@mail.net
+schema:
+ type: seq
+ sequence:
+ - type: str
+ pattern: .+@.+
diff --git a/tests/files/success/test_range.yaml b/tests/files/success/test_range.yaml
new file mode 100644
index 0000000..ef3c18a
--- /dev/null
+++ b/tests/files/success/test_range.yaml
@@ -0,0 +1,166 @@
+##
+---
+name: range1
+desc: range test && bug#?????
+#
+schema:
+ type: map
+ mapping:
+ "max-only":
+ type: seq
+ sequence:
+ - type: number
+ required: True
+ range: {max: 100}
+ "min-only":
+ type: seq
+ sequence:
+ - type: number
+ required: True
+ range: {min: 10.0}
+ "max-and-min":
+ type: seq
+ sequence:
+ - type: number
+ required: True
+ range: {max: 100.0, min: 10.0}
+#
+data:
+ max-only:
+ - 100
+ - 100.0
+ min-only:
+ - 10
+ - 10.0
+ max-and-min:
+ - 100
+ - 10
+ - 100.0
+ - 10.0
+##
+---
+name: range2
+desc: range test (with max-ex and min-ex)
+#
+schema:
+ type: map
+ mapping:
+ "max-ex-only":
+ type: seq
+ sequence:
+ - type: number
+ required: True
+ range: {max-ex: 100}
+ "min-ex-only":
+ type: seq
+ sequence:
+ - type: number
+ required: True
+ range: {min-ex: 10.0}
+ "max-ex-and-min-ex":
+ type: seq
+ sequence:
+ - type: number
+ required: True
+ range: {max-ex: 100.0, min-ex: 10.0}
+#
+data:
+ max-ex-only:
+ - 99
+ - 99.99999
+ min-ex-only:
+ - 11
+ - 10.00001
+ max-ex-and-min-ex:
+ - 99
+ - 11
+ - 99.99999
+ - 10.00001
+##
+---
+name: range3
+desc: range test (with max, min, max-ex and min-ex)
+#
+schema:
+ type: map
+ mapping:
+ "A":
+ type: seq
+ sequence:
+ - type: number
+ required: True
+ range: {max: 100, min-ex: 10.0}
+ "B":
+ type: seq
+ sequence:
+ - type: number
+ required: True
+ range: {min: 10, max-ex: 100.0}
+#
+data:
+ A:
+ - 100
+ - 10.00001
+ B:
+ - 10
+ - 99.99999
+---
+name: range4
+desc: Test range min/max works with map size
+data:
+ foo: bar
+schema:
+ type: map
+ range:
+ min: 1
+ max: 3
+ mapping:
+ foo:
+ type: str
+---
+name: range5
+desc: Test range works with seq
+data:
+ - foobar
+ - barfoo
+schema:
+ type: seq
+ range:
+ min: 1
+ max: 3
+ sequence:
+ - type: str
+---
+name: range6
+desc: test range on float type
+data:
+ 2.0
+schema:
+ type: float
+ range:
+ min: 1
+ max: 3
+---
+name: range7
+desc: Test range on float with negative boundary
+data:
+ -0.9
+schema:
+ type: float
+ range:
+ min: -1
+ max: 1.0
+---
+name: range8
+desc: Test range min-ex & max-ex
+data:
+ - 20
+ - 25
+ - 29
+schema:
+ type: seq
+ sequence:
+ - type: int
+ range:
+ max-ex: 30
+ min-ex: 18
diff --git a/tests/files/success/test_required.yaml b/tests/files/success/test_required.yaml
new file mode 100644
index 0000000..9787843
--- /dev/null
+++ b/tests/files/success/test_required.yaml
@@ -0,0 +1,15 @@
+---
+name: required1
+desc: Test that req and required works
+data:
+ name: foo
+ foo: bar
+schema:
+ type: map
+ mapping:
+ name:
+ type: str
+ req: True
+ foo:
+ type: str
+ required: True
diff --git a/tests/files/success/test_schema.yaml b/tests/files/success/test_schema.yaml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/files/success/test_schema.yaml
diff --git a/tests/files/success/test_sequence.yaml b/tests/files/success/test_sequence.yaml
new file mode 100644
index 0000000..3a4491f
--- /dev/null
+++ b/tests/files/success/test_sequence.yaml
@@ -0,0 +1,44 @@
+##
+---
+name: sequence1
+desc: sequence test
+#
+schema:
+ type: seq
+ sequence:
+ - type: str
+data:
+ - foo
+ - bar
+ - baz
+---
+name: sequence2
+desc: test sequence showrtcut
+schema:
+ type: seq
+ seq:
+ - type: str
+data:
+ - foo
+ - bar
+ - baz
+---
+name: sequence3
+desc: Test that you do not have to specify type seq when keyword sequence is present
+data:
+ - foo
+ - bar
+ - foobar
+schema:
+ sequence:
+ - type: str
+---
+name: sequence4
+desc: Test that you do not have to specify type seq when keyword seq is present
+data:
+ - foo
+ - bar
+ - foobar
+schema:
+ seq:
+ - type: str
diff --git a/tests/files/success/test_sequence_multi.yaml b/tests/files/success/test_sequence_multi.yaml
new file mode 100644
index 0000000..432145c
--- /dev/null
+++ b/tests/files/success/test_sequence_multi.yaml
@@ -0,0 +1,64 @@
+---
+name: seq-multi-1
+desc: Test that multiple sequence values is supported
+data:
+ - "foo"
+ - 123
+schema:
+ type: seq
+ matching: "any"
+ seq:
+ - type: str
+ - type: int
+---
+name: seq-multi-2
+desc: Test that multiple sequence values with matching 'all' is supported
+data:
+ - "foo"
+ - "123"
+schema:
+ type: seq
+ matching: "all"
+ seq:
+ - type: str
+ - type: str
+---
+name: seq-multi-3
+desc: Test that multiple sequence values with matching '*' is supported
+data:
+ - "foo"
+schema:
+ type: seq
+ matching: "*"
+ seq:
+ - type: bool
+ - type: int
+---
+name: seq-multi-4
+desc: Test that multiple sequence values with nested data structures work
+data:
+ - foo: 123
+ - "foobar"
+schema:
+ type: seq
+ matching: "any"
+ seq:
+ - type: str
+ - type: map
+ mapping:
+ foo:
+ type: int
+---
+name: sq-multi-5
+desc: Test that multiple sequence vlaues with nested lists works
+data:
+ - - 123
+ - "foobar"
+schema:
+ type: seq
+ matching: "any"
+ seq:
+ - type: str
+ - type: seq
+ sequence:
+ - type: int
diff --git a/tests/files/success/test_type_any.yaml b/tests/files/success/test_type_any.yaml
new file mode 100644
index 0000000..cc015e4
--- /dev/null
+++ b/tests/files/success/test_type_any.yaml
@@ -0,0 +1,27 @@
+---
+name: type-any-1
+desc: test simples case of any type
+data: abc
+schema:
+ type: any
+---
+name: type-any-2
+desc: test any type inside sequence
+data:
+ - abc
+ - 123
+ - 3.14159
+ - True
+schema:
+ type: seq
+ sequence:
+ - type: any
+---
+name: type-any-3
+desc: test any type validates a dict
+data:
+ foobar:
+ barfoo:
+ opa: 1337
+schema:
+ type: any
diff --git a/tests/files/success/test_type_bool.yaml b/tests/files/success/test_type_bool.yaml
new file mode 100644
index 0000000..4857690
--- /dev/null
+++ b/tests/files/success/test_type_bool.yaml
@@ -0,0 +1,39 @@
+---
+name: bool1
+desc: Test simples bool value
+data: True
+schema:
+ type: bool
+---
+name: bool2
+desc: Test bool value inside list
+data:
+ - True
+ - False
+schema:
+ type: seq
+ sequence:
+ - type: bool
+---
+name: bool3
+desc: Test bool value in mapping
+data:
+ foo: True
+schema:
+ type: map
+ mapping:
+ foo:
+ type: bool
+---
+name: bool4
+desc: Test bool inside nested map & seq
+data:
+ foo:
+ - True
+schema:
+ type: map
+ mapping:
+ foo:
+ type: seq
+ sequence:
+ - type: bool
diff --git a/tests/files/success/test_type_date.yaml b/tests/files/success/test_type_date.yaml
new file mode 100644
index 0000000..b6166e6
--- /dev/null
+++ b/tests/files/success/test_type_date.yaml
@@ -0,0 +1,40 @@
+---
+name: type-date-1
+desc: basic test for date type with default formats
+data: "2017-01-01"
+schema:
+ type: date
+---
+name: type-date-2
+desc: Basic test for date type with defined date-formats
+data: "31-01-2017"
+schema:
+ type: date
+ format: "%d-%m-%Y"
+---
+name: type-date-3
+desc: Basic test for date type with defined date-formats
+data:
+ - "31-01-2017"
+ - "2017-01-31"
+schema:
+ type: seq
+ sequence:
+ - type: date
+ format:
+ - "%d-%m-%Y"
+ - "%Y-%m-%d"
+---
+name: type-data-4
+desc: Basic test for many different possible values with default formats
+data:
+ - '1997'
+ - '1997-07'
+ - '1997-07-16'
+ - '1997-07-16T19:20+01:00'
+ - '1997-07-16T19:20:30+01:00'
+ - '1997-07-16T19:20:30.45+01:00'
+schema:
+ type: seq
+ sequence:
+ - type: date
diff --git a/tests/files/success/test_type_enum.yaml b/tests/files/success/test_type_enum.yaml
new file mode 100644
index 0000000..bde9bd7
--- /dev/null
+++ b/tests/files/success/test_type_enum.yaml
@@ -0,0 +1,43 @@
+---
+name: type-enum-1
+desc: Test the most basic case for enum
+data: C
+schema:
+ type: str
+ enum: [A, B, C, D, E]
+---
+name: type-enum-2
+desc: Test bool value inside list
+data:
+ - B
+ - C
+schema:
+ type: seq
+ sequence:
+ - type: str
+ enum: [A, B, C, D, E]
+---
+name: type-enum-3
+desc: Test bool value in mapping
+data:
+ foo: A
+schema:
+ type: map
+ mapping:
+ foo:
+ type: str
+ enum: [A, B, C, D, E]
+---
+name: type-enum-4
+desc: Test bool inside nested map & seq
+data:
+ foo:
+ - C
+schema:
+ type: map
+ mapping:
+ foo:
+ type: seq
+ sequence:
+ - type: str
+ enum: [A, B, C, D, E]
diff --git a/tests/files/success/test_type_float.yaml b/tests/files/success/test_type_float.yaml
new file mode 100644
index 0000000..ffd1bba
--- /dev/null
+++ b/tests/files/success/test_type_float.yaml
@@ -0,0 +1,43 @@
+---
+name: float1
+desc: Test simples float value
+data: 3.14159
+schema:
+ type: float
+---
+name: float2
+desc: Test float value inside list
+data:
+ - 1
+ - 3.14159
+schema:
+ type: seq
+ sequence:
+ - type: float
+---
+name: float3
+desc: Test float value in mapping
+data:
+ foo: 3.14159
+ bar: 1
+schema:
+ type: map
+ mapping:
+ foo:
+ type: float
+ bar:
+ type: float
+---
+name: float4
+desc: Test float inside nested map & seq
+data:
+ foo:
+ - 1
+ - 3.14159
+schema:
+ type: map
+ mapping:
+ foo:
+ type: seq
+ sequence:
+ - type: float
diff --git a/tests/files/success/test_type_int.yaml b/tests/files/success/test_type_int.yaml
new file mode 100644
index 0000000..93dd805
--- /dev/null
+++ b/tests/files/success/test_type_int.yaml
@@ -0,0 +1,38 @@
+---
+name: int1
+desc: Test simples int value
+data: 1
+schema:
+ type: int
+---
+name: int2
+desc: Test int value inside list
+data:
+ - 1
+schema:
+ type: seq
+ sequence:
+ - type: int
+---
+name: int3
+desc: Test int value in mapping
+data:
+ foo: 1
+schema:
+ type: map
+ mapping:
+ foo:
+ type: int
+---
+name: int4
+desc: Test int inside nested map & seq
+data:
+ foo:
+ - 1
+schema:
+ type: map
+ mapping:
+ foo:
+ type: seq
+ sequence:
+ - type: int
diff --git a/tests/files/success/test_type_map.yaml b/tests/files/success/test_type_map.yaml
new file mode 100644
index 0000000..010b0e9
--- /dev/null
+++ b/tests/files/success/test_type_map.yaml
@@ -0,0 +1,39 @@
+---
+name: type-map-1
+desc: Test the most basic case for map
+data:
+ foo: bar
+schema:
+ type: map
+ mapping:
+ foo:
+ type: str
+---
+name: type-map-2
+desc:
+data:
+ - foo: bar
+ - foo: bar
+schema:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ foo:
+ type: str
+---
+name: type-map-3
+desc: Test bool inside nested map & seq
+data:
+ foo:
+ - bar: foobar
+schema:
+ type: map
+ mapping:
+ foo:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ bar:
+ type: str
diff --git a/tests/files/success/test_type_none.yaml b/tests/files/success/test_type_none.yaml
new file mode 100644
index 0000000..db65652
--- /dev/null
+++ b/tests/files/success/test_type_none.yaml
@@ -0,0 +1,47 @@
+#
+# NOTE: This case is not allowed becuase Core class do NOT allow
+# there is no data to validate. This happens if None is at top level
+# of the data structure.
+#
+# ---
+# name: type-none-1
+# desc: Most basic test for type None
+# data: ~
+# schema:
+# type: none
+---
+name: type-none-2
+desc: Test that none type works with none type as value in map
+data:
+ name: ~
+schema:
+ type: map
+ mapping:
+ name:
+ type: none
+---
+name: type-none-3
+desc: Test that none type works as value in sequence
+data:
+ - ~
+ - ~
+schema:
+ type: seq
+ sequence:
+ - type: none
+---
+name: type-none-4
+desc: Test that none type works inside nested map, seq, map
+data:
+ foo:
+ - bar: ~
+schema:
+ type: map
+ mapping:
+ foo:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ bar:
+ type: none
diff --git a/tests/files/success/test_type_number.yaml b/tests/files/success/test_type_number.yaml
new file mode 100644
index 0000000..f0b5cb4
--- /dev/null
+++ b/tests/files/success/test_type_number.yaml
@@ -0,0 +1,76 @@
+---
+name: type-number-1
+desc: Most basic test for type number
+data: '1337.0'
+schema:
+ type: number
+---
+name: type-number-2
+desc: Test that number type works with as value in map
+data:
+ foo: 1337
+ bar: 3.14159
+ qwe: 0.0
+ rty: '1337'
+ ewq: '3.14159'
+ dsa: '0.0'
+schema:
+ type: map
+ mapping:
+ foo:
+ type: number
+ bar:
+ type: number
+ qwe:
+ type: number
+ rty:
+ type: number
+ ewq:
+ type: number
+ dsa:
+ type: number
+---
+name: type-number-3
+desc: Test that different number values works as values in seq
+data:
+ - 1337
+ - 3.14159
+ - 0.0
+ - '1337'
+ - '3.14159'
+ - '0.0'
+schema:
+ type: seq
+ sequence:
+ - type: number
+---
+name: type-number-4
+desc: Test that number type works inside nested map, seq, map
+data:
+ foobar:
+ - foo: 1337
+ bar: 3.14159
+ qwe: 0.0
+ rty: '1337'
+ ewq: '3.14159'
+ dsa: '0.0'
+schema:
+ type: map
+ mapping:
+ foobar:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ foo:
+ type: number
+ bar:
+ type: number
+ qwe:
+ type: number
+ rty:
+ type: number
+ ewq:
+ type: number
+ dsa:
+ type: number
diff --git a/tests/files/success/test_type_scalar.yaml b/tests/files/success/test_type_scalar.yaml
new file mode 100644
index 0000000..da34401
--- /dev/null
+++ b/tests/files/success/test_type_scalar.yaml
@@ -0,0 +1,76 @@
+---
+name: type-scalar-1
+desc: Most basic test for type scalar
+data: '1337.0'
+schema:
+ type: scalar
+---
+name: type-scalar-2
+desc: Test that scalar type works with as value in map
+data:
+ foo: 1337
+ bar: 3.14159
+ qwe: True
+ rty: '1337'
+ ewq: '3.14159'
+ dsa: '0.0'
+schema:
+ type: map
+ mapping:
+ foo:
+ type: scalar
+ bar:
+ type: scalar
+ qwe:
+ type: scalar
+ rty:
+ type: scalar
+ ewq:
+ type: scalar
+ dsa:
+ type: scalar
+---
+name: type-scalar-3
+desc: Test that different scalar values works as values in seq
+data:
+ - 1337
+ - 3.14159
+ - True
+ - '1337'
+ - '3.14159'
+ - '0.0'
+schema:
+ type: seq
+ sequence:
+ - type: scalar
+---
+name: type-scalar-4
+desc: Test that scalar type works inside nested map, seq, map
+data:
+ foobar:
+ - foo: 1337
+ bar: 3.14159
+ qwe: True
+ rty: '1337'
+ ewq: '3.14159'
+ dsa: '0.0'
+schema:
+ type: map
+ mapping:
+ foobar:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ foo:
+ type: scalar
+ bar:
+ type: scalar
+ qwe:
+ type: scalar
+ rty:
+ type: scalar
+ ewq:
+ type: scalar
+ dsa:
+ type: scalar
diff --git a/tests/files/success/test_type_seq.yaml b/tests/files/success/test_type_seq.yaml
new file mode 100644
index 0000000..5eb1b16
--- /dev/null
+++ b/tests/files/success/test_type_seq.yaml
@@ -0,0 +1,36 @@
+---
+name: type-seq-1
+desc: Test the most basic case for seq
+data:
+ - foo
+schema:
+ type: seq
+ sequence:
+ - type: str
+---
+name: type-seq-2
+desc: Test that seq in seq works
+data:
+ - - True
+ - - False
+schema:
+ type: seq
+ sequence:
+ - type: seq
+ sequence:
+ - type: bool
+---
+name: type-seq-3
+desc: Test bool inside nested map & seq
+data:
+ - foo:
+ - True
+schema:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ foo:
+ type: seq
+ sequence:
+ - type: bool
diff --git a/tests/files/success/test_type_str.yaml b/tests/files/success/test_type_str.yaml
new file mode 100644
index 0000000..e5717c9
--- /dev/null
+++ b/tests/files/success/test_type_str.yaml
@@ -0,0 +1,56 @@
+---
+name: str1
+desc: Test simples str value
+data: "foobar"
+schema:
+ type: str
+---
+name: str2
+desc: Test str value inside list
+data:
+ - 'foo'
+ - bar
+schema:
+ type: seq
+ sequence:
+ - type: str
+---
+name: str3
+desc: Test str value in mapping
+data:
+ foo: 'foobar'
+schema:
+ type: map
+ mapping:
+ foo:
+ type: str
+---
+name: str4
+desc: Test str inside nested map & seq
+data:
+ foo:
+ - 'foo'
+schema:
+ type: map
+ mapping:
+ foo:
+ type: seq
+ sequence:
+ - type: str
+---
+name: deftype1
+desc: default type test. Becuase str is the default type it is in this file.
+#
+schema:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ "name":
+ "email":
+#
+data:
+ - name: foo
+ email: foo@mail.com
+ - name: bar
+ - email: baz@mail.com
diff --git a/tests/files/success/test_type_symbol.yaml b/tests/files/success/test_type_symbol.yaml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/files/success/test_type_symbol.yaml
diff --git a/tests/files/success/test_type_text.yaml b/tests/files/success/test_type_text.yaml
new file mode 100644
index 0000000..7f218e2
--- /dev/null
+++ b/tests/files/success/test_type_text.yaml
@@ -0,0 +1,75 @@
+---
+name: type-text-1
+desc: Test simples text type
+data: "foobar"
+schema:
+ type: text
+---
+name: type-text-2
+desc: Test possible values as values in seq
+data:
+ - 'abc'
+ - '1337'
+ - '3.14159'
+ - 1337
+ - 3.14159
+schema:
+ type: seq
+ sequence:
+ - type: text
+---
+name: type-text-3
+desc: Test possible values as values in map
+data:
+ foo: 1337
+ bar: 3.14159
+ qwe: 'abc'
+ rty: '1337'
+ ewq: '3.14159'
+ dsa: '0.0'
+schema:
+ type: map
+ mapping:
+ foo:
+ type: text
+ bar:
+ type: text
+ qwe:
+ type: text
+ rty:
+ type: text
+ ewq:
+ type: text
+ dsa:
+ type: text
+---
+name: type-text-4
+desc: Test that text type works inside nested map, seq, map
+data:
+ foobar:
+ - foo: 1337
+ bar: 3.14159
+ qwe: 'abc'
+ rty: '1337'
+ ewq: '3.14159'
+ dsa: '0.0'
+schema:
+ type: map
+ mapping:
+ foobar:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ foo:
+ type: text
+ bar:
+ type: text
+ qwe:
+ type: text
+ rty:
+ type: text
+ ewq:
+ type: text
+ dsa:
+ type: text
diff --git a/tests/files/success/test_type_timestamp.yaml b/tests/files/success/test_type_timestamp.yaml
new file mode 100644
index 0000000..5bcfbcc
--- /dev/null
+++ b/tests/files/success/test_type_timestamp.yaml
@@ -0,0 +1,37 @@
+---
+name: type-timestamp-1
+desc: Most basic timestamp test
+data: "2015-03-29T18:45:00+00:00"
+schema:
+ type: timestamp
+---
+name: type-timestamp-2
+desc: Test timestamps as values in seq
+data:
+ - "2015-03-29T18:45:00+00:00"
+ - "2015-03-29T18:45:00"
+ - "2015-03-29T11:45:00 -0700"
+ - "2015-03-29"
+schema:
+ type: seq
+ sequence:
+ - type: timestamp
+---
+name: type-timestamp-3
+desc: Basic test of different types of timestamps
+data:
+ d1: "2015-03-29T18:45:00+00:00"
+ d2: "2015-03-29T18:45:00"
+ d3: "2015-03-29T11:45:00 -0700"
+ d4: "2015-03-29"
+schema:
+ type: map
+ mapping:
+ d1:
+ type: timestamp
+ d2:
+ type: timestamp
+ d3:
+ type: timestamp
+ d4:
+ type: timestamp
diff --git a/tests/files/success/test_unique.yaml b/tests/files/success/test_unique.yaml
new file mode 100644
index 0000000..20cb64f
--- /dev/null
+++ b/tests/files/success/test_unique.yaml
@@ -0,0 +1,138 @@
+---
+name: unique1
+desc: unique constraint test with map
+#
+schema:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ "name":
+ unique: true
+ "age":
+ type: int
+#
+data:
+ - name: foo
+ age: 10
+ - name: bar
+ age: 10
+ - name: baz
+ age: 10
+---
+name: unique2
+desc: unique constraint test with seq
+#
+schema:
+ type: seq
+ sequence:
+ - type: str
+ unique: true
+#
+data:
+ - foo
+ - ~
+ - bar
+ - ~
+ - baz
+---
+name: unique3
+desc: unique constraint and '<<' (merge)
+#
+schema:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ "name":
+ type: str
+ required: True
+ unique: true
+ "value":
+ type: any
+ required: True
+#
+data:
+ # no sense
+ - name: x1
+ value: 10
+ - name: x2
+ value: 20
+---
+name: unique4
+desc: unique constrant and anchor
+#
+schema:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ "name":
+ type: str
+ "value":
+ type: any
+#
+data:
+ # no sense
+ - name: x1
+ value: 10
+ - name: x2
+ value: 20
+---
+name: unique5
+desc: unique constring in nested data structures
+data:
+ - name: foo
+ email: admin@mail.com
+ groups:
+ - users
+ - foo
+ - admin
+ - name: bar
+ email: admin@mail.com
+ groups:
+ - users
+ - admin
+ - name: baz
+ email: baz@mail.com
+ groups:
+ - users
+schema:
+ type: seq
+ sequence:
+ - type: map
+ required: True
+ mapping:
+ name:
+ type: str
+ required: True
+ unique: True
+ email:
+ type: str
+ groups:
+ type: seq
+ sequence:
+ - type: str
+ unique: True
+---
+name: unique6
+desc: Test that unique do not fail when the key it tries to lookup is missing
+data:
+ - xref: 'GOC:hm'
+ uri: 'GOC:hm'
+ - uri: 'http://orcid.org/0000-0002-4862-3181'
+schema:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ "uri":
+ type: str
+ required: true
+ unique: true
+ pattern: ^((ht|f)tp(s?)\:\/\/\w[\/\.\-\:\w]+)|(GOC\:[\w\_]+)$
+ "xref":
+ type: str
+ required: false
+ unique: true
+ pattern: ^\w+:\w+$
diff --git a/tests/files/success/test_version.yaml b/tests/files/success/test_version.yaml
new file mode 100644
index 0000000..32621ba
--- /dev/null
+++ b/tests/files/success/test_version.yaml
@@ -0,0 +1,5 @@
+---
+data: foo
+schema:
+ version: 1.0.0
+ type: str