{
  "fixtures": [
    {
      "name": "list_comprehension_side_effect",
      "description": "List comprehension used purely for side effects — not portable to languages without expression-level iteration",
      "source": "import os\n\n[os.remove(f) for f in ['a.tmp', 'b.tmp']]\n",
      "filename": "cleanup.py",
      "expected_rule": "api_misuse",
      "expected_passed": true,
      "note": "api_misuse only flags dangerous APIs; this is a porting smell but not an API misuse"
    },
    {
      "name": "dynamic_attribute_access",
      "description": "Getattr with string-based attribute names — no static equivalent in most typed languages",
      "source": "class Config:\n    debug = True\n    verbose = False\n\ndef get_flag(name):\n    return getattr(Config, name)\n",
      "filename": "config.py",
      "expected_rule": "broken_reference",
      "expected_passed": true,
      "note": "getattr is valid Python; broken_reference cannot detect dynamic access issues"
    },
    {
      "name": "multiple_inheritance_diamond",
      "description": "Diamond inheritance with MRO — difficult to port to single-inheritance languages",
      "source": "class Base:\n    def method(self):\n        return 'base'\n\nclass Left(Base):\n    def method(self):\n        return 'left'\n\nclass Right(Base):\n    def method(self):\n        return 'right'\n\nclass Diamond(Left, Right):\n    pass\n\nresult = Diamond().method()\n",
      "filename": "diamond.py",
      "expected_rule": "syntax_error",
      "expected_passed": true,
      "note": "Syntactically valid Python; porting concern is semantic not syntactic"
    },
    {
      "name": "metaclass_usage",
      "description": "Metaclass pattern — no direct equivalent in most target languages",
      "source": "class Meta(type):\n    def __new__(mcs, name, bases, namespace):\n        cls = super().__new__(mcs, name, bases, namespace)\n        return cls\n\nclass MyClass(metaclass=Meta):\n    pass\n",
      "filename": "meta.py",
      "expected_rule": "syntax_error",
      "expected_passed": true,
      "note": "Valid Python; metaclasses are a porting concern"
    },
    {
      "name": "unpacking_star_expression",
      "description": "Star unpacking not available in many target languages",
      "source": "first, *rest = [1, 2, 3, 4, 5]\nresult = first + sum(rest)\n",
      "filename": "unpack.py",
      "expected_rule": "broken_reference",
      "expected_passed": true,
      "note": "Valid Python; star unpacking is a porting concern"
    },
    {
      "name": "walrus_operator",
      "description": "Assignment expression (:=) not available in most languages",
      "source": "data = [1, 2, 3, 4, 5, 6]\nresult = [y for x in data if (y := x * 2) > 5]\n",
      "filename": "walrus.py",
      "expected_rule": "syntax_error",
      "expected_passed": true,
      "note": "Valid Python 3.8+; walrus operator is a porting concern"
    },
    {
      "name": "eval_in_porting_context",
      "description": "eval() used for dynamic dispatch — API misuse flagged regardless of porting intent",
      "source": "def dynamic_call(fn_name, arg):\n    return eval(fn_name + '(' + repr(arg) + ')')\n",
      "filename": "dynamic_dispatch.py",
      "expected_rule": "api_misuse",
      "expected_passed": false,
      "expected_message_contains": "API misuse",
      "expected_data_contains": {"filename": "dynamic_dispatch.py"}
    },
    {
      "name": "exec_for_code_generation",
      "description": "exec() used for code generation — common in porting but always flagged as API misuse",
      "source": "def make_class(name):\n    exec(f'class {name}: pass')\n",
      "filename": "codegen.py",
      "expected_rule": "api_misuse",
      "expected_passed": false,
      "expected_message_contains": "API misuse",
      "expected_data_contains": {"filename": "codegen.py"}
    }
  ]
}
