Beispiel #1
0
    def test_join(self):
        self.assertEqual(join_list(None, "and"), "")
        self.assertEqual(join_list([], "and"), "")

        self.assertEqual(join_list(["a"], "and"), "a")
        self.assertEqual(join_list(["a", "b"], "and"), "a and b")
        self.assertEqual(join_list(["a", "b"], "or"), "a or b")

        self.assertEqual(join_list(["a", "b", "c"], "and"), "a, b and c")
        self.assertEqual(join_list(["a", "b", "c"], "or"), "a, b or c")
        self.assertEqual(join_list(["a", "b", "c"], "or", ";"), "a; b or c")
        self.assertEqual(join_list(["a", "b", "c", "d"], "or"), "a, b, c or d")

        self.assertEqual(join_list([1, "b", 3, "d"], "or"), "1, b, 3 or d")
Beispiel #2
0
    def test_join(self):
        self.assertEqual(join_list(None, "in"), "")
        self.assertEqual(join_list([], "in"), "")

        self.assertEqual(join_list(["a"], "in"), "a")
        self.assertEqual(join_list(["a", "b"], "in"), "a in b")
        self.assertEqual(join_list(["a", "b"], "ali"), "a ali b")

        self.assertEqual(join_list(["a", "b", "c"], "in"), "a, b in c")
        self.assertEqual(join_list(["a", "b", "c"], "ali"), "a, b ali c")
        self.assertEqual(join_list(["a", "b", "c"], "ali", ";"), "a; b ali c")
        self.assertEqual(join_list(["a", "b", "c", "d"], "ali"),
                         "a, b, c ali d")

        self.assertEqual(join_list([1, "b", 3, "d"], "ali"), "1, b, 3 ali d")
Beispiel #3
0
    def test_join(self):
        self.assertEqual(join_list(None, "a"), "")
        self.assertEqual(join_list([], "a"), "")

        self.assertEqual(join_list(["a"], "a"), "a")
        self.assertEqual(join_list(["a", "b"], "a"), "a a b")
        self.assertEqual(join_list(["a", "b"], "nebo"), "a nebo b")

        self.assertEqual(join_list(["a", "b", "c"], "a"), "a, b a c")
        self.assertEqual(join_list(["a", "b", "c"], "nebo"), "a, b nebo c")
        self.assertEqual(
            join_list(["a", "b", "c"], "nebo", ";"), "a; b nebo c")
        self.assertEqual(
            join_list(["a", "b", "c", "d"], "nebo"), "a, b, c nebo d")

        self.assertEqual(join_list([1, "b", 3, "d"], "nebo"), "1, b, 3 nebo d")
    def test_join_list_de(self):
        self.assertEqual(join_list(['Hallo', 'Auf wieder Sehen'], 'and'),
                         'Hallo und Auf wieder Sehen')

        self.assertEqual(join_list(['A', 'B', 'C'], 'or'), 'A, B oder C')