mh CmdMixin - added ArgFormat.BOOLEAN_NOT and logic (#3290) (#3294)

* mh CmdMixin - added ArgFormat.BOOLEAN_NOT and logic

* added changelog fragment

(cherry picked from commit df8fdcda79)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2021-08-29 13:20:01 +02:00 committed by GitHub
parent 7aaf8cf496
commit 09e2f77289
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View file

@ -24,6 +24,12 @@ ARG_FORMATS = dict(
False, []),
simple_boolean_none=("--superflag", ArgFormat.BOOLEAN, 0,
None, []),
simple_boolean_not_true=("--superflag", ArgFormat.BOOLEAN_NOT, 0,
True, []),
simple_boolean_not_false=("--superflag", ArgFormat.BOOLEAN_NOT, 0,
False, ["--superflag"]),
simple_boolean_not_none=("--superflag", ArgFormat.BOOLEAN_NOT, 0,
None, ["--superflag"]),
single_printf=("--param=%s", ArgFormat.PRINTF, 0,
"potatoes", ["--param=potatoes"]),
single_printf_no_substitution=("--param", ArgFormat.PRINTF, 0,
@ -65,7 +71,7 @@ def test_arg_format(fmt, style, stars, value, expected):
af = ArgFormat('name', fmt, style, stars)
actual = af.to_text(value)
print("formatted string = {0}".format(actual))
assert actual == expected
assert actual == expected, "actual = {0}".format(actual)
ARG_FORMATS_FAIL = dict(
@ -218,7 +224,7 @@ CAUSE_CHG_DECO_IDS = sorted(CAUSE_CHG_DECO.keys())
@pytest.mark.parametrize(CAUSE_CHG_DECO_PARAMS,
[[CAUSE_CHG_DECO[tc][param]
for param in CAUSE_CHG_DECO_PARAMS]
for param in CAUSE_CHG_DECO_PARAMS]
for tc in CAUSE_CHG_DECO_IDS],
ids=CAUSE_CHG_DECO_IDS)
def test_cause_changes_deco(method, expect_exception, expect_changed):