コード例 #1
0
def init(config):
	global FILTER_MAP
	FILTER_MAP.update({
		'doc': filterByDocumentation,
		'!doc': negate(filterByDocumentation),
		'-doc': remove(filterByDocumentation),

		'code': filterByCode,
		'!code': negate(filterByCode),
		'-code': remove(filterByCode)
	})
コード例 #2
0
ファイル: test_filter.py プロジェクト: angeluseve/tiddlyweb
def test_negate_fitler_by_title():
    """
    Return those tiddlers which are not of provided title.
    """

    filter_function = filter.negate(filter.by_title)
    found_tiddlers = filter_function('TiddlerOne', tiddlers)
    assert len(found_tiddlers) == 2, 'two tiddlers in returned list, got %s' % len(found_tiddlers)
コード例 #3
0
ファイル: test_filter.py プロジェクト: angeluseve/tiddlyweb
def test_compose_with_negate_filters():
    """
    Compose a list of filters and see that they do the right thing.
    """

# this data structure seems suspect, but we can change it later
    ordered_filters = [
            [filter.negate(filter.by_tag), 'tagtwo'],
            [filter.by_title, 'TiddlerTwo'],
            ]

    found_tiddlers = filter.by_composition(ordered_filters, tiddlers)
    assert len(found_tiddlers) == 2, 'three tiddlers should be found, got %s' % len(found_tiddlers)