def it_ommits_punctuation_symbols(): word_list = echo('word1, word2, word3.') | words() | value() assert_that(word_list, is_(['word1', 'word2', 'word3']))
def it_filters_items_by_python_regular_expressions(): items = echo(['item1', '2item', 'item3']) | grep('^item*') | value() assert_that(items, is_(['item1', 'item3']))
def it_splits_string_by_delimiter_and_outputs_all_the_parts(): nums = echo('1.2.3.4') | split('.') | value() assert_that(nums, is_(['1', '2', '3', '4']))
def it_splits_text_into_words(): word_list = echo('word1\tword2\tword3') | words() | value() assert_that(word_list, is_(['word1', 'word2', 'word3']))
def it_sends_the_specified_count_of_arguments(): items = echo('1.2.3.4') | split('.') | head(2) | value() assert_that(items, is_(['1', '2']))
def it_sends_item_by_item_to_output(): items = echo([1, 2, 3]) | filter(2) | value() assert_that(items, is_([1, 3]))
def it_sends_N_last_items(): items = echo('1.2.3.4') | split('.') | tail(2) | value() assert_that(items, is_(['3', '4']))
def it_filters_items_that_do_not_match_the_specified_regular_expression( ): items = echo(['item1', '2item', 'item3' ]) | grep('^item*').inv() | value() assert_that(items, is_('2item'))
def it_sends_it_to_output(): text = echo('item') | value() assert_that(text, is_('item'))
def it_filters_items_that_do_not_match_the_specified_regular_expression(): items = echo(['item1', '2item', 'item3']) | grep('^item*').inv() | value() assert_that(items, is_('2item'))
def it_sends_unique_items_with_their_frequency(): items = echo('1.2.3.1.3') | split('.') | freq() | value() assert_that(items, is_([('1', 2), ('2', 1), ('3', 2)]))