{
  "fixtures": [
    {
      "name": "renamed_function_reference",
      "description": "Function uses a name that was renamed — broken reference detected",
      "source": "def process():\n    return old_handler_xyz()\n",
      "filename": "refactored.py",
      "expected_rule": "broken_reference",
      "expected_passed": false,
      "expected_message_contains": "broken reference",
      "expected_data_contains": {"filename": "refactored.py"}
    },
    {
      "name": "missing_symbol_in_function",
      "description": "Function references a symbol that does not exist in any scope",
      "source": "def compute(x):\n    return x + missing_constant_xyz\n",
      "filename": "missing_api.py",
      "expected_rule": "missing_symbol",
      "expected_passed": false,
      "expected_message_contains": "missing symbol",
      "expected_data_contains": {"filename": "missing_api.py"}
    },
    {
      "name": "incompatible_type_usage",
      "description": "Calling an attribute on a string literal that does not exist — detectable as broken reference",
      "source": "def transform():\n    return nonexistent_transformer_xyz.convert()\n",
      "filename": "type_mismatch.py",
      "expected_rule": "broken_reference",
      "expected_passed": false,
      "expected_message_contains": "broken reference",
      "expected_data_contains": {"filename": "type_mismatch.py"}
    },
    {
      "name": "valid_api_usage",
      "description": "All function calls use defined names — passes all rules",
      "source": "import json\n\ndef parse(data):\n    return json.loads(data)\n",
      "filename": "valid_api.py",
      "expected_rule": "broken_reference",
      "expected_passed": true,
      "note": "json.loads is a valid API call"
    },
    {
      "name": "class_method_missing_symbol",
      "description": "Class method uses an undefined symbol from a removed API",
      "source": "class Processor:\n    def run(self):\n        return removed_api_function_xyz()\n",
      "filename": "class_api.py",
      "expected_rule": "missing_symbol",
      "expected_passed": false,
      "expected_message_contains": "missing symbol",
      "expected_data_contains": {"filename": "class_api.py"}
    },
    {
      "name": "eval_based_dynamic_call",
      "description": "Using eval to call functions dynamically — API misuse pattern",
      "source": "def dispatch(name, arg):\n    return eval(f'{name}({arg})')\n",
      "filename": "dynamic_api.py",
      "expected_rule": "api_misuse",
      "expected_passed": false,
      "expected_message_contains": "API misuse",
      "expected_data_contains": {"filename": "dynamic_api.py"}
    },
    {
      "name": "aliased_pickle_not_caught",
      "description": "Aliased import of pickle bypasses APIMisuseRule — known limitation",
      "source": "import pickle as pk\n\ndef load_data(path):\n    with open(path, 'rb') as f:\n        return pk.load(f)\n",
      "filename": "aliased_pickle.py",
      "expected_rule": "api_misuse",
      "expected_passed": true,
      "note": "APIMisuseRule checks module names literally; aliased imports (import X as Y) are not tracked"
    },
    {
      "name": "from_import_alias_not_caught",
      "description": "From-import alias of dangerous function bypasses APIMisuseRule — known limitation",
      "source": "from os import system as run_cmd\n\ndef execute(cmd):\n    return run_cmd(cmd)\n",
      "filename": "aliased_system.py",
      "expected_rule": "api_misuse",
      "expected_passed": true,
      "note": "APIMisuseRule does not resolve from-import aliases; 'run_cmd' is not in the dangerous names set"
    }
  ]
}
