summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2015-04-15 13:37:28 +0200
committerJan Pokorný <jpokorny@redhat.com>2015-04-15 15:26:24 +0200
commit472eac9fdf594f79d2d0ad1907a49010f7d33489 (patch)
tree6c1cc761fcdbbc3b5c49df25a76633ccc43a9d41 /tests
parent8925ae6c258df81cb64f043ab1ac0898a7efd059 (diff)
downloadclufter-472eac9fdf594f79d2d0ad1907a49010f7d33489.tar.gz
clufter-472eac9fdf594f79d2d0ad1907a49010f7d33489.tar.xz
clufter-472eac9fdf594f79d2d0ad1907a49010f7d33489.zip
filters/stringiter_combine: new stringiter_combine2 filter
Think of this as 2-to-1 multiplexer (effectively just performing in-order concatenation of the two inputs). Also add a unit test. Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/filters/stringiter_combine.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/filters/stringiter_combine.py b/tests/filters/stringiter_combine.py
new file mode 100644
index 0000000..c47630d
--- /dev/null
+++ b/tests/filters/stringiter_combine.py
@@ -0,0 +1,36 @@
+# -*- coding: UTF-8 -*-
+# Copyright 2015 Red Hat, Inc.
+# Part of clufter project
+# Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt)
+"""Testing `stringiter-combine*' filter(s)"""
+__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"
+
+from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))
+
+
+from os.path import dirname, join
+from unittest import TestCase
+
+from .filter_manager import FilterManager
+from .format import CompositeFormat
+from .formats.string_iter import string_iter
+flt = 'stringiter-combine2'
+stringiter_combine2 = FilterManager.init_lookup(flt).filters[flt]
+#ccs = ccspcmk2pcscmd.in_format
+
+
+class FiltersStringitercombineTestCase(TestCase):
+ def testStringiterCombine2(self):
+ result = stringiter_combine2(
+ CompositeFormat(
+ ('composite', ('stringiter', 'stringiter')),
+ iter("ABC"), iter("DEF"),
+ #"ABC", "DEF",
+ formats=(string_iter, string_iter),
+ )
+ )
+ #print result.BYTESTRING()
+ self.assertEquals(result.BYTESTRING(), '\n'.join("ABCDEF") + '\n')
+
+
+from os.path import join, dirname as d; execfile(join(d(d(__file__)), '_gone'))