コード例 #1
0
    def it_ommits_punctuation_symbols():
        word_list = echo('word1, word2, word3.') | words() | value()

        assert_that(word_list, is_(['word1', 'word2', 'word3']))
コード例 #2
0
    def it_filters_items_by_python_regular_expressions():
        items = echo(['item1', '2item', 'item3']) | grep('^item*') | value()

        assert_that(items, is_(['item1', 'item3']))
コード例 #3
0
    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']))
コード例 #4
0
        def it_splits_text_into_words():
            word_list = echo('word1\tword2\tword3') | words() | value()

            assert_that(word_list, is_(['word1', 'word2', 'word3']))
コード例 #5
0
    def it_sends_the_specified_count_of_arguments():
        items = echo('1.2.3.4') | split('.') | head(2) | value()

        assert_that(items, is_(['1', '2']))
コード例 #6
0
        def it_sends_item_by_item_to_output():
            items = echo([1, 2, 3]) | filter(2) | value()

            assert_that(items, is_([1, 3]))
コード例 #7
0
    def it_sends_N_last_items():
        items = echo('1.2.3.4') | split('.') | tail(2) | value()

        assert_that(items, is_(['3', '4']))
コード例 #8
0
    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']))
コード例 #9
0
        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'))
コード例 #10
0
        def it_sends_it_to_output():
            text = echo('item') | value()

            assert_that(text, is_('item'))
コード例 #11
0
    def it_filters_items_by_python_regular_expressions():
        items = echo(['item1', '2item', 'item3']) | grep('^item*') | value()

        assert_that(items, is_(['item1', 'item3']))
コード例 #12
0
    def it_ommits_punctuation_symbols():
        word_list = echo('word1, word2, word3.') | words() | value()

        assert_that(word_list, is_(['word1', 'word2', 'word3']))
コード例 #13
0
        def it_splits_text_into_words():
            word_list = echo('word1\tword2\tword3') | words() | value()

            assert_that(word_list, is_(['word1', 'word2', 'word3']))
コード例 #14
0
        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'))
コード例 #15
0
    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)]))
コード例 #16
0
        def it_sends_it_to_output():
            text = echo('item') | value()

            assert_that(text, is_('item'))
コード例 #17
0
        def it_sends_item_by_item_to_output():
            items = echo([1, 2, 3]) | filter(2) | value()

            assert_that(items, is_([1, 3]))