{
  "fixtures": [
    {
      "name": "undefined_cross_module_reference",
      "description": "References a name that would come from another module but is not imported",
      "source": "def handler():\n    return external_service_xyz.process()\n",
      "filename": "handler.py",
      "expected_rule": "broken_reference",
      "expected_passed": false,
      "expected_message_contains": "broken reference",
      "expected_data_contains": {"filename": "handler.py"}
    },
    {
      "name": "properly_imported_cross_module",
      "description": "Cross-module symbol is properly imported — passes validation",
      "source": "from os.path import join\n\ndef build_path():\n    return join('a', 'b', 'c')\n",
      "filename": "paths.py",
      "expected_rule": "broken_reference",
      "expected_passed": true,
      "note": "join is properly imported from os.path"
    },
    {
      "name": "nested_function_scoped_symbol",
      "description": "Inner function uses a closure variable from enclosing scope — correctly recognised as defined",
      "source": "def outer():\n    prefix = 'hello'\n    def inner(name):\n        return f'{prefix} {name}'\n    return inner\n",
      "filename": "closure.py",
      "expected_rule": "missing_symbol",
      "expected_passed": true,
      "note": "MissingSymbolRule tracks enclosing function scopes so closure variables are recognised"
    },
    {
      "name": "undefined_in_class_method",
      "description": "Class method references a name not defined anywhere in the file",
      "source": "class Service:\n    def execute(self):\n        return undefined_dependency_xyz\n",
      "filename": "service.py",
      "expected_rule": "missing_symbol",
      "expected_passed": false,
      "expected_message_contains": "missing symbol",
      "expected_data_contains": {"filename": "service.py"}
    },
    {
      "name": "wildcard_import_symbol",
      "description": "Symbol may come from wildcard import — BrokenReferenceRule flags it because it cannot resolve wildcard imports",
      "source": "from os.path import *\n\ndef get_dir():\n    return dirname('/tmp/test')\n",
      "filename": "wildcard.py",
      "expected_rule": "broken_reference",
      "expected_passed": false,
      "expected_message_contains": "broken reference",
      "expected_data_contains": {"filename": "wildcard.py"},
      "note": "BrokenReferenceRule does not resolve wildcard imports; names from star imports are not tracked"
    },
    {
      "name": "deeply_nested_closure",
      "description": "Triple-nested closure referencing variables from all enclosing scopes",
      "source": "def level1():\n    a = 1\n    def level2():\n        b = 2\n        def level3():\n            return a + b\n        return level3\n    return level2\n",
      "filename": "deep_closure.py",
      "expected_rule": "missing_symbol",
      "expected_passed": true,
      "note": "Enclosing scope tracking handles multiple nesting levels"
    }
  ]
}
