handle single arg to and/or (#5637)

@ryderwishart @eyurtsev thoughts on handling this in the parser itself?
related to #5570
This commit is contained in:
Davis Chase
2023-06-03 15:18:46 -07:00
committed by GitHub
parent 934319fc28
commit ae3611730a
2 changed files with 14 additions and 3 deletions

View File

@@ -114,3 +114,11 @@ def test_parse_bool_value(x: str) -> None:
actual = parsed.value
expected = x.lower() == "true"
assert actual == expected
@pytest.mark.parametrize("op", ("and", "or"))
@pytest.mark.parametrize("arg", ('eq("foo", 2)', 'and(eq("foo", 2), lte("bar", 1.1))'))
def test_parser_unpack_single_arg_operation(op: str, arg: str) -> None:
expected = DEFAULT_PARSER.parse(arg)
actual = DEFAULT_PARSER.parse(f"{op}({arg})")
assert expected == actual