-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix error message for empty/None: --warn-error-options handling (#7735)
- Loading branch information
1 parent
3b63dd9
commit 444c787
Showing
4 changed files
with
38 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Fixes | ||
body: Fix empty --warn-error-options error message | ||
time: 2023-05-30T10:42:28.382804-04:00 | ||
custom: | ||
Author: michelleark | ||
Issue: "7730" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from click import Option, BadParameter | ||
import pytest | ||
|
||
from dbt.cli.option_types import YAML | ||
|
||
|
||
class TestYAML: | ||
@pytest.mark.parametrize( | ||
"raw_value,expected_converted_value", | ||
[ | ||
("{}", {}), | ||
("{'test_var_key': 'test_var_value'}", {"test_var_key": "test_var_value"}), | ||
], | ||
) | ||
def test_yaml_init(self, raw_value, expected_converted_value): | ||
converted_value = YAML().convert(raw_value, Option(["--vars"]), None) | ||
assert converted_value == expected_converted_value | ||
|
||
@pytest.mark.parametrize( | ||
"invalid_yaml_str", | ||
["{", ""], | ||
) | ||
def test_yaml_init_invalid_yaml_str(self, invalid_yaml_str): | ||
with pytest.raises(BadParameter) as e: | ||
YAML().convert(invalid_yaml_str, Option(["--vars"]), None) | ||
assert "--vars" in e.value.format_message() |