| 1 | from textwrap import dedent |
| 2 | |
| 3 | from cyclopts.config._yaml import Yaml |
| 4 | |
| 5 | |
| 6 | def test_config_yaml(tmp_path): |
| 7 | fn = tmp_path / "test.yaml" |
| 8 | fn.write_text( |
| 9 | dedent( |
| 10 | """\ |
| 11 | foo: |
| 12 | key1: foo1 |
| 13 | key2: foo2 |
| 14 | |
| 15 | function1: |
| 16 | key1: bar1 |
| 17 | key2: bar2 |
| 18 | """ |
| 19 | ) |
| 20 | ) |
| 21 | config = Yaml(fn) |
| 22 | assert config.config == { |
| 23 | "foo": { |
| 24 | "key1": "foo1", |
| 25 | "key2": "foo2", |
| 26 | "function1": { |
| 27 | "key1": "bar1", |
| 28 | "key2": "bar2", |
| 29 | }, |
| 30 | } |
| 31 | } |