def test_auto_packing(profile_packing: Mock):
    """Tests that auto packing selects the highest packing ratio with zero.

    waste.
    """
    # List of tuples of packing_ratio, padding, waste, sorted by packing ratio
    profile_packing.return_value = [(1, .9, 0), (2, .8, 0), (3, .7, .5)]

    packing_ratio = auto_packing_ratio(
        dataloader_cfg={'dataset': {
            'max_seq_len': 2048,
        }},
        tokenizer=None,  # type: ignore
        device_batch_size=1,
    )  # Dummy values, profiling results are already set.

    # auto packing ratio should choose 2 because packing ratio is maximized while waste is 0.
    assert packing_ratio == 2
Tests that auto packing selects the highest packing ratio with zero.

    waste.
    
tests/data/test_packing.py