Example #1
0
def test_string_component_transform_factory_with_LOCALE_and_DUMB_returns_fast_int_and_groupletters_and_locale_convert(
        x):
    try:
        assert _string_component_transform_factory(ns._DUMB | ns.LOCALE)(
            x) == fast_int(x, key=lambda x: get_strxfrm()(_groupletters(x)))
    except ValueError as e:  # handle broken locale lib on BSD.
        if 'is not in range' not in str(e):
            raise
Example #2
0
def test_string_component_transform_factory_with_LOCALE_and_DUMB_returns_fast_int_and_groupletters_and_locale_convert_example(
):
    x = 'hello'
    assert _string_component_transform_factory(ns._DUMB
                                               | ns.LOCALE)(x) == fast_int(
                                                   x,
                                                   key=lambda x: get_strxfrm()
                                                   (_groupletters(x)))
Example #3
0
def test_groupeletters_returns_letters_with_lowercase_transform_of_letter(x):
    assert _groupletters(x) == ''.join(chain.from_iterable([low(y), y] for y in x))
Example #4
0
def test_groupletters_returns_letters_with_lowercase_transform_of_letter_example():
    assert _groupletters('HELLO') == 'hHeElLlLoO'
    assert _groupletters('hello') == 'hheelllloo'
Example #5
0
def test_groupeletters_returns_letters_with_lowercase_transform_of_letter(x):
    assume(bool(x))
    assert _groupletters(x) == ''.join(chain.from_iterable([low(y), y] for y in x))
Example #6
0
def test_groupletters_returns_letters_with_lowercase_transform_of_letter_example():
    assert _groupletters('HELLO') == 'hHeElLlLoO'
    assert _groupletters('hello') == 'hheelllloo'
Example #7
0
def test_post_split_function_with_LOCALE_and_GROUPLETTERS_returns_fast_int_and_groupletters_and_locale_convert(x):
    assume(x)
    try:
        assert _post_split_function(ns.GROUPLETTERS | ns.LOCALE)(x) == fast_int(x, key=lambda x: get_strxfrm()(_groupletters(x)))
    except ValueError as e:  # handle broken locale lib on BSD.
        if 'is not in range' not in str(e):
            raise
Example #8
0
def test_post_split_function_with_LOCALE_and_GROUPLETTERS_returns_fast_int_and_groupletters_and_locale_convert_example():
    x = 'hello'
    assert _post_split_function(ns.GROUPLETTERS | ns.LOCALE)(x) == fast_int(x, key=lambda x: get_strxfrm()(_groupletters(x)))