def test_postprocess_nodes_multiple_batches(monkeypatch):
    """
    Test the batching logic by lowering MAX_WORDS_PER_BATCH to force splitting.
    With MAX_WORDS_PER_BATCH set to 15:
      - A node with 10 words (raw score 100) is alone in its batch.
      - Two nodes (one with 10 words and one with 5 words) are split into another batch,
        yielding raw scores 100 and 50 (normalized 1.0 and 0.5).
    """
    original_max = base_module.MAX_WORDS_PER_BATCH
    monkeypatch.setattr(
        base_module, "MAX_WORDS_PER_BATCH", 15
    )  # Force small batch size

    try:
        nodes = [
            NodeWithScore(node=TextNode(text="word " * 10), score=0),
            NodeWithScore(node=TextNode(text="word " * 10), score=0),
            NodeWithScore(node=TextNode(text="word " * 5), score=0),
        ]
        qb = QueryBundle(query_str="test query")
        obj = AIMonRerank(api_key="testkey", top_n=3)
        result = obj._postprocess_nodes(nodes, qb)

        scores = [node.score for node in result]
        assert scores == sorted(scores, reverse=True)

        # Ensure that one of the nodes has a normalized score of 0.5 (i.e., raw score 50).
        assert 0.5 in scores
    finally:
        monkeypatch.setattr(
            base_module, "MAX_WORDS_PER_BATCH", original_max
        )  # Restore original batch size

    Test the batching logic by lowering MAX_WORDS_PER_BATCH to force splitting.
    With MAX_WORDS_PER_BATCH set to 15:
      - A node with 10 words (raw score 100) is alone in its batch.
      - Two nodes (one with 10 words and one with 5 words) are split into another batch,
        yielding raw scores 100 and 50 (normalized 1.0 and 0.5).
    
llama-index-integrations/postprocessor/llama-index-postprocessor-aimon-rerank/tests/test_postprocessor_aimon_rerank.py