{"record":{"id":"3ca10c35cef7500f","repo":"pandas-dev/pandas","slug":"check-like-must-be-false-if-check-index-is-false","errorCode":null,"errorMessage":"check_like must be False if check_index is False","messagePattern":"check_like must be False if check_index is False","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"pandas/_testing/asserters.py","lineNumber":1116,"sourceCode":"        right_index_dtypes = (\n            [right.index.dtype]\n            if right.index.nlevels == 1\n            else cast(\"MultiIndex\", right.index).dtypes\n        )\n        check_exact_index = all(\n            dtype.kind in \"iu\" for dtype in left_index_dtypes\n        ) or all(dtype.kind in \"iu\" for dtype in right_index_dtypes)\n    elif check_exact is lib.no_default:\n        check_exact = False\n        check_exact_index = False\n    else:\n        check_exact_index = check_exact\n\n    rtol = rtol if rtol is not lib.no_default else 1.0e-5\n    atol = atol if atol is not lib.no_default else 1.0e-8\n\n    if not check_index and check_like:\n        raise ValueError(\"check_like must be False if check_index is False\")\n\n    # instance validation\n    _check_isinstance(left, right, Series)\n\n    if check_series_type:\n        assert_class_equal(left, right, obj=obj)\n\n    # length comparison\n    if len(left) != len(right):\n        msg1 = f\"{len(left)}, {left.index}\"\n        msg2 = f\"{len(right)}, {right.index}\"\n        raise_assert_detail(obj, \"Series length are different\", msg1, msg2)\n\n    if check_flags:\n        assert left.flags == right.flags, f\"{left.flags!r} != {right.flags!r}\"\n\n    if check_index:\n        # GH #38183","sourceCodeStart":1098,"sourceCodeEnd":1134,"githubUrl":"https://github.com/pandas-dev/pandas/blob/3b7651241d4da534b3559b60ef128e1c34f54116/pandas/_testing/asserters.py#L1098-L1134","documentation":"Raised by `assert_series_equal` when the caller passes `check_index=False` together with `check_like=True`. These are contradictory: `check_like=True` means 'ignore order by reindexing right onto left' (which inherently operates on the index), while `check_index=False` means 'do not compare the index at all'. pandas refuses the combination with a ValueError rather than silently picking a behavior.","triggerScenarios":"Calling `pd.testing.assert_series_equal(a, b, check_index=False, check_like=True)`; passing kwargs through a wrapper that defaults `check_like=True` while a user sets `check_index=False`.","commonSituations":"Layered test helpers that merge conflicting defaults; copy-paste of assert kwargs across tests; migration from older pandas where this combination was silently permitted.","solutions":["If you genuinely want to ignore order, keep `check_like=True` and remove `check_index=False`.","If you want to skip index comparison, set `check_like=False` (or omit) and keep `check_index=False`.","Audit wrapper helpers for conflicting defaults."],"exampleFix":"// before\nassert_series_equal(a, b, check_index=False, check_like=True)\n\n// after\nassert_series_equal(a, b, check_index=False)","handlingStrategy":"validation","validationCode":"assert not (check_index is False and check_like is True), 'check_like requires check_index'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Audit wrapper test helpers for conflicting default kwargs.","Remember check_like operates on the index — it cannot coexist with check_index=False."],"tags":["testing","argument-conflict","assertions"],"backgroundTag":null,"analyzedSha":"3b7651241d4da534b3559b60ef128e1c34f54116","analyzedAt":"2026-08-11T22:10:44.015Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}