Skip to content

Commit

Permalink
add failure tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vict0rsch committed Dec 8, 2020
1 parent b8bfd6c commit 275371b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ def run(args):
return subprocess.run(COMMAND + args, capture_output=True).stdout.decode()


def fail(args):
assert isinstance(args, list)
return subprocess.run(COMMAND + args, capture_output=True).stderr.decode()


def capture(minydict):
f = io.StringIO()
with redirect_stdout(f):
Expand Down Expand Up @@ -50,4 +55,12 @@ def test_dotted():
assert run(["a.b.x=2"]) == capture(MinyDict({"a": {"b": {"x": 2}}}))


# TODO: add fail tests
def test_fail_equal():
assert "MinydraWrongArgumentException" in fail(["a="])
assert "MinydraWrongArgumentException" in fail(["="])
assert "MinydraWrongArgumentException" in fail(["a = b"])
assert "MinydraWrongArgumentException" in fail(["a= b"])


def test_fail_dot():
assert "MinydraWrongArgumentException" in fail([".a=3"])

0 comments on commit 275371b

Please sign in to comment.