Skip to content

Commit

Permalink
Add test for arg validation with invalid dalle size
Browse files Browse the repository at this point in the history
  • Loading branch information
ReinderVosDeWael committed Dec 13, 2023
1 parent 7635309 commit 2215fb4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/unit/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
(0, True),
(-1, True),
(1.0, False),
(1.2, True),
],
)
def test__positive_int(value: float | int, will_raise: bool) -> None: # noqa: PYI041
Expand Down Expand Up @@ -261,3 +262,22 @@ async def test_parse_args_with_command_no_other_arguments(
with pytest.raises(SystemExit) as excinfo:
await parser.parse_args()
assert excinfo.value.code == expected_error_code


@pytest.mark.parametrize(
"size",
[
"256x256",
"512x512",
],
)
def test__arg_validation_invalid_dalle_size(size: str) -> None:
"""Tests the _arg_validation function with an invalid dalle size."""
args = argparse.Namespace(
command="dalle",
model="dall-e-3",
size="256x256",
)

with pytest.raises(exceptions.InvalidArgumentError):
parser._arg_validation(args)

0 comments on commit 2215fb4

Please sign in to comment.