nomy-data-models 0.35.6

Data model definitions for Nomy wallet analysis data processing
Documentation
"""Tests for string utilities."""

import pytest

from nomy_data_models.utils.string import to_snake_case


class TestString:
    """Test cases for string utilities in the string module."""

    @pytest.mark.parametrize(
        "input_text,expected_output",
        [
            # Basic conversions
            ("HelloWorld", "hello_world"),
            ("hello_world", "hello_world"),
            ("hello-world", "hello_world"),
            ("HELLO_WORLD", "hello_world"),
            # With numbers
            ("helloWorld123", "hello_world123"),
            # With spaces
            ("hello world", "hello_world"),
            ("Hello World", "hello_world"),
            # With special characters
            ("HelloWorld!", "hello_world_"),
            # Edge cases
            ("", ""),
            ("A", "a"),
            ("123", "123"),
            ("_hello_", "_hello_"),
            # Different case styles
            ("snake_case", "snake_case"),
            ("camelCase", "camel_case"),
            ("PascalCase", "pascal_case"),
            ("SCREAMING_SNAKE_CASE", "screaming_snake_case"),
            ("kebab-case", "kebab_case"),
            ("Title Case", "title_case"),
            ("snake_Case_Mixed", "snake_case_mixed"),
            ("__double__underscore__", "__double__underscore__"),
        ],
    )
    def test_to_snake_case(self, input_text, expected_output):
        """Test the to_snake_case function with various inputs.

        Args:
            input_text: The input string to convert
            expected_output: The expected snake_case result
        """
        result = to_snake_case(input_text)
        assert (
            result == expected_output
        ), f"Expected '{input_text}' to convert to '{expected_output}', got '{result}'"