def test_option_file_should_have_correct_default_values(metrics_mocks):
    """Test that the options for file have correct default values."""

    # arrange
    args = parse_arguments(["metrics", "--file", "db"])

    # act
    args.func(args)

    # assert
    metrics_mocks.file_mock.assert_called_with("db", "./reports", None, None)
def test_options_file_should_have_correct_values(metrics_mocks):
    """Test that the options for file have correct provided values."""

    # arrange
    args = parse_arguments(["metrics", "--file", "--output=/bla/reports", "--module=foo", "--sort=CountLine", "db"])

    # act
    args.func(args)

    # assert
    metrics_mocks.file_mock.assert_called_with("db", "/bla/reports", "foo", "CountLine")
def test_option_function_collects_only_function_metrics(metrics_mocks):
    """Test that only the function metrics are collected when the --function option is provided."""

    # arrange
    args = parse_arguments(["metrics", "--function", "db"])

    # act
    args.func(args)

    # assert
    metrics_mocks.file_mock.assert_not_called()
    metrics_mocks.function_mock.assert_called_once()
def test_option_complexity_performs_only_complexity_analysis(analysis_mocks):
    """Test that only the complexity analysis is performed when the --complexity option is provided."""
    # arrange
    args = parse_arguments(["analysis", "--complexity", "db"])

    # act
    args.func(args)

    # assert
    analysis_mocks.code_size_mock.assert_not_called()
    analysis_mocks.complexity_mock.assert_called_once()
    analysis_mocks.fan_in_mock.assert_not_called()
    analysis_mocks.fan_out_mock.assert_not_called()
    analysis_mocks.function_size_mock.assert_not_called()
    analysis_mocks.file_size_mock.assert_not_called()
    analysis_mocks.interface_mock.assert_not_called()