summaryrefslogtreecommitdiffstats
path: root/tests/formats/string_iter.py
blob: 8cad3b4b880e2778fb596251a943c5b654072eb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding: UTF-8 -*-
# Copyright 2014 Red Hat, Inc.
# Part of clufter project
# Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt)
"""Testing string_{iter,list,set} formats"""
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))

from unittest import TestCase

from .format_manager import FormatManager
string_list = FormatManager.init_lookup('string-list').formats['string-list']


class FormatsStringIterTestCase(TestCase):
    def testBytestringToStringListSingle(self):
        sl = string_list('bytestring', "abcd")
        self.assertEqual(sl.STRINGLIST(), ['abcd'])
    def testBytestringToStringList(self):
        sl = string_list('bytestring', """\
a
b
c
b
a
""")
        self.assertEqual(sl.STRINGLIST(), ['a', 'b', 'c', 'b', 'a'])


from os.path import join, dirname as d; execfile(join(d(d(__file__)), '_gone'))