Skip to content

[Improvement] HumanEval/111 canonical solution - ValueError on space-only input #278

@take0x

Description

@take0x

Description

The canonical solution for HumanEval/111 (histogram) in the HumanEval+ dataset throws a ValueError when the input string contains only spaces, which contradicts the expected behavior.

Problem

The canonical solution attempts to call max() on an empty list when all words after splitting are empty strings:

Steps to Reproduce

histogram(" ")  # Single space
histogram("   ")  # Multiple spaces

Expected Behavior

Ideally, the function should return an empty dictionary {} for strings containing only spaces.

Actual Behavior

ValueError: max() iterable argument is empty

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions