test_args.py 613 B

123456789101112131415161718192021222324
  1. import pytest
  2. from aphrodite.common.utils import FlexibleArgumentParser
  3. from aphrodite.engine.args_tools import EngineArgs
  4. @pytest.mark.parametrize(("arg", "expected"), [
  5. (None, None),
  6. ("image=16", {
  7. "image": 16
  8. }),
  9. ("image=16,video=2", {
  10. "image": 16,
  11. "video": 2
  12. }),
  13. ])
  14. def test_limit_mm_per_prompt_parser(arg, expected):
  15. parser = EngineArgs.add_cli_args(FlexibleArgumentParser())
  16. if arg is None:
  17. args = parser.parse_args([])
  18. else:
  19. args = parser.parse_args(["--limit-mm-per-prompt", arg])
  20. assert args.limit_mm_per_prompt == expected