| 1 |
Revalidation with an or breaks lookup: |
| 2 |
based on: strictyaml |
| 3 |
given: |
| 4 |
yaml_snippet: | |
| 5 |
x: |
| 6 |
a: b |
| 7 |
setup: | |
| 8 |
from strictyaml import load, Any, Int, Str, Map |
| 9 |
loose_schema = Map({"x": Any()}) |
| 10 |
strict_schema = Str() | Map({"a": Str()}) |
| 11 |
steps: |
| 12 |
- run: | |
| 13 |
parsed = load(yaml_snippet, loose_schema) |
| 14 |
parsed['x'].revalidate(strict_schema) |
| 15 |
parsed['x']['a'] = "x" |
| 16 |
assert parsed['x']['a'] == "x" |
| 17 |
|
| 18 |
Parsing string with data shouldn't resolve to ruamel data structures: |
| 19 |
based on: strictyaml |
| 20 |
given: |
| 21 |
yaml_snippet: 'x: |\n x' |
| 22 |
setup: | |
| 23 |
from strictyaml import load |
| 24 |
from strictyaml.ruamel.scalarstring import ScalarString |
| 25 |
steps: |
| 26 |
- run: | |
| 27 |
assert not isinstance(load("- >\n hello").data[0], ScalarString) |