def test_option_lines_check_is_option_subset_of_bad_option():
    outer_text = "weather :: fine | rain | showers"
    inner_text = "weather :: cloudy"
    opt_lines_outer = OptionLines(outer_text)
    opt_lines_inner = OptionLines(inner_text)
    with pytest.raises(OptionSubsetError) as exc:
        opt_lines_inner.check_is_option_subset_of(opt_lines_outer)
    assert exc.value.message.startswith("['cloudy'] not found in \"weather\" options")
def test_option_lines_check_is_option_subset_of_bad_key():
    outer_text = "weather :: fine | rain | showers"
    inner_text = "foo :: bar"
    opt_lines_outer = OptionLines(outer_text)
    opt_lines_inner = OptionLines(inner_text)
    with pytest.raises(OptionSubsetError) as exc:
        opt_lines_inner.check_is_option_subset_of(opt_lines_outer)
    assert exc.value.message.startswith('"foo" not found as option key')
def test_option_lines_check_is_option_subset_of():
    outer_text = """\
# environment, listing all possibilities.
availability :: am | eve | pm
internet     :: connected | offline
weather      :: fine | rain | showers"""
    inner_text = """\
internet     :: connected
weather      :: rain | showers"""
    opt_lines_outer = OptionLines(outer_text)
    opt_lines_inner = OptionLines(inner_text)
    # Raises exception if not subset
    opt_lines_inner.check_is_option_subset_of(opt_lines_outer)