def test_lightning_arguments(ignore_required_init_args, dm_cls, model_cls, a, b, c, d):
    parser = LightningArgumentParser(ignore_required_init_args=ignore_required_init_args)
    parser.add_object_args("dm", dm_cls)
    parser.add_object_args("model", model_cls)

    mocked_args = f"""
        --a 1
        --b {b}
        --c {c}
        --d {d}
    """.strip().split()
    args = parser.parse_lit_args(mocked_args)
    assert vars(args.dm)["c"] == vars(args.model)["c"] == c
    assert "d" not in args.dm
def test_parser_bad_argument():
    parser = LightningArgumentParser()
    parser.add_object_args('dm', DummyParentDataModule)
    parser.add_object_args('model', DummyParentModel)
    args = parser.parse_lit_args(['--some-bad-arg', 'asdf'])
def test_lightning_argument_parser():
    parser = LightningArgumentParser(ignore_required_init_args=False)
    assert parser.ignore_required_init_args is False
    parser = LightningArgumentParser(ignore_required_init_args=True)
    assert parser.ignore_required_init_args is True
def test_parser_bad_argument():
    parser = LightningArgumentParser()
    parser.add_object_args("dm", DummyParentDataModule)
    parser.add_object_args("model", DummyParentModel)
    parser.parse_lit_args(["--some-bad-arg", "asdf"])