def test_from_yaml_strings():
    a = '''
foo:
  bar: 1
baz: 3
'''
    b = '''
foo:
  one: "one"
other: 4
'''
    c = '''
final: "result"
'''
    preset = PresetDefinition.from_yaml_strings('passing', [a, b, c])
    assert preset.run_config == {
        'foo': {
            'bar': 1,
            'one': 'one'
        },
        'baz': 3,
        'other': 4,
        'final': 'result',
    }
    with pytest.raises(DagsterInvariantViolationError,
                       match='Encountered error attempting to parse yaml'):
        PresetDefinition.from_yaml_strings('failing', ['--- `'])

    res = PresetDefinition.from_yaml_strings('empty')
    assert res == PresetDefinition(name='empty',
                                   run_config={},
                                   solid_selection=None,
                                   mode='default')
def test_from_yaml_strings():
    a = """
foo:
  bar: 1
baz: 3
"""
    b = """
foo:
  one: "one"
other: 4
"""
    c = """
final: "result"
"""
    preset = PresetDefinition.from_yaml_strings("passing", [a, b, c])
    assert preset.run_config == {
        "foo": {
            "bar": 1,
            "one": "one"
        },
        "baz": 3,
        "other": 4,
        "final": "result",
    }
    with pytest.raises(DagsterInvariantViolationError,
                       match="Encountered error attempting to parse yaml"):
        PresetDefinition.from_yaml_strings("failing", ["--- `"])

    res = PresetDefinition.from_yaml_strings("empty")
    assert res == PresetDefinition(name="empty",
                                   run_config={},
                                   solid_selection=None,
                                   mode="default")